返回列表 發帖

基本輸入輸出 (一)

  1. #include<iostream> // 引入標頭檔 Input & Output  用來做輸入和輸出使用
  2. #include<cstdlib> // 引入標頭檔函式庫
  3. using namespace std;//命名空間
  4. int main()
  5. {
  6.    
  7.     // 變數宣告
  8.     int  number = 0;
  9.     string  str = "";
  10.     float flo =0;
  11.    
  12.     cin >> number;
  13.     cin >> str;
  14.     cout << "你輸入的數字是:" << number << endl;
  15.     cout << "你輸入的文字是:" << str << endl;
  16.     system("pause"); //按任意鍵結束程式
  17.     return 0;
  18. }
複製代碼

#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{   
    int x=28,y=15;
    cout<<"當x的值為"<<x<<",y的值為"<<y<<"時...."<<endl;
   cout<<"x+y="<<x+y<<endl;  
   cout<<"x-y="<<x-y<<endl;  
   cout<<"x*y="<<x*y<<endl;  
   cout<<"x/y="<<x/y<<endl;  
   cout<<"x%y="<<x%y<<endl;  

system("pause");
return 0;
}

TOP

  1. #include<iostream>
  2. #include<cs
  3.    
  4.    
  5.     return 0;
  6.     int x=23;
  7.     int y=7;
  8.     cout<<"x=y"<<x+=y<<endl;
  9.     cout<<"x=y"<<x-=y<<endl;
  10.      
  11.     cout<<"x=y"<<x*=y<<endl;
  12.     cout<<"x=y"<<x/=y<<endl;
  13.     cout<<"x=y"<<x%=y<<endl;
  14.     syste("pause"
  15. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int a;
  7.     cout <<"請輸入一整 數"
  8.    
  9.     system("pause")
  10.     return 0;
  11. }
  12.    
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {   
  6.     int number =10;
  7.    
  8.     cout<<"number"<<endl;
  9.     cout<<"luke"<<endl;
  10.     cin>>a
  11.     cout<<number<<endl;

  12.     system("pause");
  13.    
  14.    
  15.     return 0;
  16. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int number=0;
  7.     cin>>number;
  8.     cout<<number<<"\r\n";
  9.    
  10.     system("pause");
  11.     return 0;
  12. }   
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     cout<<"hi87"<<endl;
  7.     int number = 10;
  8.     cout<<number<<endl;
  9.     cout<<number<<endl;
  10.     cin>>a
  11.     system("pause");
  12.     return 0;
  13. }
複製代碼
回復 1# 周政輝

TOP

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

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int number;
  7.     string str;
  8.     cout<<"請輸入一個數字"<<endl;
  9.     cout<<"請輸入一個文字";
  10.     cin>>number;
  11.     cin>>str;
  12.     cout<<"您輸入的數字是:"<<number<<endl;
  13.     cout<<"您輸入的文字是:"<<str<<endl;
  14.     system("pause");
  15.     return 0;
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.      int number=10;
  7.      string str = "hello";
  8.      cin>>number;
  9.      cin>>str;
  10.      cout<<"你輸入的數字是:"<<number<<endl;
  11.      cout<<"你輸入的文字是:"<<str<<endl;
  12.     system("pause");
  13.     return 0;
  14. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.      int a;   
  7.      cout<<"請輸入一個數字";
  8.      cin>>a;
  9.      
  10.      cout<<"你輸入的數字是"<<a<<endl;
  11.      
  12.       
  13.      system("pause");
  14.      return 0;   
  15. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6. int number=10;
  7. string str ="hello";

  8. cin>>number;
  9. cout<<str;
  10. cout<<"你輸入的數字是" <<number;
  11. cout<< "你輸入的文字是"<< str;

  12. /* cout<<"hello"<<endl;
  13.   cout<<"I my Alexander"<<endl;
  14.   */
  15.   system("pause");
  16.   return 0;
  17. }   
複製代碼

TOP

#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
    int number =10;
    string str = "hello";
    cin >> number;
    cin >> str;
    cout << number;
    cout << str;
cout<<"penelope"<< endl;
system("pause");
return 0;

TOP

#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
  int number;
  cout<< "請輸入一個數字";
  cin>>number;
  cout<< "你輸入的數字是"<<number<<endl;
   system("pause");
   return 0;  

}

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6. cout<<"555555"<<endl;
  7. int number = 10;
  8. cin>>number;
  9. cout<<number<<endl;
  10. cout<<"你輸入的文字是:"<<number<<endl;


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

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     string str="中文";
  7.     int number=10;
  8.     //cout<<number<<endl;
  9.     cin >> number;
  10.     cout <<"你說"<< number<< endl;
  11.     cin >>str;
  12.     cout<<"你說"<<str<<endl;
  13.     system("pause");
  14.     return 0;
  15.    
  16.    
  17.     }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.      cout<<"尤靖瑗"<<endl;
  7.    
  8.      int number = 0;
  9.      string str = "";
  10.      cin >> number;
  11.      cout<<"你輸入的數字是"<<number<<endl;
  12.       system("pause");
  13.      return 0;
  14.          
  15. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int number=10;
  7.     string str ="hello";
  8.     cin>>number;
  9.     cin>>str;
  10.     cout<<"你輸入的數字是"<<number<<endl;
  11.     cout<<"你輸入的文字是"<<str<<endl;
  12.    // cout<<"hello"<<endl;
  13.     //cout<<"coc"<<endl;
  14.     system("pause");
  15.     return 0;
  16. }
複製代碼

TOP

#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
  int number=0;
  string str="";
  float flo=0;
  cin>>number;
  cout<<number<<endl;

  cout<<str<<endl;
  system("pause");
  return 0;

TOP

  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6. int number=0;
  7. string str="";
  8. cout<<number<<endl;
  9. cin>>number;
  10. cin>>str;

  11. cout<<str<<endl;
  12. system("pause");
  13. return 0;   
  14. }
複製代碼

TOP

返回列表