程式設計基礎
基礎知識
- 什么是程式?
為進行某項活動的步驟,計算機的程式,為得到某種結果,通過計算機語言表達的指令序列, - 什么是程式設計?
計算思維,是運用計算機科學的基礎概念進行問題求解,系統設計,以及人類行為理解等涵蓋計算機科學之廣度的一系列思維活動,
計算思維的特點:
1.滿足計算機程式執行的規則約束,
2.發揮計算機的特長, - 計算機發展歷
圖靈機-馮諾伊曼計算機-電子計算機ENIAC - 問題描述到程式的基本結構
#include <iostream>
using namespace std;
int main()
{
cout << 7.9 * 0.8 + 9.5 * 1.5 + 8.7 * 0.6 << endl;
return 0;
}
數學運算
'+ - * / % '
#include <iostream>
using namespace std;
int main()
{
cout << 5 + 2 << endl;
cout << 5 - 2 << endl;
cout << 5 * 2 << endl;
cout << 5 / 2 << endl;
cout << 5 % 2 << endl;
cout << (1 + 2) * 3 << endl;
return 0;
}
- 數學函式
- sin, asin, cos, acos, tan, atan, log, log10
- abs, fabs, sqrt, floor, exp, sinh, pow
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
cout << sin(3.14159 / 6) << endl;
cout << tan(-3.14159 * 4 / 3) << endl;
cout << sqrt(10 * 10 - 4 * 2 * 3) << endl;
return 0;
}





C++ 每一條陳述句都需要;結束
- 格式與風格


總結
打開編輯器 -> 輸出基本框架 -> 編譯 -> 執行
如何學好程式設計?
- 重思路,把思路學會,按照老師的思維去思考問題,
- 勤動手,學習程式設計實踐性的課程,理論講的太多,但是不動手,
- 敢于提問,遇到很多困難和錯誤,失敗了不用害怕,
- 學會閱讀,嘗試閱讀開源的代碼
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/542696.html
標籤:其他
上一篇:Gin框架實戰——HTML渲染
下一篇:java執行緒基礎
