國立屏東大學 資訊工程學系
turnin code cpp.hw2
int main() { int x=3, y=5; swap(x,y); cout << "x=" << x << endl; cout << "y=" << y << endl; return 0; }
執行結果參考:
[9:19 user@ws hw2] ./a.out x=5 y=3 [9:19 user@ws hw2]
int main() { int score[10]={60, 38, 98, 2, 66, 80, 23, 77, 10, 0}; if(max(score, 10)<100) max(score, 10)=100; cout << "max score = " << max(score, 10) << endl; return 0; }
[9:19 user@ws hw2] ./a.out max score = 100 [9:19 user@ws hw2]