QQ网名大全

在 list[ ][20] 中存放一个班级的学生姓名,从键盘输入一个名字,判断该名字是否在 list 中,C语言程序。

以这个班有6个学生为例。
//#include "stdafx.h"//vc++6.0加上这一行.
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
void main(void){
char list[][20]={"abc","bcd","cde","efg","fgh","ghi","hij"},x[20];
int i;
printf("Enter the name of a student...\n");
gets(x);
for(i=0;i<6;i++)
if(strcmp(list[i],x)==0){
printf("There is called \'%s\' student.\n",x);
break;
}
if(i>=6) printf("Not the student.\n");
}
佚名
2024-06-17 08:09:23
最佳回答
类似问题(10)