東芝筆試題目
筆試題目(一)
1. 將程序改成Unicode編程需要做哪些修改?
window 2k以后的系統(tǒng)底層都是基于Unicode的,就算你調(diào)用ANSI的API(以A結(jié)尾比如SetWidowsTextA),系統(tǒng)也會(huì)在你的進(jìn)程默認(rèn)堆上動(dòng)態(tài)分配一塊內(nèi)存,存放轉(zhuǎn)換后的Unicode字符串,然后把轉(zhuǎn)換后的字符串傳遞給API,如果調(diào)用了返回值為ANSI字符串的API,Windows會(huì)在后臺(tái)進(jìn)行相反的轉(zhuǎn)換。
其實(shí)VC中進(jìn)行Unicode編程也不麻煩,大概如下:
1.為工程添加UNICODE和_UNICODE預(yù)處理選項(xiàng),在VC.net中就是 項(xiàng)目 -> 屬性 -> c/c++ -> 預(yù)處理器 在"預(yù)處理定義"中加入這兩個(gè)宏定義(vc6中 project -> settings -> c/c++ -> general 中的 Preprocessor definitions).
2.Include
3.把所有的字符串常量用_T()宏包起來,比如 TCHAR* szText = _T("我的Text");
4.所有的C庫(kù)字符串操作函數(shù)也做相應(yīng)的替換,比如
strlen ->_tcslen
strcat ->_tcscat
strcmp ->_tcscmp
......
注意,這些函數(shù)中的"文本長(zhǎng)度"均為字符個(gè)數(shù),而非char個(gè)數(shù)具體參看MSDN.
5.API調(diào)用一般不用做特殊處理,當(dāng)定義了UNICODE和_UNICODE后,所有的API都會(huì)被宏指向W結(jié)尾的版本(不定義則指向A結(jié)尾的`版本).
其實(shí),上面所說的并非強(qiáng)制你使用UNICODE,如果你還想回去使用ANSI,沒有問題,把第一步定義的兩個(gè)宏拿掉就OK了,繼續(xù)我們的ANSI編程。
2. TCHAR同char的區(qū)別
TCHAR 就是當(dāng)你的字符設(shè)置為什么就是什么
例如:程序編譯為 ANSI, TCHAR 就是相當(dāng)于 CHAR
當(dāng)程序編譯為 UNICODE, TCHAR 就相當(dāng)于 WCHAR ,每個(gè)字符占兩個(gè)字節(jié)
3. BOOL同bool的區(qū)別
意義上沒什么區(qū)別,但卻是兩種類型.
bool應(yīng)該是C語(yǔ)言里定義的,返回值為true和false(事實(shí)上就上1和0)
而BOOL應(yīng)該是MFC及SDK里定義返回值的.
它的定義應(yīng)該是:typedef int BOOL;(WINDEF.H中定義)
也就是說它是int型的
返回值是大寫的TRUE 和FALSE
定義如下:
#define FALSE 0
#define TRUE 1
(AFX.H中如此定義)
一個(gè)是布爾型,一個(gè)是整型.
事實(shí)上整型如果取1和0就可以代替布爾型了.
--博才網(wǎng)博才網(wǎng)
筆試題目(二)
1. :A tape manufacturer reduces the price of his heavy duty tape from Rs.30/- to Rs.28/- a reel and the price of a regular tape from Rs.24/- to Rs.23/- a reel . A computing centre normally spends Rs.1440/- a month for tapes and 3/4 of this is for heavy duty tapes. How much will they save a month under the new prices?
Ans.Rs.87 132
2. shl測(cè)評(píng)題:In a team of 12 persons, 1/3 are women and 2/3 are men. To obtain a team with 20% women how many men should be hired?
Ans.8
3. :The dimensions of a certain machine are 48″ X 30″ X 52″. If the size of the machine is increased proportionately until the sum of its dimensions equals 156″, what will be the increase in the shortest side?/
Ans. 6″
4. shl測(cè)評(píng)題:In a certain company, 20% of the men and 40% of the women attended the annual company picnic. If 35% of all the employees are man, what percent of all the employees went to the picnic?
Ans.33% 21%
5. :It cost a college Rs.0.70 a copy to produce a Programme for the homecoming football game. If Rs.15,000/- was received for advertisements in the programme, how many copies at Rs.0.50 a copy must be sold to make a profit of Rs.8000/- ?
Ans. 35000
【東芝筆試題目】相關(guān)文章:
會(huì)計(jì)筆試題目07-03
EXCEL筆試題目06-12
美的筆試題目12-15
惠普筆試題目08-10
伊利筆試題目07-09
夏普筆試題目07-03
奧美筆試題目06-18
LG筆試最?嫉墓P試題目07-09
Intel筆試真題技術(shù)筆試題目06-27
營(yíng)銷崗位筆試題目10-01