第四章━━结构体、枚举类型.pptVIP

  • 1
  • 0
  • 约4.99千字
  • 约 31页
  • 2017-04-28 发布于四川
  • 举报
第四章━━结构体、枚举类型

C++程序设计;主要内容;结构体类型的定义;结构体类型的定义;结构体变量的定义;结构体变量的定义;结构体变量的使用;【例】 #includeiostream.h #includestring.h struct student { int id ; char name[ 10 ] ; char sex ; float score ; } ; void main ( ) { student s1 = { 408001 , “张小笑” , ‘m’ , 98 } ; cout “s1=” s1.id ‘\t’ s1.name ‘\t’ s1.sex ‘\t’ s1.score endl; student s2 , s3 ; cout “请输入学号 、姓名 、性别( m / f ) 、成绩 :\n” ; cin s2.id s2.name s2.sex s2.score ; cout “s2=” s2.id ‘\t’ s2.name ‘\t’ s2.sex ‘\t’ s2.score endl; s3 = s2 ;

文档评论(0)

1亿VIP精品文档

相关文档