




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
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
提交評論