标题:c语言相关问题,我写个程序如下,可是系统说错误是:C:\Program Files\Micr ...
只看楼主
理你妹的叶秦
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2015-5-13
 问题点数:0 回复次数:2 
c语言相关问题,我写个程序如下,可是系统说错误是:C:\Program Files\Microsoft Visual Studio\MyProjects\11\
#include <iostream>
using namespace std;
struct Date
{int month;
int day;
int year;
};
struct Student
{int num;
char name [20];
char sex;
Date birthday;
float score;
}student 1,student 2={10002,"wang li",'f',5,23,1992,89.5};
int main( )
{student1=student2;
cout<<student1.num<<endl;
cout<<student1.name<<endl;
cout<<student1.sex<<endl;
cout<<student1.birthday.month<<'/'<<student.birthday.day<<'/'<<student1.birthdayyear<<endl;
cout<<student1.score<<endl;
return 0;
}

搜索更多相关主题的帖子: Microsoft include c语言 
2015-05-13 15:56
wp231957
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:神界
等 级:版主
威 望:422
帖 子:13681
专家分:53296
注 册:2012-10-18
得分:0 
看不懂你这东东  一会student 1 一会student1  搞不懂你要干嘛

DO IT YOURSELF !
2015-05-13 16:18
hoy0a1d
Rank: 2
等 级:论坛游民
帖 子:19
专家分:83
注 册:2010-8-1
得分:0 
太乱了  帮你整了下  顺便改了下错误
程序代码:
#include <iostream>
using namespace std;

struct Date
{
    int month;
    int day;
    int year;
};

struct Student
{
    int num;
    char name [20];
    char sex;
    Date birthday;
    float score;
}student1, student2 = {10002, "wang li", 'f', 5, 23, 1992, 89.5};

int main()
{
    student1 = student2;
    cout << student1.num << endl;
    cout << student1.name << endl;
    cout << student1.sex << endl;
    cout << student1.birthday.month << '/' << student1.birthday.day << '/' << student1.birthday.year << endl;
    cout << student1.score << endl;
    return 0;
}


 

Test.
2015-05-13 17:48



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-445248-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.064978 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved