學習C 第柒天

2021-10-09 15:21:22 字數 1417 閱讀 6128

今天是第七天,由於比較忙,只能匆匆作下總結。

1.1e-15表示1×10^(-15)。

2.1/5預設結果為零,因為1/5預設型別為整形。

3.unsigned n=3;預設n的型別為unsigned int。

4.全域性變數可與區域性變數重名,在區域性變數作用域內,全域性變數失效。

今日**,今天主要看**例題,所以**比較多。

進製轉換:

#include

using namespace std;

double power(double x, int n);

/int main()

cout << 「deciaml value is」 << value << endl;

return 0;

}/int main()

cout << 「deciaml value is」 << value << endl;

return 0;

}double power(double x, int n)

用無窮級數求pi的值

#include

using namespace std;

double arctan(double x)

return r;

}int main()

求回文數

#include

using namespace std;

bool symm(unsigned n)

return m == n;

}int main()

}return 0;

}分段函式求值,主要求sin

#include

#include

using namespace std;

const double tiny_value = 1e-10;

double tsin(double x)

while (fabs(t) >= tiny_value);//fabs:求浮點數的絕對值,abs:求整數的絕對值。

return g;

}int main()

擲骰子遊戲,主要是隨機數的產生,這裡是偽隨機數

#include

#include

using namespace std;

enum gamestastus;

int main()

while (status == playing)

if (status == win)

cout << 「player wins」 << endl;

else

cout << 「player lose」 << endl;

return 0;

}int rolldice()

今天就這些,曾老師要求看的課程太多了,課上布置的題目也不簡單,今天花了好久,明天就要上課了。

JNI學習之C語言第5天

define crt secure no warnings include include include 聯合體 共用體 不同型別的變數共占用一段記憶體 相互覆蓋 聯合變數任何時刻只有乙個成員存在 目的節省記憶體 大小 聯合體變數的大小 最大的成員所佔的位元組數 union myvalue voi...

UI學習第02天

第02天主要是針對uiimageview和幀動畫的學習,大概筆記如下 1 transform的作用 可以用來設定圖形的平移 縮放 旋轉 cgaffinetransformtranslate 在當前位置平移 cgaffinetransformmaketranslation 在原點座標進行平移 gaff...

UI學習第03天

以下是第03天一些學習體會和筆記 1 instancetype 可以自動檢查返回值的型別,非常好用。按鈕的本質 view view的本質uiimageview label 2 oc複習 slef 在物件方法中,代表自己,即當前類的物件。在類方法中,代表當前類。構造方法以 init開頭 類方法建議以類...