|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include<stdio.h>
#include<stdlib.h>
struct commodity
{
char number[10];
char name[10];
int the_first_quarter;
int the_second_quarter;
int the_third_quarter;
int average;
}com[3];
int main()
{
FILE *fp;
struct commodity a;
scanf("%s,%s,%d,%d,%d,%d",com[0].number,com[0].name,&com[0].the_first_quarter,&com[0].the_second_quarter,&com[0].the_third_quarter,&com[0].average);
a=com[0];
printf("%s,%s,%d,%d,%d,%d",a.number,a.name,a.the_first_quarter,a.the_second_quarter,a.the_third_quarter,a.average);
return 0;
}
//为什么输入和输出不一样?
#include<stdio.h>
#include<stdlib.h>
struct commodity
{
char number[10];
char name[10];
int the_first_quarter;
int the_second_quarter;
int the_third_quarter;
int average;
}com[3];
int main()
{
FILE *fp;
struct commodity a;
scanf("%s", com[0].number);
getchar();
scanf("%s", com[0].name);
getchar();
scanf("%d,%d,%d,%d",&com[0].the_first_quarter,&com[0].the_second_quarter,&com[0].the_third_quarter,&com[0].average);
a=com[0];
printf("%s\n", a.number);
printf("%s\n%s\n%d,%d,%d,%d",a.number,a.name,a.the_first_quarter,a.the_second_quarter,a.the_third_quarter,a.average);
return 0;
}
|
|