改错题
第1题
#include ﹤iostream.h﹥
using namespace std;
void setzero(int &a)
{
a=0;
}
int main( )
{
int x1=10; setzero(&x1);
cout ﹤﹤x1﹤﹤ endl;
return 0;
}
第2题
改正后程序输出结果为2 5 8 11 14
#include ﹤iostream. h﹥
using namespace std;
void main( )
{
int i=1;
while(i﹤=15)
{
i++; if(i%3==2) continue;
else cout ﹤﹤1﹤﹤" ";
}
}
第3题
#include ﹤iostream. h﹥
using namespace std;
class Point
{
public: void init( ) {
}
static void output( ) {
}
};
void main( )
{
Point P;
Point:: init( );
P. output( );
}
第4题
#include ﹤iostream. h﹥
using namespace std;
class A
{
int x, y; public: void set(int a, int b)
{
x=a; y=b;
}
int getx( )
{
return x;
}
int gety( )
{
return y;
}
int sum( )
{
return x+y;
}
}; int main( )
{
A a; a. set(3, 4);
cout﹤﹤a.x﹤﹤a.y﹤﹤ a.sum( )﹤﹤ endl;
return 0;
}
第5题
申请一个长度为10的int型空间,之后释放该空间。
#include ﹤iostream. h﹥
using namespace std;
int main( )
{
int *p=new int[ 10];
delete p;
return 0;
}
扫码下载上学吧找答案APP作业考试网课答案应有尽有
上学吧找答案微信小程序 免下载,即可体验强大搜题神器
温馨提示:因考试政策、内容不断变化与调整,上学吧提供的以上信息仅供参考,如有异议,请考生以权威部门公布的内容为准。