Home > Back-end > Bosses genuflect is begged to see where is wrong
Bosses genuflect is begged to see where is wrong
Time:06-10
#include Int main () { Int r; The scanf (" % d ", & amp; R); Float s [r]; Float * p=s; Char x [r]; Char * c=x; for(int i=0; iThe scanf (" % % f "c, c + +, p++); } P=s; C=x; for(int i=0; iIf (* c=='F') { Printf (" \ n % 1.2 f ", * p * 1.09); } The else { Printf (" \ n % 1.2 f ", * p/1.09); } } return 0; } Read the along while don't know how to give an issue, from the operation result should be a problem with my input,
CodePudding user response:
The scanf in c + + p++, why write so much? Due to excessive confidence?
CodePudding user response:
Can run? Compilation is wrong! Float s [r]; The C language definition to specify an array length, need to use a constant here, can't use r Char x [r]; It's the same,
CodePudding user response:
These two + + on the for the inside, bad i++ right?
CodePudding user response:
First of all, I if you use the dve I suggest you to install the stdio or query let dve debugging method, it is ok to debug,
CodePudding user response:
The scanf (" % d ", & amp; R); getchar();
The scanf (" % % f "c, c + +, p++); getchar();
Both the scanf followed by getchar (); To filter out the enter
CodePudding user response:
# include #include
Int main () { Int r; The scanf (" % d ", & amp; R); //float s [r]. Float * s; //char x [r]. Char * x; S=(float *) malloc (sizeof (float) * r); if (! S) exit(0); X=(char *) malloc (sizeof (char) * r); if (! X) exit(0);
Char * c=x; Float * p=s;
getchar();//for '\ n' for(int i=0; i//the scanf (" % % f "c, c + +, p++); The scanf (" % % f "c, c + I, p + I); getchar();//for '\ n' } P=s; C=x; for(int i=0; iIf (* c=='F') { Printf (" \ n % 1.2 f ", * p * 1.09); } The else { Printf (" \ n % 1.2 f ", * p/1.09); } }