Chinaunix首页 | 论坛 | 博客
  • 博客访问: 436443
  • 博文数量: 111
  • 博客积分: 4290
  • 博客等级: 上校
  • 技术积分: 1301
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-24 14:22
个人简介

努力工作,建立一个幸福的家庭。

文章分类

全部博文(111)

文章存档

2015年(4)

2013年(9)

2012年(6)

2011年(17)

2010年(69)

2009年(6)

分类: C/C++

2010-04-14 13:09:00

#include
#define FORMAT "%d\n%s\n%f\n%f\n%f\n"
struct student
{
    int num;
    char *name;
    float score[3];
};
struct student stu;
void main()
{
    void print(struct student *);
    scanf("%d%s%f%f",&stu.num,stu.name,&stu.score[0],&stu.score[1]);
    scanf("%f",&stu.score[2]);
    print(&stu);
    getch();
}
void print(struct student *p)
{
    printf(FORMAT,p->num,p->name,p->score[0],p->score[1],p->score[2]);
    printf("\n");
}

12345 lili 89 89 90
12345

89.000
89.000
90.000
 
#include
#define FORMAT "%d\n%s\n%f\n%f\n%f\n"
struct student
{
    int num;
    char name[20];
    float score[3];
};
struct student stu;
void main()
{
    void print(struct student *);
    scanf("%d%s%f%f",&stu.num,stu.name,&stu.score[0],&stu.score[1]);
    scanf("%f",&stu.score[2]);
    print(&stu);
    getch();
}
void print(struct student *p)
{
    printf(FORMAT,p->num,p->name,p->score[0],p->score[1],p->score[2]);
    printf("\n");
}
12345 lili 89 89 90
12345
lili
89.000
89.000
90.000
 
原因:
阅读(455) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~