c初学者

B52 2002-03-26 12:51:04





#include<conio.h>
main()
{

int i;
char a[10][20]={{"caobiao"},{"zhaochaoyue"},{"baiyungui"},{"zhoufeilong"},{"yanghuating"},{"dingxingdian "},{"mahaisheng"},{"liujianjun"}};
int m=1;
char number[20];
int b[10]={97,67,56,89,87,97,65,59,78,95};
char c;clrscr();
while(m==1)
{


printf("Input the name to look for:");
scanf("%s",number);
for(i=0;i<=9;i++)
{

if(strcmp(number,a[i])==0)

{
if(b[i]<60)

{
printf("\n find %s,the score is %d ,you don't pass the test\n ",a[i],b[i]);
goto xx;
}

else if(b[i]<70)

{
printf("\n find %s the score is %d,you shoule study hard\n",a[i],b[i]);
goto xx;
}

else if(b[i]<80)

{
printf("\n find %s the score is %d,you are a midden student\n",a[i],b[i]);
goto xx;
}

else if(b[i]<100)

{
printf("\n find %s the score is %d,do well!\n",a[i],b[i]);
goto xx;
}
}

}
printf("sorry!not found!");
xx: printf("continue or not[y/n]?");
c=getch();
if(c=='n')m=0;
}
}
...全文
31 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
mike_hao_1980 2002-03-26
  • 打赏
  • 举报
回复
有些简单,为什么不少为深一点,用一用文件呀,Hash表呀什么的。
不过看起来好象没什么错误,如果初学,很不错了。
B52 2002-03-26
  • 打赏
  • 举报
回复
这是一个输入姓名以后查询成绩的程序
现在我想把它的界面设计成一个菜单
按1以后
可以开始查询按2后可以继续添加姓名和分数

请高手帮忙指点一下
#include<conio.h>
main()
{

int i;
char a[10][20]={{"caobiao"},{"zhaochaoyue"},{"baiyungui"},{"zhoufeilong"},{"yanghuating"},{"dingxingdian "},{"mahaisheng"},{"liujianjun"}};
int m=1;
char number[20];
int b[10]={97,67,56,89,87,97,65,59,78,95};
char c;clrscr();
while(m==1)
{


printf("Input the name to look for:");
scanf("%s",number);
for(i=0;i<=9;i++)
{
if(strcmp(number,a[i])==0)

{ if(b[i]<60)

{ printf("\n find %s,the score is %d ,you don't pass the test\n ",a[i],b[i]);
goto xx; }

else if(b[i]<70)

{ printf("\n find %s the score is %d,you shoule study hard\n",a[i],b[i]);
goto xx; }

else if(b[i]<80)

{ printf("\n find %s the score is %d,you are a midden student\n",a[i],b[i]);
goto xx;}

else if(b[i]<100)

{ printf("\n find %s the score is %d,do well!\n",a[i],b[i]);
goto xx;}
}

}
printf("sorry!not found!");
xx: printf("continue or not[y/n]?");
c=getch();
if(c=='n')m=0;
}
}
zhenshi 2002-03-26
  • 打赏
  • 举报
回复
好难的题
_blackwhite_ 2002-03-26
  • 打赏
  • 举报
回复
?

70,034

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧