Look for fscanf()
Type: Posts; User: frrossk
Look for fscanf()
Check itoa(), sprintf()
Continuing play?
>>27. What is the difference between "calloc" and "malloc"?
First begins with 'c', the second with 'm'. Good enough? :D
>>and it doesn't do the same thing as clrscr(), because clrscr() will actually clear the screen and start you printing back at the top. your way will have you printing at the bottom.
I know; I was...
You have 2 lines of code:
......................
cout << endl << endl << endl << endl << endl << endl << endl;
......................
cout << endl << endl << endl << endl<< endl << endl <<...
Missing first time...What are you using that file (fout.open ("prompt.txt");) for???
First, don't #include <conio.h>, as it's not standard header. And quit using clrscr(). You need to use
#include <fstream>
#include <iomanip>
#include <iostream>
#include <math.h>
2nd,
What will be the point of view of a person standing between ball and hole? :D
I think you should take a look here: functions
You mean to pass the value returned by the function() to a new function called calculate()?
Something like this, maybe?
#include <stdio.h>
//declare functions
int function(void);
int...
Strange... I tried your program in my compiler (Dev-cpp 4.9.9.0) and I don't get any seg fault...
Try this:
double getBalance(float p, float i, float q, int n)
{
return (p* pow ( (1+ (i / q)),(n * q)));
}
It's working OK for me...
Read this .
I think your formula for calculate the balance is getting to pretty big numbers (that get beyond the range for floating numbers in C). Declare double getBalance(float p, float i, float q, int n); and...
Maybe something like this: http://www.mpeg.org/MSSG/#dos?
I guess you want something like this:
int SkiptoEndofLine()
{
while (readchar()!='\n')
{
;
}
}
Why don't you read a line at once form the file and process every char in that line until you need to skip to the next line? Wouldn't be simpler this way?
How do you read from the file? Some code...
Something like this:
if (strchr (entry->d_name, '.') == NULL)
printf ("%*s%s/\n",depth,"",entry->d_name);
??
>>char to int
atoi or strtol functions (stdlib.h)
>>int to char
sprintf, snprintf (stdio.h)
In function char *check_str(char *string2):
char *check_str(char *string2)
{
char string3[]="abc";
strcat(string2,string3);
return char string2[40];
}
>>void main(void)
Always use int main()
>>void check_str(char);
As you defined this function, it should retun a string, and it gets a parameter that is a string, so it should be char*...
www.bloodshed.net - an example
For more, check http://www.compilers.net/Dir/Free/Compilers/CCpp.htm
What's not clear?
Your compiler is a DOS-based one (pretty old); you should use a newer one...
>>getchar is a nonporatble method
getchar() is defined in ANSI-C and is supported under Windows and Linux (I never played with MacOS, so I don't count it), and is nonportable? I'd like a bet... :D