几道 C 语言面试题
1.
int main()
{
int i, n = 20;
for (i = 0; i < n; i--)
printf("*");
return 0;
}
Change/add only one character and print '*' exactly 20 times.
(there are atleast 3 solutions to this problem :-)
2. display below like:
1
212
32123
4321234
543212345
3. search for maximum and minimum value, before save into arrange for any 5 natural number (use multiful for grammer)
ex)
save to any 5 natural number
30 20 75 15 64 <enter>
minimum : 15
maximum : 75
4. use ms-sql of join grammer. show query fot result
Table.1
ac_country
--------------------------------------
country_cd country_nm
--------------------------------------
kor koera
jpn japan
usa usa
cha china
Table.2
ac_currency1
-------------------------------------------
country_cd currency_cd currency_nm
-------------------------------------------
kor won W
jpn yen Y
usa usd US
# Result
-------------------------------------------
country_nm currency_cd currency_nm
-------------------------------------------
korea won W
japan yen Y
usa usd US
Result Query :
5.use ms-sql of join grammer. show query fot result
table.1
account
--------------------------------------
userid cost date
--------------------------------------
use01 10,000 2007-01-02
use02 5,000 2007-01-03
use05 7,000 2007-01-03
use03 5,000 2007-01-03
use01 5,000 2007-01-04
use04 5,000 2007-01-05
use02 10,000 2007-01-05
use01 1,000 2007-01-05
table.2
userinfo
-----------------------------------------------
code userid money register
-----------------------------------------------
AAA use01 8,500 2007-01-02
AAA use02 5,000 2007-01-03
AAA use03 2,000 2007-01-04
AAA use04 4,500 2007-01-05
BBB use05 5,500 2007-01-02
table.3
stateinfo
-------------------------------------
connect state indate
-------------------------------------
AAA-use01 Yes 2007-01-03
AAA-use02 No 2007-01-05
AAA-use03 No 2007-01-04
AAA-use04 Yes 2007-01-05
BBB-use05 NO 2007-01-04
#result
----------------------------------------------------------
userid money account_count account_total state
----------------------------------------------------------
use01 8,500 3 16,000 Yes
use02 5,000 2 15,000 No
use03 2,000 1 5,000 No
use04 4,500 1 5,000 Yes
Result Query :
6. show 2 query each fot result.A, result.B
table.data_table
-----------------------
F_DATE
-----------------------
2007-04-17 11:42:55.200
2007-04-18 01:45:33.403
2007-04-18 01:47:01.500
2007-04-17 11:40:15.000
2007-04-18 11:41:25.700
2007-04-18 11:41:49.420
2007-04-17 11:44:58.000
2007-04-18 11:45:23.340
#Result.A
----------
F_DATE
----------
2007-04-17
2007-04-18
Result Query :
#Result.B
----------
F_DATE
----------
2
Result Query :
参考:
http://community.csdn.net/Expert/topicview1.asp?id=5538039
http://blog.csdn.net/zpwmail/archive/2007/05/21/1619154.aspx