设为首页 加入收藏

TOP

2019年3月计算机二级C++操作练习题及答案014
2019-01-28 18:06:37 】 浏览:169
Tags:2019年 3月 计算机 二级 操作 习题 答案 014

一、程序改错题


使用VC++6.0打开考生文件夹下的源程序文件1.cpp,该程序运行时有错误,请改正错误,使得程序输出:


Hello


test


注意:不要改动main函数,不能增加或删除行,也不能更改程序的结构,错误的语句在


//******error******的下面。


试题程序:


#include


//********error********


template


voidfun(Tt)


{


std::cout<<"test"<<STD::ENDL;< p>


}


//********error********


template


voidfun(boolt)


{


std::cout<<(t?"Hell0":"Hi")<<STD::ENDL;< p>


}


intmain()


{


//********error********


boolflag=TRUE;


fun(flag);


fun((int)flag);


return0;


}


答案:(1)应改为“template ”。


(2)删除“template(bool)”。


(3)应改为“boolflag=true;”。


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇2019年3月计算机二级C++操作练习.. 下一篇2019年3月计算机二级C++操作练习..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目