⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lt61601.c

📁 软件编程入门丛书《C语言程序设计》源代码。
💻 C
字号:
#define N 30
# include"stdlib.h"
# include "stdio.h"
 struct stud_type
 { char name[9];
   long num;
   int age;
   float score;
 };
 void main()
 { void disp(struct stud_type *p);
   struct stud_type student[N];
   int i;
   char numstr[9];
   for (i=0;i<N;i++)
    { printf ("\n请输入所有的数据student[%d]:\n",i);
     gets(student[i].name);
     gets(numstr);
student[i].num=atol(numstr);   /* atol功能是将numstr字符转换成长整型值 */
     gets(numstr);
student[i].age=atoi(numstr);   /* atoi功能是将numstr字符转换成整型值 */
     gets(numstr);
student[i].score=atof(numstr); /* atof功能是将numstr字符转换成实型值 */
}
printf("\n 姓名\t\t 学号   年龄   成绩 \n");
 for (i=0;i<N;i++)
   disp(&student[i]);    /* 调用disp函数 */
 }
void disp(struct stud_type *p)   /* 定义disp函数 */
 { printf("%-9s% 8ld% 3d % 6.2f\n",p->name,p->num,
   p->age,p->score);
  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -