Your program will recurse forever, consuming hypothetically infinite amounts of memory. "if(x==1.41421509)" will probably never return true, because floating point values don't have infinite precision. You should do
instead, to see if it's approaching a value precise enough. Adjust ".001" to taste.
Since your computer probably won't let you have infinite amounts of stack space, recursing forever causes it to crash.
Why not use a loop instead of having calcx() call itself?
---------- Post updated at 10:53 AM ---------- Previous update was at 10:50 AM ----------
You should probably also have a count value, so if it gets stuck, it'll give up after a few thousand loops.
Hi my friends
I am beginner unix programmer I have written small c++ program in text editor and I have change it mode to 555 to make it executable file to use it in unix O.P.
#include<iostream.h>
main()
{
cout<<"Hello World";
}
but some syntax erroe came for <<
can any one help... (5 Replies)
Hi,
I wanted to know if i can write a program using switches and signals, etc to trace execution of other unix program which calls c program internally.
If yes how? If not with signals and switches then are there any other methods apart from debugging with gdb/dbx. (3 Replies)
Hi all:
I have a problem with a C++ service runing on solaris 10. This service only set a signal on oracle table. When the service detect a cut off on the line (tcp/ip), trigger a cobol program for set the signal OFF. When the line is on again, the service trigger the same cobol program for set... (0 Replies)
I have made use of 'valgrind' and -finstrument-functions compiler option for debugging / analyzing code. Both the options lets us know the line / file being executed to some extent.
Is there a generic way that lets program dump the file:line it is getting executed dumped to a log file during... (3 Replies)
I got a program named as "fastq_to_fasta".
I got a long list of file all named as AB1 and AB2.
My input file is :
071022_L1_AB1.fq
012121_L1_AB1.fq
021213_L1_AB1.fq
012153_L1_AB1.fq
071022_L1_AB2.fq
012121_L1_AB2.fq
021213_L1_AB2.fq
012153_L1_AB2.fq
.
.
.
.
.
.
My desired... (10 Replies)
How can I get around this? when my program reaches the following popen job it halts the program until the ping/netstat/ipconfig/traceroute is completed then resume to the rest of the program...
FILE *in;
extern FILE *popen();
char buff;
char newline;
char nstat;
char nping;
... (5 Replies)
I have a program dnapars
I execute the program from command line as following:
./dnapars
The program then prompts me some message as a user menu from where I have to select a series of options in the order R U Y R. And then I copy the output file (outfile) in another result file.
I wrote the... (3 Replies)
I need UNIX scripts for polling, Uncompressing files and moving files between directory. Also trying to save file paths and any other variables in an independent file (.env) and use these at runtime by executing this file in the main script. (3 Replies)