printf("Your Total Price is :%d", TotalPrice);
You're using the wrong fotmat to print a float %d is for integers
And then you should calculate TotalPrice before printing it's value.
Kurt
Type: Posts; User: ZuK
printf("Your Total Price is :%d", TotalPrice);
You're using the wrong fotmat to print a float %d is for integers
And then you should calculate TotalPrice before printing it's value.
Kurt
I'd put include guards around the code in Array2d.h.
Guess that #pragma once thingy does the same thing
Kurt
Assign the values of a and b to num after reading a and b from the stream
Kurt
Replacing a single character with 2 or even 3 characters will invalidate the iterator.
Try string::find in a loop.
Also the allocated buffer has no space for a terminating 0 that you fail to...
1; remove that line
char *moo = str;
moo is never used
2: NULL is defined as a pointer type. You want to compare to the 0 character -> use '\0'
Kurt
for(int i =0; i<10; i++)
{
cout <<a<<"\n";
*b++; //shouldn't this assigned a new value to a??
}
the post increment operater will be executed first -> first the pointer...
as I said before try
while ( getline(infile, s) ) {
... // your for loop
}
And you are still accessing the string out of bounds
Kurt
Yes, you could put the getline call as the condition for a while loop.
The other mistake is that sizeof() wont return the length of the string
Kurt
if(s[i]=='a'&&'n'&&'d')
that won't do what you want, it will be true for each 'a'
try
if(s[i]=='a' && s[i+1]='n' && s[i+2]=='d')
Beware of out of bounds accesss
Kurt
You didn't modify the data the const char * points to. Just reassigned it. That's allowed
Kurt
The variable countz on line 9 is not declared. Your program shouldn't compile.
If you change the variable to count then the reason for the crash is the format of your printf call. "%s" is used for...
num1 and num2 are both integers so the result of the division is an int too. "%f" expects a float
Kurt
averageGrades(grades[i],numGrades);
averageGrades() expects a pointer to int, you're passing an int
Better would be to pass a const reference to vector<int> to averageGrades(). This way you...
You cannot find the ascii value of a complete string
to get the ascii value of a single character you could just cast it to an int
char * str = "HELLO";
int i, cnt = strlen(str);
for ( i =...
void number_generator(numbers[6]) //warning specifier missing, defaults to 'int'
as the error says there is no type specifier
try
void number_generator(int numbers[6])
...
You use assignment when you want to compare for equality all over.
Kurt
Generally there is nothing wrong to use feof(). You just have to know that EOF is set after scanning has failed, that means that you still have to check the return value of your fscanf() calls. If...
fscanf(f,"%c",fitxer[i].cTipus);
fscanf(f,"%d", fitxer[i].nCasella);
fscanf expects the address of the varibles to read.
Kurt
true, Vectors ar copyable
this
vector<int>message1(n);
for(int i=0;i<message.size();i++)
{
I understand but the num in passengersR () is a different num from the one in main.
Guess you have to pass it as a parameter to the function
e.g.
double passengersR ( int num ) {
double...
double passengersR (); // this is a declaration of the function passengersR
double m; // Here a variable m is declared, its value is undefined
guess that is not what you want
double m...
casella[96].nX1 = 240;
casella[96].nX2 = 0;
casella[96].nY1 = 0;
casella[96].nY2 = 60;
casella[96].nTextx = 4;
casella[96].nTexty = 4;
casella[96].nColor =...
some commas are missing
kurt
Don't return from inside the loop.
If you'd indent the code better the mistake would be obvious.
Kurt
The second time there will be a \n in the input buffer and the scanf("%c", &op ) will read that as op.
simple fix: put getchar(); after scanf("%d%d", &num1, &num2);
Kurt