返回列表 發帖

基本輸入輸出

輸入 cin >>
輸出 cout <<
  1. cout<<"請輸入一整數: ";
  2. cin>>a;
  3. cout<<"你剛輸入的數是: "<<a<<endl;
複製代碼
附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;

  4. int main()
  5. {
  6.     int a;
  7.     cout<<"請輸入一整數";
  8.     cin>>a;
  9.     cout<<"你剛輸入的數是:"<<a<<endl;

  10.    
  11.     system("pause");
  12.     return 0;
  13. }
複製代碼

TOP

#include<iostream>
#include<cstdlib>
using namespace std;
int main ()
{
    cout<<"請輸入一整數: ";
    cin>>a;
    cout<<"你剛輸入的數是:"<<a<<endl;
    system("pause");   
    return 0;
         }

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. {
  5.      int a;
  6.      cout<<"輸出一個整數:";
  7.      cin>>a;
  8.      cout<<"你剛輸入的數是: "<<a<<endl;
  9.      return 0;
  10. }     
  11.       
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;

  4. int main()
  5. {
  6.     int a;   
  7.     cout<<"請輸入一個數字:"<<endl;
  8.     cin>>a;
  9.     cout<<"你剛剛輸入的數字是:"<<a<<endl;
  10.     system("pause");
  11.     return 0;
  12. }
複製代碼

TOP

返回列表