1 / 10
文档名称:

C C 语言程序设计笔试面试题12.doc

格式:doc   大小:65KB   页数:10页
下载后只包含 1 个 DOC 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

C C 语言程序设计笔试面试题12.doc

上传人:小雄 2021/10/7 文件大小:65 KB

下载得到文件列表

C C 语言程序设计笔试面试题12.doc

文档介绍

文档介绍:There are two int variables: a and b, don't use “if”,“? :”,“switch”or other judgement statements, find out the biggest one of the two numbers.
答案:((a + b ) + abs( a - b ) ) / 2
如何打印出当前源文件的文件名以及源文件的当前行号?
答案:
cout V V __Fl LE__ ;
cout< v __LI NE__ ;
__FILE__和__LINE__是系统预定义宏,这种宏并不是在某个文件中定义的,而是由编译 器定义的。
main主函数执行完毕后,是否可能会再执行一段代码,给出说明?
答案:可以,可以用_onexit注册一个函数,它会在main之后执行int fn1 (void), fn2(void), fn3(void), fn4
(void);
void main( void )
(
String str("zhanglin");
_onexit( fn1 );
_onexit( fn2 );
_onexit( fn3 );
_onexit( fn4 );
printf( "This is executed first.\n");
}
int fn1()
(
printf( "nextAn");
return 0;
}
int fn2()
(
printf( "executed ");
return 0;
}
int fn3()
(
printf( "is ");
return 0;
}
int fn4()
printf( "This ");
return 0;
}
The _onexit function is passed the address of a function (func) to be called when the program
terminates normally. Successive calls to _onexit create a register of functions that are executed
in LIFO (last-in-first-out) order. The functions passed to _onexit cannot take parameters.
如何判断一段程序是由C编译程序还是由C+ +编译程序编译的?
答案:
ifdef __cplusplus
cout< v "c+ +
else
cout< v "c";
endif
文件中有一组整数,要求排序后输出到另一个文件中
答案:
#i nclude< iostream>
#i nclude<fstream>
using namespace std;
void Order(vector< int> & data) //bubble sort
(
int count = ();
int tag = false ; //设置是否需要继续冒泡的标志位
for ( int i = 0 ; i < count ; i+ +)

最近更新

江苏省淮阴市事业单位招聘考试(职业能力倾向.. 150页

江苏省苏州市事业单位招聘考试(职业能力倾向.. 148页

江苏省镇江市事业单位招聘考试(职业能力倾向.. 146页

江西省上饶市事业单位招聘考试(职业能力倾向.. 147页

江西省吉安市事业单位招聘考试(职业能力倾向.. 148页

江西省宜春市事业单位招聘考试(职业能力倾向.. 147页

河南许昌市2024年市直事业单位公开招聘高校毕.. 60页

浙江农林大学2024事业单位招聘拟聘历年高频难.. 61页

浙江温州瓯海区交通运输局招聘2人历年高频难、.. 59页

浙江省台州市事业单位招聘考试(职业能力倾向.. 149页

浙江省湖州市事业单位招聘考试(职业能力倾向.. 149页

浙江省舟山市事业单位招聘考试(职业能力倾向.. 148页

浙江金华市金东区新闻传媒中心2024年招聘合同.. 60页

湖北大冶市2024事业单位招聘历年高频难、易点.. 60页

福建漳平永福镇城镇综合管理协管员2024年招聘.. 59页

福建省南平市事业单位招聘考试(职业能力倾向.. 147页

福建省宁德市事业单位招聘考试(职业能力倾向.. 148页

福建省漳州市事业单位招聘考试(职业能力倾向.. 147页

绵阳市涪城区2024年下半年公开招聘事业单位工.. 60页

贵州毕节2024畜牧水产局下属事业单位招聘12人.. 58页

贵州省毕节地区选调生考试(行政职业能力测验.. 149页

辽宁省大连市事业单位招聘考试(职业能力倾向.. 150页

辽宁省朝阳市事业单位招聘考试(职业能力倾向.. 147页

辽宁省营口市事业单位招聘考试(职业能力倾向.. 147页

辽宁省辽阳市事业单位招聘考试(职业能力倾向.. 146页

辽宁省锦州市事业单位招聘考试(职业能力倾向.. 148页

辽宁省鞍山市事业单位招聘考试(职业能力倾向.. 147页

重庆南岸区2024年第四季度招聘事业单位人员历.. 59页

重庆市达川地区选调生考试(行政职业能力测验.. 147页

重庆江津区2024年面向社会公开招聘专业技术人.. 60页