第16周專案5

2021-06-19 17:07:49 字數 615 閱讀 6164

/*

* 程式的版權和版本宣告部分

* 作 者: 沈遠巨集

* 完成日期: 2013 年 12 月 12 日

* 版本號: v1.0

* 輸出描述:從小到大輸出x的奇因子。

* 問題描述:編寫函式 int fun(int x, int *pp)。其功能是,求出 x 的所有奇數因子,並按照從小到大的順序放在 pp 指向的記憶體中,函式返回值為這些整數的個數。若 x 的值為30,陣列中的數為 1,3,5,15,函式返回 4。

*/#includeusing namespace std;

int fun(int,int *p);

int main()

{ int a[50],x,n;

cout<

cin>>x;

n=fun(x,a);

cout<

執行結果:

心得體會:

做完了一直沒時間上傳,今天上網咖來了就傳,搞得我玩遊戲都在想這個遊戲是怎麼編出來的。。

第5周專案1 5

all rights reserced.檔名稱 main.cpp 作者 李鑫 完成日期 2016.4.6 問題描述 使用複製建構函式,能用乙個已有的三角形物件,複製出新的三角形物件 include includeusing namespace std class double x,double y,...

第5周專案1 4

all rights reserced.檔名稱 main.cpp 作者 李鑫 完成日期 2016.4.6 問題描述 使用有預設引數的建構函式,不給定實參時,預設邊長為1 注意 只需要乙個建構函式即可。include includeusing namespace std class double x,...

第5周專案1 (2)

main.cpp 作者 李鑫 完成日期 2016.3.31 問題描述 在上面程式的基礎上,重新定義 類,其中邏輯特別簡單的set和get成員函式,要處理為內聯成員函式,直接在類內定義。include includeusing namespace std class void setb double ...