吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 2551|回复: 3
收起左侧

[C&C++ 转载] 初学的程序哪里出错了,请指教

  [复制链接]
问苍天 发表于 2014-6-28 14:41
#include <iostream>
using namespace std;
class Student
{private:
int num;
int score;
public:
        void setdata()
        {cin>>num;
        cin>>score;
        }
void display()
{cout<<"num="<<num<<endl;
cout<<"score="<<score<<endl;
};
};
Student stud1;stud2;
int main()
{stud1.setdata();
     stud2.setdata();
     stud1.display();
stud2.display();
return 0;
}

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

bettering 发表于 2014-6-28 14:57
本帖最后由 bettering 于 2014-6-28 14:59 编辑

missing storage-class or type specifiers 没有类型 ,   Student stud1;stud2;    stud1和stud2之间应该是逗号吧
 楼主| 问苍天 发表于 2014-6-28 14:42

C:\Program Files\Microsoft Visual Studio\MyProjects\lei2\1.cpp(17) : error C2501: 'stud2' : missing storage-class or type specifiers
 楼主| 问苍天 发表于 2014-6-28 15:00
bettering 发表于 2014-6-28 14:57
missing storage-class or type specifiers 没有类型 ,   Student stud1;stud2;    stud1和stud2之间应该 ...

非常感谢
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则 警告:本版块禁止灌水或回复与主题无关内容,违者重罚!

快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-6-14 04:26

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表