- #include<iostream> //引入 <基本輸入輸出> 標頭檔 input & output stream
- #include<cstdlib> //引入 <標準函式庫> 標頭檔 c standard library
- using namespace std; //指定命名空間為 std
- int main() //主函式
- { string name="朱閎聿", school="明華國中"; //名字和學校是字串
- int age=12; // 12是整數
- float h=152.9f, w=53.5f; //身高和體重都有小數點
- cout<<"我的大名:"<<name<<endl;
- cout<<"就讀:"<<school<<endl;
- cout<<"今年:"<<age<<"歲"<<endl;
- cout<<"身高:"<<h<<"公分"<<endl;
- cout<<"體重:"<<w<<"公斤"<<endl;
- system("pause"); //讓畫面暫停
- return 0; //回傳0到主控台,告知該程式已成功執行
- }
複製代碼 |