#include
Int main ()
{
Struct student
{
Int num.//salesman code
Int the product;//product code
Int price;//product unit price
Int quantity;//sales
Int the date;//date
X} [100];
The FILE * fp.
Int I, j;
Fopen_s (& amp; Fp, "D: \ \ list. TXT", "r");
For (I=0; i <20; I++)
{
For (j=0; J & lt; 5; J++)
{
Fscanf_s (fp, "% d, % d, % d, % d, % d", & amp; X [I]. The product, & amp; X [I]. Price, & amp; X [I]. Quantity, & amp; X [I] date);
}
}
For (I=0; i <20; I++)
{
For (j=0; J & lt; 5; J++)
{
Printf (" % d, % d, % d, % d, % d ", x [I] num, x [I] product, x [I] price, x [I]. Quantity, x [I] date);
}
}
fclose(fp);
CodePudding user response:
Two inner lining for (j... ) more cycle and fscanf_s () less & amp; X [I]. Num.CodePudding user response:
Inner loop j useless?CodePudding user response: