关于C语言程序设计的问题

[复制链接]
查看11 | 回复2 | 2009-6-5 17:49:31 | 显示全部楼层 |阅读模式
#include
#include
struct student
{
int number;
char name[20];
}stu[2]={{1,"wang"},{2,"zhang"}};
void main()
{
int n,i;
printf("please enter the number:");
scanf("%d\n",&n);
for(i=0;i#includestruct student{ int number; char name[20];}stu[2]={{1,"wang"},{2,"zhang"}};void main(){ int n; printf("please enter the number:"); scanf("%d",&n); switch (n) { case 1: printf("the student number is:%d,his name is:%s\n...
回复

使用道具 举报

千问 | 2009-6-5 17:49:31 | 显示全部楼层
if(strcmp(n,stu.number)==0)改为if(n==stu.number)即可这个结构体成员并非字符串不要用strcmp字符串比较函数...
回复

使用道具 举报

千问 | 2009-6-5 17:49:31 | 显示全部楼层
C语言是一项非常重要的技能,计算机二级必考课程,C 语言内容包括:1、算法的基本概念。2、数据结构及其操作。3、基本排序和查找算法。4、逐步求精的结构化程序设计。5、软件工程的基本方法。6、数据库的基本知识。...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行