华南俳烁实业有限公司

自考

各地資訊
當前位置:考試網(wǎng) >> 自考 >> 自考真題 >> 工學類 >> C語言程序設(shè)計 >> 文章內(nèi)容

排行熱點

  • 歷年真題
  • 模擬試題
  • 自考自答

全國2009年10月自學考試C++程序設(shè)計試題_第4頁

來源:考試網(wǎng)  [2008年12月29日]  【
三、改錯題(本大題共5小題,每小題4分,共20分)
下面的每個程序都有一處錯誤,請用下橫線標出錯誤所在行并給出修改意見。
41.#include
using namespace std;
int main ( ){
int num; max=10; num =1
while (num < max) num + + ;
cout <<″Num = ″<< num;
return 0;
}
42.#include
using namespace std;
class A {
void show ( ) {
cout<<″Hello!″;
}
};
int main ( ) {
A a;a. show ( );
return 0;
}
43.#include
using namespace std;
int main ( ) {
const int num = 20;
int scores[num];
for (int i=1;i<=num;i + +){
scores[i]=i;
}
return 0;
}
44.#include
using namespace std;
class CMax {
private:
int xx; int yy;
public:
CMax(int x,int y)
{ xx = x;yy = y ; }
void setValue(int x,int y)
{ xx = x;yy = y;}
int max( ){
return xx > yy? xx:yy;
}
};
void main( ){
CMax m( );
m.setValue(20,30);
cout <<″Max=″<}
45.#include
using namespace std;
class A{
public:
char name[255];
private:
char * getName( )
{ return name; }
};
class B:public A{
public:
B(char * n){
strcpy ( name,n);
}
};
void main( ){
B b(″Hello!″);
cout <<″Name:″<}

 

責編:admin

相關(guān)文章

瑞昌市| 江川县| 镇江市| 曲阜市| 西峡县| 遂平县| 抚松县| 锦州市| 东乡| 水城县| 瓦房店市| 聂荣县| 微山县| 乌鲁木齐市| 丘北县| 娄烦县| 许昌市| 贞丰县| 天台县| 丹江口市| 大宁县| 潞城市| 青冈县| 安仁县| 衡山县| 枣阳市| 屏南县| 赣州市| 扎鲁特旗| 汽车| 沙田区| 若尔盖县| 全南县| 凌源市| 禄丰县| 云浮市| 涿州市| 太湖县| 咸丰县| 普定县| 都兰县|