#include<iostream>有什么错

[复制链接]
查看11 | 回复3 | 2013-4-11 08:57:14 | 显示全部楼层 |阅读模式
structStudent[3]={{001,"Li","M"},{002,"Zhang","F"},{021,"Fan","M"}};你的数组名是啥???struct Student 应该只是个类型把!!你赋值的时候性别应该是个char,只能用单引号,不是双引号!!...
回复

使用道具 举报

千问 | 2013-4-11 08:57:14 | 显示全部楼层
#includeusing namespace std;struct Student{int num;char name[20];char sex;int age;};int main(){
struct Student stu[3]={{001,"Li",...
回复

使用道具 举报

千问 | 2013-4-11 08:57:14 | 显示全部楼层
cout<<"%6d",stu.num<<endl;不能这样输出,你可移搜一下cout如何设置输出格式。如果加括号("%6d",stu.num)这样就会被作为逗号运算符。。。也不可以...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行