| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 516 人关注过本帖
标题:为什么显示时对不齐的啊
只看楼主 加入收藏
lty871127
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2007-6-16
收藏
 问题点数:0 回复次数:4 
为什么显示时对不齐的啊

#include <stdio.h>
struct student
{

char number[11];
char name [25];
char sex;
int age;
float score[3];
float sum;
float aver;
char math;
char english;
char computer;

};
struct student stu[10]={
{"3106005748","LanTianRan",'M',20,90,90,90},
{"3000000001","huangLei",'M',21,59,59,90},
{"3000000002","huangMing",'F',17,89,70,90},
{"3000000003","JinLing",'F',20,20,84,30},
{"3000000004","LiMing",'F',20, 89,50,90},
{"3000000005","LiHua",'F',48, 20,40,50},
{"3000000006","LiMing",'F',20, 95,84,85},
{"3000000007","Lichao",'F',20, 60,60,70},
{"3000000008","Lijia",'F',20, 96,84,90},
{"3000000009","Lishan you",'F',19,89,84,90}
};


void main()
{ int n;
printf("\n\n\n\n");
printf("\t\t\t ****************************\n\n");
printf("\t\t\t Class: 06dianzishangwu06 Name: 3106005748\n\n");
printf("\t\t\t *** welcome to system *** \n\n");
printf("\t\t\t ****************************\n\n\n\n");
printf("\t\t\t 1 成绩显示 \n\n");
printf("\t\t\t 2 成绩排序 \n\n");
printf("\t\t\t 3 成绩查找 \n\n");
printf("\t\t\t 4 成绩统计 \n\n");
printf("\t\t\t 0 退出系统 \n\n");
do
{
scanf("%d",&n);
switch(n)
{
case 1:ksyx();


}
}while((n>3)&&(n<1)); }
ksyx()
{struct student *p;
printf("No. Name sex age math english computer\n ");
for(p=stu;p<stu+10;p++)
printf("%10s %-12s %2c %4d\n",p->number,p->name,p->sex,p->age,p->math,p->english,p->computer);
getch();}
这是小弟刚做的一个,不过就是进入时按1成绩显示时显示头一行与后面的不对齐的,
另一个问题就是后面的三科成绩输不出来,高手指点一下

搜索更多相关主题的帖子: computer english include number 
2007-06-21 14:57
herbert_1987
Rank: 5Rank: 5
等 级:贵宾
威 望:15
帖 子:1314
专家分:0
注 册:2007-5-13
收藏
得分:0 
加空格使它对齐就行啦.

人生重要的不是所站的位置,而是所朝的方向
2007-06-21 17:04
lty871127
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2007-6-16
收藏
得分:0 

不行啊,你试下

2007-06-21 18:57
herbert_1987
Rank: 5Rank: 5
等 级:贵宾
威 望:15
帖 子:1314
专家分:0
注 册:2007-5-13
收藏
得分:0 

这样行不:

#include <stdio.h>
struct student
{

char number[11];
char name [25];
char sex;
int age;
float score[3];
float sum;
float aver;
char math;
char english;
char computer;

};
struct student stu[10]={
{"3106005748","LanTianRan",'M',20,90,90,90},
{"3000000001","huangLei",'M',21,59,59,90},
{"3000000002","huangMing",'F',17,89,70,90},
{"3000000003","JinLing",'F',20,20,84,30},
{"3000000004","LiMing",'F',20, 89,50,90},
{"3000000005","LiHua",'F',48, 20,40,50},
{"3000000006","LiMing",'F',20, 95,84,85},
{"3000000007","Lichao",'F',20, 60,60,70},
{"3000000008","Lijia",'F',20, 96,84,90},
{"3000000009","Lishan you",'F',19,89,84,90}
};


void main()
{ int n;
printf("\n\n\n\n");
printf("\t *******************************************\n\n");
printf("\t\t Class: 06dianzishangwu06 Name: 3106005748\n\n");
printf("\t\t *** welcome to system *** \n\n");
printf("\t *******************************************\n\n\n\n");
printf("\t\t 1 成绩显示 \n\n");
printf("\t\t 2 成绩排序 \n\n");
printf("\t\t 3 成绩查找 \n\n");
printf("\t\t 4 成绩统计 \n\n");
printf("\t\t 0 退出系统 \n\n");
do
{
scanf("%d",&n);
switch(n)
{
case 1:ksyx();


}
}while((n>3)&&(n<1)); }
ksyx()
{struct student *p;
printf("No. Name sex age math english computer\n ");
for(p=stu;p<stu+10;p++)
printf("%10s %-12s %2c %4d\n",p->number,p->name,p->sex,p->age,p->math,p->english,p->computer);
getch();
}


人生重要的不是所站的位置,而是所朝的方向
2007-06-21 19:27
lty871127
Rank: 1
等 级:新手上路
帖 子:16
专家分:0
注 册:2007-6-16
收藏
得分:0 

不行啊,还是一样的~都是对不齐的,而且后面的成绩还输不出来了~~

2007-06-21 22:59
快速回复:为什么显示时对不齐的啊
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.026980 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved