國立屏東大學 資訊工程學系
turnin code cpp.2A.hw1-1 (週五上午甲班) cpp.2B.hw1-1(週五下午乙班)
#include <iostream> using namespace std; #include "swap.h" 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]
turnin code cpp.2A.hw1-2 (週五上午甲班) cpp.2B.hw1-2(週五下午乙班)
#include <iostream> using namespace std; #include "maxScore.h" 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]