阿拉斯加在哪里:看一个C++程序,哪有错呀?

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/29 03:58:46
// Ex_Class1.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include <iostream.h>

CStudent::CStudent(char*name,char*id,bool isman)
:student(name,id,isman)
{
dbScore[0]=0;
dbScore[1]=0;
dbScore[2]=0;
}
void CStudent::InputScore(double score1,double score2,double score3)
{
dbScote[0]=score1;
dbScote[1]=score2;
dbScote[2]=score3;
}
void CStudent::Print()
{
student.Output();
for(int i=0;i<3;i++)
cout<<"成绩"<<i+1<<":"<<dbScore[i]<<endl;
}
CTeacher::CTeacher(char*name,char*id,bool isman,int years)
{
nTeachYears=years;
Input(name,id,isman);
}
void CTeacher::Print()
{
Output();
cout<<"教龄:"<<nTeachYears<<endl;
}
void main()
CStuden stu("LiMing","21010211");
cout<<stu.getName()<<endl;
cout<<stu.student.getName()<<endl;
stu.Print();
stu.student.setName("LingLing");
stu.student.setSex(0);
stu.InputScore(80,90,85);
stu.Print();
CTeacher tea("Ding","911085");
tea.Print();
tea.setID("9110234");
tea.Print();
}

#include "stdafx.h"
因为不知道这个是什么头文件,编译器不能读出来!你再看哈你的这个东西是什么!就可以解决这个问题了!

你把#include "stdafx.h"头文件没有写进去,导致编译器找不到,报错!

你摘的是什么地方的代码 似乎是MFC中的 有似乎是控制台的