全國計算機二級考試C++語言程序設(shè)計上機考試試題及答案
一、程序改錯題
使用VC++6.0打開考生文件夾下的源程序文件1.cpp,該程序運行時有錯誤,請改正程序中的錯誤,使得程序輸出:
9,8,7,6,5
注意:錯誤的語句在/********error********/的下面,修改該語句即可。其他的語句不能修改。
試題程序:
#include(iostream.h>
classTC
{
/********error********/
TC(inti)
{
m_i=i;
}
voidprint()
{
cout<<--m_i<<’,’;
}
public:
intm_i;
};
intmain()
{
/********error********/
inti();
TC04(10);
while(i>5)
{
/********errOr********/
i++:
04.print();
}
cout< return0;
}
![]() | ![]() .. 定價:¥133 優(yōu)惠價:¥133.0 更多書籍 |
![]() | ![]() .. 定價:¥124 優(yōu)惠價:¥124.0 更多書籍 |