C 基礎 第五天

2021-10-09 15:29:38 字數 639 閱讀 5417

c++ 保留有效位數的方法.

cout.precision(2);       //總的有效數字

cout.flags(cout.fixed); // 小數點後面有效數字

cout.unsetf(cout.fixed); //復原

輸入資料時,前面輸入錯誤,導致後面無法輸入. 解決方法.(過程和原理)

#include #include #include using namespace std;

int main(void)

std::cout << "請輸入b: ";

std::cin >> b;

if (cin.fail())

std::cout << "請輸入c: ";

std::cin >> c;

if (cin.fail())

std::cout << "a=" << a << std::endl;

std::cout << "b=" << b << std::endl;

std::cout << "c=" << c << std::endl;

system("pause");

return 0;

}

Android基礎第五天

contents sms raw contacts,data,mimetypes 1 去raw contacts表中取出聯絡人的 id 2 去data表中根據上面的 id查詢對應id的資料 查詢聯絡人的uri contents contents 檢視可以被看成是虛擬表或儲存查詢。可通過檢視訪問的資料...

Python 基礎 第五天

python是高度物件導向的 獲取使用者的輸入內容可以用input 函式實現 也可以使用str string,字串 類的各種方法。可以用rjust方法來獲得乙個右對齊的指定寬度的字串。檔案 可以使用內建的open函式並指定檔名以及自己所希望使用的開啟模式開啟乙個檔案。開啟模式可以是閱讀模式 r 寫入...

Java 基礎第五天

示例 class student public string getname public void show 測試類 玩基本類的.建立物件,通過物件調成員 class demo 對已經做好封裝的類 person為例 由於person中的屬性都被 private 了,外界無法直 接訪問屬性,如果想設...