1,排序問題。
窮舉法。
2,海**式計算三角形面積。#include
#include
using
namespace std;
intmain()
if(a > b && aif(a > c && c > b)
if(c >b && b > a)
if(b > a && a > c)
if(b > c && c > a)
return0;
}
3.列印水仙花數。#include
#include
using
namespace std;
intmain()
4.求和。#include
using
namespace std;
intmain()
}}}}
等比數列公式計算。
5.輸出特定矩陣。#include
using
namespace std;
intmain()
return0;
}
6.求正數個數及其平均數。#include
using
namespace std;
intmain()
cout << endl;
}return0;
}
7.計算半徑在1~10的圓的面積且其面積小於100。#include
using
namespace std;
intmain()
}if(c ==0)
else cout <<
"正數的個數為"
<< c <<
"正數平均數為"
<< s / c;
return0;
}
8.判斷是否為素數。#include
using
namespace std;
intmain()
}return0;
}
9.輸出100~200的素數。#include
#include
using
namespace std;
intmain()
}if(c)else cout <<
"非素數"
;return0;
}
10.輸出星型圖案。#include
#include
using
namespace std;
intmain()
}if(c)else}}
return
0;
#include
using
namespace std;
intmain()
for(c =
1; c <=
2* b -
1; c++
) cout << endl;
//輸出上半部分。
}for
(b = a -
1; b >=
1; b--
)for
(c =
2* b -
1; c >=
1; c--
) cout << endl;
//輸出下半部分。
}return0;
}
c 上機作業
1 時鐘類 include using namespace std class time int add a minute int add an hour int add seconds int n int add minutes int n int add hours int n void tia...
C 上機5作業
專案2 檔名稱 1212121.cpp 作 者 伍蒙 完成日期 2017年 5月 5日 版 本 號 v1.0 對任務及求解方法的描述部分 使用陣列求解問題 輸入描述 輸入10個數放在陣列a中 問題描述 程式設計序輸出不重複的數字 程式輸出 將該陣列中不重複的數放到陣列b中輸出 問題分析 略 演算法設...
3 7日C 上機作業
題目1 修改教材的clock類,增加物件的行為 內容 1 走時 2 以12時制的形式顯示時鐘的當前值 3 編寫測試類的程式 建立兩個時鐘物件,分別呼叫物件的行為.設計思路 根據系統自帶的clock t的函式,再設定空迴圈,我們能夠使系統延遲1秒輸出,同時在時鐘的類當中增加設定時鐘和顯示時鐘的函式 i...