分10大題,每題十分
一、名詞解釋
(1)scope
(2)function template
(3)nested loop
(4)static
(5)pass by value
二、
看一段程式碼然後寫出debug之後cout出來的東西
有陣列跟for迴圈
輸出大概有10行左右
三、
int x;
for(x=1;x<=10;x++)
{
if(x==7)
break;
if(x==3)
continue;
cout<<x<<" ";
}
cout<<endl<<"The final value of x is: "<<x<<endl;
四、
char string1[]="Hello World!";
cout<<"string1 is: "<<string1<<endl;
for(int i=0;string1[i]!='0';i++)
cout<<string1[i]<<"$";
五、
寫出讓使用者輸入N,然後輸出2~N之間的質數的程式
六、
寫出利用for迴圈輸出下列形式的程式碼
0
0 1
0 1 2
0 1 2 3
0 1 2 3 4
0 1 2 3 4 5
七、
算圓周率,跟作業一樣
八、
寫出程式碼,讓使用者輸入不含0的五位數,然後輸出reverse的樣子
EX:
cin>>76431
cout<<13467
九、
寫出找最大公因數(GCD)的函式
十、
寫出用陣列找出1~999之間質數並輸出的程式碼
顆顆好累
考卷是全英
沒看到的就吃土吧
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.7.214
※ 編輯: fanif 來自: 140.112.7.214 (11/23 17:29)