返回列表 發帖

五則運算(五)

請加入限制 限制x與y的大小 不可以超過 2147483647

#include<iostream> // <-基本輸出輸入的函式庫 Input Output   cin 輸入 cout 輸出  
#include<cstdlib> //主要的函式庫 Library
using namespace std;
int main()
{
    int x; int y;
    cout << "兩數的五則運算" <<endl;
    cout << "請輸入x的值:" <<endl;
    cin >> x;
    cout << "請輸入y的值:" <<endl;
    cin >> y;
   
   
  
   
    //正 正 = > 正
    //正 負 = > 負
    //負 正  = >負
    //負 負 = > 正
   
   
    // && and = > 兩者都要成立就回傳true
    // || or  = > 兩者只要其中一者成立就回傳true  
    // ! = > false
    // 1 true 0 false
   
   cout << (x>=2147483647)<< endl;
   if(x>=2147483647 && y>=2147483647)
   {
     cout << "你輸入的值太大了! 請重新輸入~!" << endl;
   }

   else{
     
    cout  << "A";
     }
   
   
   

    system("pause");  
    return 0;  
}

TOP

返回列表