笔试linux及面试题cc题解_第1页
笔试linux及面试题cc题解_第2页
笔试linux及面试题cc题解_第3页
笔试linux及面试题cc题解_第4页
笔试linux及面试题cc题解_第5页
已阅读5页,还剩11页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

charstr1[]="abc";charstr2[]="abc";constcharstr3[]="abc";constcharstr4[]="abc";constchar*str5="abc";constchar*str6="abc";coutboolalphastr1==str2endl;coutboolalphastr3==str4endl;coutboolalphastr5==str6endl;C+AB,在哪几种情况下BA?[C++中等试题]classBpublicABAclassBoperatorABAclassAAconstB&Anon-explicitB(可以有其他带默认值A&operatorconstA&voidUpperCase(charstrstr{for(size_ti=0;i<sizeof(str)/sizeof(str[0]);++i)if('a'<=str[i]&&str[i]<='z')str[i]-=('a'-'A'}charstr[]=cout"strsizeof(str)/sizeof(str[0])endl;UpperCase(str);cout<<str<<voidchar2Hex(charc16{charch=c/0x10+'0';if(ch>'9')ch+=('A'-'9'-charcl=c%0x10+'0';if(cl>'9')cl+=('A'-'9'-1);cout<<ch<<cl<<'';}charstr[]"Ilovefor(size_ti=0;i<strlen(str);++i)char2Hex(str[i]);cout<<structTest{Test(int)Test()voidfun()voidmain(void{TestTest}cout<<(true?1:"1")<<endl;unsignedintconstsize1=2;charstr1[size1];unsignedinttemp=0;cin>>temp;unsignedintconstsize2=temp;charstr2[size2];structCLS{intCLS(inti):m_i(i){}}CLScout<<obj.m_i<<class{EmptyEmpty(constEmpty&~EmptyEmpty&operator=(constEmpty&Empty*operator&();//取址运算符constEmpty*operator&()constfloata=1.0f;cout<<(int)a<<endl;cout<<(int&)a<<coutboolalphaint)a(int&)aendl;floatb=0.0f;cout<<(int)b<<endl;cout<<(int&)b<<coutboolalpha(int)b(int&)bendl;vectorarray;array.push_back(1array.push_back(2array.push_back(3for(vector::size_typei=array.size()-1;i>=0;iarray{cout<<array[i]<<}typedefvectorIntArray;IntArrayarray;array.push_back(1);array.push_back(2array.push_back(2array.push_back(3arrayfor( toritor=array.begin();itor!=array.end();++itor{if(2==*itor)array.erase(itor}void*mymemcpy(void*dest,constvoid*src,size_tcount{char*pdest=static_cast<char*>(destconstchar*psrc=static_cast<constchar*>(srcif(pdest>psrc&&pdest<psrc+cout{for(size_ti=count-1;i!=-1;--i)pdest[i]=psrc[i];}{for(size_ti=0;i<count;++i)pdest[i]=psrc[i];}return}intmain(void{charstr[]=" mymemcpy(str+1,str+0,9);cout<<str<<endl;system("Pause");return0;}C++/CC++/CC++/CBOOLfloat,if(100,0.0FALSEintn较的if语句为:ifn0ifn0BOOLflagiffloatxifchar*pif二、以下为WindowsNT下的32位C++程序,请计算sizeof的值(10分)charstr[]=“ o”;char*p=str;intn=10;sizeof(str)=sizeof(p)=sizeof(n)=voidFunc(char{sizeof(str)}void*p=malloc(100sizeof(p)1ifndef/define/endif2、#include#includefilename.h”3、const(请至少说明两种4、在C++程序中调用被C编译器编译后的函数,为什么要加extern for(i=0;{if(condition)}if{for(i=0;i++;)}{for(i=0;i++;)}voidGetMemory(char*p){p=(char}void{char*str=NULL;GetMemory(str);strcpy(str," oworld");}charcharp[]=" oworld";returnp;}void{char*str=NULL;str=GetMemory();}VoidGetMemory2(char**p,int{*p=(char}void{char*str=NULL;GetMemory(&str,100);strcpy(str," o");}void{char*str=(char*)strcpy(str, (str);if(str!=NULL){strcpy(str,}}strcpychar*strcpy(char*strDest,constcharC++/C 到strDest,为什么还要char*类型的返回值Stringclass{String(constchar*strNULLString(constString&other);~String(void)String&operate(constString&other);char*m_data附录CC++/CBOOLfloat,if(10BOOLflagif(3if(flag)ifflagif(flag==TRUE)if(flag==1)if(flag==FALSE)if(flag==0)floatxif(4constfloatEPSINON=if((x>=-EPSINON)&&(x<=if(x==0.0)if(x!=char*pif(3if(p==NULL)if(p!=if(p==0)if(p!=if(p)if二、以下为WindowsNT下的32位C++程序,请计算sizeof的值(10分)charstr[]=“ o”;char*p=str;intn=10;sizeof(str6(2)sizeof(p)=4(2)sizeof(n)=4(2)voidFunc(charstr[100]){sizeofstr4(2}void*p=malloc(100sizeofp4(21、头文件中的ifndef/define/endif干什么用?(5分) 2、#include#includefilename.h”(5 C\C++面试Q1OSITCP/IPQ2IPTCPUDPQ3Q4C+CstructQ5Q6Q7Q8:8086:一般建议参加的研发面试的同学先要准备一下相关的知识,软件的主:是看看C两道c试题1、一个学生的信息是:,学号,,等信息,用一个链表,把这些学生信息连在一起,给出一个age,在些链表中删除学生等于age的学生信息。程序代码#include#includestructstu{charname[20]; intno;intstructstu*structstu*creatlist(int{intstructstuh=(structstu*)malloc(sizeof(structstu));h->next=NULL;{s=(structstu*)malloc(sizeof(structstu));p->next=s;printf("Pleaseinputtheinformationofthestudent:name noage\n");scanf("%s%c%d%d",s->name,&s-> s->next=p=}printf("Createsuccessful!");}voiddeleist(structstu*s,int{structstu*p;{p=s=s-printf("Therecordisnotexist.");{p->next=s->next;printf("Deletesuccessful!");}}voiddisy(structstu{s=s->next;{printf("%s%c%d%d\n",s->name,s-> s=s->next;}}int{structstu*s;intn,age;printf("Pleaseinputthelengthofseqlist:\n");s=creatlist(n);printf("Pleaseinputtheage:\n");return0;}程序代码#include#includevoiduppers(char*s,char{{*us=*s-32;*us=}*us=}int{char*s,*us;charprintf("Pleaseinputastring:\n");s=ss;printf("Theresultis:\n%s\n",us);}客户端如何.Net组件实现WebService?WindowsDNA软件外企C++面试题C\C++面试题Whatisachievedbyprefixingthe'static'keywordtoafile-levelfunctionorfile-levelvariabledeclaration?Describethedifferencebetweenthe“ISA”and“HASA”objectWhichisthestrongerrelationshipandJava&C#supportinterfacesdirectlywiththe“interface”keyword.C++doesnothavean“interface”keyword.HowdoyoucreateaninterfaceinWhere/whenistheuseofinterfacesespeciallyIfaprogramrequiresalargenumberofexecutioncontextswhatcanbedonetominimisethreadschedulingoverhead?Whatdoesitmeantosaythatafunctionisreentrant?Whataresomeofthewaysofachievingre-entrancy?c语言面试题2道()C++面试题更1、一个学生的信息是:,学号,,等信息,用一个链表,把这些学生信息连在一起,给出一个age,在些链表中删除学生等于age的学生信息。#include"stdio.h"#include"conio.h"structstu{charname[20]; intno;intstructstu*structstu*creatlist(int{intstructstuh=(structstu*)malloc(sizeof(structh->next=NULL;for(i=0;inext=printf("Pleaseinputtheinformationofthestudent:name noage\n");scanf("%s%c%d%d",s->name,&s-> s->next=NULL;p=s;}printf("Createsuccessful!");}voiddeleist(structstu*s,int{structstu*p;{p=s=s-printf("Therecordisnotexist.");{p->next=s->next;printf("Deletesuccessful!");}}voiddisy(structstu{s=s->next;{prin

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论