pellen吧 关注:13贴子:238
  • 5回复贴,共1
#include<stdio.h>
#include<string.h>
#define NUM 4
struct student
{
int rank;
char*name;
float score;
};
struct student stu []={3,"Tom",89.5,
4."Mary",76.5
1,"Jack",98.0
2,"Jim",92.0 };
void main()
{
char str[10];
int i;
do {
printf("Enter a name:");
}while(strcmp(str,"0")!=0);
}



1楼2012-04-11 10:41回复
    吧主,这题怎么做啊?


    2楼2012-04-11 10:41
    回复
      9.1
      #include<stdio.h>
      #include<string.h>
      #define NUM 4
      struct student
      {
      int rank;
      char *name;
      float score;
      };
      struct student stu[]={{3,"tom",89.5},{4,"mary",76.5},{1,"jack",98.0},{2,"jim",92.0}};
      void main()
      {
      char str[10];
      int i;
      do{
      printf("please name\n");
      scanf("%s",str);
      for(i=0;i<NUM;i++)
      {if(strcmp(stu[i].name,str)==0)
      printf("%d,%.1f\n",stu[i].rank,stu[i].score);}
      }while(strcmp(str,"0")!=0);
      }


      IP属地:湖北3楼2012-04-11 11:45
      回复
        谢了


        4楼2012-04-11 11:49
        回复
          看你c语言这么牛逼,看来我上课要听讲了


          IP属地:湖北来自掌上百度5楼2012-04-16 00:20
          回复
            一般般


            IP属地:湖北来自手机贴吧6楼2012-04-16 11:28
            回复