- #include<iostream>
- using namespace std;
- int main(){
- //整數 int 10,50,100..
- //浮點數(小數) float 3.14...
- //字元 char 'a','b','@'
- //字串 string "abcdefg","apple"
-
- //宣告變數(盒子)
- //變數型態 變數名字=賦予值
- int a=50;
-
- //cout輸出 <<串接符號(當方法、變數、字串要一起使用) endl換行
-
- cout<<"a原本是:"<<a<<endl;
- cout<<"請輸入數字:";
- //cin輸入 >>(指向我要輸入的盒子)
- cin>>a;
- cout<<"a輸入後是:"<<a<<endl;
- system("pause");
- return 0;
- }
複製代碼 |