C语言结构体实验分析报告.docVIP

  • 105
  • 0
  • 约2.53千字
  • 约 7页
  • 2018-03-15 发布于江苏
  • 举报
C语言结构体实验分析报告

《C语言程序设计》实验指导及报告书 实验七 结构体 一、实验目的 1. 通过实验了解结构体的基本概念。 2. 掌握结构体类型的定义、结构体变量的定义和使用。 3. 掌握结构体变量的初始化。 二、预习内容 1.在学生登记表中,姓名为字符型;学号为字符型;年龄为整型;性别为字符型;成绩为整型。”Miao”,”01”,20,’m’,90}; 不能再结构体内赋初值。 3.结构变量结构变量赋值#include stdio.h #include string.h struct student { long num; char name[8]; float score; }stu1,stu2; main() { int i,j; stu1.num=303111; strcpy(stu1.name,zhang); stu1.score=88.5; stu2=stu1; printf(%ld ,%s, %.2f,stu2.num,stu2.name,stu2.score); } 要求:输入程序,并调试运行,写出程序运行结果。 程序功能 输出学生2的信息 运行结果 303111,zhang,88.50 2. 找出以下程序的错误,并改正。 #includestdio.h main() { struct student{ int num; char name[10];

文档评论(0)

1亿VIP精品文档

相关文档