- 1
- 0
- 约2.98千字
- 约 8页
- 2017-12-11 发布于江苏
- 举报
11.1错误包括
11.1 错误包括:
1.??? 类定义体的结束要加分号:
class Point {
...
};
2.??? main函数中,不能直接访问类Point对象的保护成员x和y。所以下面两句不对。
p.x += 5;
p.y += 6;
3.??? 倒数第二行的endl前面应没有双引号(可能是印刷错误)。
11.2 可以将程序分为下面三个文件 :
//文件cat.h
class Cat {
......
};
//文件cat.cpp
#include iostream.h
#include cat.h
int Cat::GetAge()
{
return itsAge;
}
int Cat::SetAge(int age)
{
itsAge = age;
}
void Cat::Meow()
{
cout Meow. \n;
}
//文件main.cpp
#include iostream.h
#include cat.h
void main()
{
......
}
程序的运行结果为:
Meow.
Frisky is a cat who is 5 years old.
Meow.
11.3 #include iostream.h
int dayOfMonth[12] = {31,2
您可能关注的文档
- (理综答案)汕尾市2013届高三学生第二次模拟测试.doc
- ,蜈支洲一整天,2天跟团,充足FREE.PDF
- -以NIKE篮球鞋为例.PDF
- 02 刑事法案.pdf
- 03-视频切换效果.pptx
- 03138459-汽车天窗系统.pdf
- 0511014汕头市东方中学.pdf
- 056于勒.ppt
- 1.1项目和工程项目1.2工程项目管理1.3施工组织设计概述1.4.ppt
- 1.3 过把瘾—让你的名字闪动起来.doc
- 2026花城版音乐二年级下册第8单元《小白船》课堂教学设计.pdf
- 2026花城版音乐二年级下册第8单元《小小的船》课堂教学设计.pdf
- Revision A great weekend plan 复习课(教学评一体化教学设计)2026人教PEP版英语四年级下册.pdf
- Unit 1 Animal friends 第1课时 Get ready & Start up教学评教学设计英语外研版三起三年级下册2026.pdf
- Unit 1 Animal friends 第1课时 Get ready&Start up(分层作业)英语外研版三起三年级下册2026.pdf
- Unit 1 Animal friends 第2课时 Speed up教学评教学设计英语外研版三起三年级下册2026.pdf
- Unit 1 Animal friends 第3课时 Fuel up(分层作业)英语外研版三起三年级下册2026.pdf
- Unit 1 Animal friends 第4课时 Hit it big(分层作业)英语外研版三起三年级下册2026.pdf
- Unit 1 Animal friends 第3课时 Fuel up教学评教学设计英语外研版三起三年级下册2026.pdf
- Unit 1 Animal friends 第5课时 Wrap up&Let's explore(分层作业)英语外研版三起三年级下册2026.pdf
原创力文档

文档评论(0)