返回列表 發帖

基本輸入與輸出

  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int x, y;    //宣告整數變數, 分別命名為x與y
  6.     cout<<"請輸入x的值: ";
  7.     cin>>x;
  8.     cout<<"請輸入y的值: ";
  9.     cin>>y;
  10.     cout<<"您剛輸入的x值為"<<x<<", y值為"<<y<<endl;
  11.     system("pause");
  12.     return 0;   
  13. }
複製代碼

  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int x, y;
  6.     cout<<"請輸入x的值: ";
  7.     cin>>x;
  8.     cout<<"請輸入y的值: ";
  9.     cout<<"您剛輸入的X值為: "<<x<<", y的值為: "<<y<<endl;  
  10.     system("pause");
  11.     return 0;
  12. }
複製代碼

TOP

附件: 您需要登錄才可以下載或查看附件。沒有帳號?註冊

TOP

  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int x, y;
  6.     cout<<"請輸入x的值: ";
  7.     cin>>x;
  8.     cout<<"請輸入y的值: ";
  9.     cout<<"您剛輸入的X值為"<<x<<",y的值為"<<y<<endl;  
  10.     system("pause");
  11.     return 0;
  12. }
複製代碼

TOP

  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.    float x,y;
  6.    cout<<"請輸入您的幸運號碼x:";
  7.    cin>>x;
  8.    cout<<"請輸入您的幸運號碼y:";
  9.    cin>>y ;
  10.    cout<<"幸運號碼x為:"<<x<<",幸運號碼y為:"<<y<<endl;   
  11.    cout<<"本日幸運號碼為:"<<((x*y)/3)*4<<endl;
  12.    system("pause");
  13.    
  14.    return 0;
  15. }
複製代碼

TOP

  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.    int x, y;
  6.    cout<<"請輸入x的值:";
  7.    cin>>x;   
  8.    cout<<"請輸入y的值:";
  9.    cin>>y;   
  10.    cout<<"你剛輸入的x值為"<<y<<",y值為"<<y<<endl;
  11.    system("pause");
  12.    return 0;      
  13. }  
複製代碼

TOP

  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     cout<<"我"<<endl<<"愛"<<endl<<"c"<<endl<<"+"<<endl<<"+" ;
  6.     system("pause");
  7.     return 0;
  8. }
複製代碼

TOP

  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int x;
  6.     int y;
  7.     cout<<"請輸入x的值: ";
  8.     cin>>x;
  9.     cout<<"請輸入y的值: ";
  10.     cin>>y;
  11.     cout<<"您剛剛輸入的x值為"<<x;
  12.     cout<<"y值為"<<y<<endl;
  13.     system("pause");
  14.     return 0;
  15. }
複製代碼

TOP

返回列表