標題:
if...else if...else 判斷式
[打印本頁]
作者:
tonyh
時間:
2018-7-12 09:29
標題:
if...else if...else 判斷式
本帖最後由 tonyh 於 2018-7-12 10:24 編輯
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a, b;
cout<<"請輸入a: ";
cin>>a;
cout<<"請輸入b: ";
cin>>b;
//cout<<"a:"<<a<<endl;
//cout<<"b:"<<b<<endl;
if(a>b)
{
cout<<"a大於b"<<endl;
}else if(a<b)
{
cout<<"a小於b"<<endl;
}else
{
cout<<"a等於b"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
蔡昀蓁
時間:
2018-7-12 10:07
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a,b;
cout<<"請輸入a:";
cin>>a;
cout<<"請輸入b:";
cin>>b;
cout<<"a="<<a<<endl;
cout<<"b="<<b<<endl;
if(a>b)
{
cout<<"a大於b"<<endl;
}
else if(a>b)
{
cout<<"a小於b"<<endl;
}
else
{
cout<<"a等於b"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
楊道軒
時間:
2018-7-12 10:08
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a,b;
cout<<"請輸入a";
cin>>a;
cout<<"請輸入b";
cin>>b;
cout<<"a="<<a<<endl;
cout<<"b="<<b<<endl;
if(a>b)
{
cout<<"a大於b"<<endl;
}
else if(a>b)
{
cout<<"a小於b"<<endl;
}
else
{
cout<<"a等於b"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
徐聖傑
時間:
2018-7-12 10:11
本帖最後由 徐聖傑 於 2018-7-12 10:12 編輯
[code]#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a,b;
cout<<"請輸入a:";
cin>>a;
cout<<"請輸入b:";
cin>>b;
cout<<"a="<<a<<endl;
cout<<"b="<<b<<endl;
if(a>b)
{
cout<<"a大於b"<<endl;
}
else if(a>b)
{
cout<<"a小於b"<<endl;
}
else
{
cout<<"a等於b"<<endl;
}
system("pause");
return 0;
}
作者:
鄭宇辰
時間:
2018-7-12 10:11
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a,b;
cout<<"請輸入a";
cin>>a;
cout<<"請輸入b";
cin>>b;
cout<<"a="<<a<<endl;
cout<<"b="<<b<<endl;
if(a>b)
{
cout<<"a大於b"<<endl;
}
else if(a>b)
{
cout<<"a小於b"<<endl;
}
else
{
cout<<"a等於b"<<endl;
}
system("pause");
return 0;
{
複製代碼
作者:
郭丞馨
時間:
2018-7-12 10:12
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a,b;
cout<<"請輸入a:";
cin>>a;
cout<<"請輸入b:";
cin>>b;
cout<<"a="<<a<<endl;
cout<<"b="<<b<<endl;
if(a>b)
{
cout<<"a大於b"<<endl;
}
else if(a>b)
{
cout<<"a小於b"<<endl;
}
else
{
cout<<"a等於b"<<endl;
}
system("pause");
return 0;
} [/code]
作者:
李祺閎
時間:
2018-7-12 10:13
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a,b;
cout<<"請輸入a:";
cin>>a;
cout<<"請輸入b:";
cin>>b;
cout<<"a="<<a<<endl;
cout<<"b="<<b<<endl;
if(a>b)
{
cout<<"a大於b"<<endl;
}
else if(a>b)
{
cout<<"a小於b"<<endl;
}
else
{
cout<<"a等於b"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
梁朝凱
時間:
2018-7-12 10:13
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a,b;
cout<<"請輸入a";
cin>>a;
cout<<"請輸入b";
cin>>b;
cout<<"a="<<a<<endl;
cout<<"b="<<b<<endl;
if(a>b)
{
cout<<"a大於b"<<endl;
}
else if(a>b)
{
cout<<"a小於b"<<endl;
}
else
{
cout<<"a等於b"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
陳子睿
時間:
2018-7-12 10:14
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a,b;
cout<<"請輸入a:";
cin>>a;
cout<<"請輸入b:";
cin>>b;
cout<<"a="<<a<<endl;
cout<<"b="<<b<<endl;
if(a>b)
{
cout<<"a大於b"<<endl;
}
else if(a>b)
{
cout<<"a小於b"<<endl;
}
else
{
cout<<"a等於b"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
王箴宓
時間:
2018-7-12 10:16
using namespace std;
int main()
{
int a, b;
cout<<"請輸入a:";
cin>>a;
cout<<"請輸入b:";
cin>>b;
cout<<"a="<<a<<endl;
cout<<"b="<<b<<endl;
if(a>b)
{
cout<<"a大於b"<<endl;
}
else if(a<b)
{
cout<<"a小於b"<<endl;
}
else
{
cout<<"a等於b"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
王秉淳
時間:
2018-7-12 10:16
#incloud<iostream>
#incloud<cstdlib>
using namespace std;
int main()
{
int a,b;
cout<<"請輸入a:";
cin>>a;
cout<<"請輸入b:";
cin>>b;
cout<<"a="<<a<<endl;
cout<<"b="<<b<<endl;
if(a>b)
{
cout<<"a大於b"<<endl;
}
else if(a<b)
{
cout<<"a小於b"<<endl;
}
else
{
cout<<"a等於b"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
劉冠伶
時間:
2018-7-12 10:21
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a;
int b;
cout<<"請輸入a:";
cin>>a;
cout<<"請輸入b:";
cin>>b;
cout<<"a:"<<a<<endl;
cout<<"b:"<<b<<endl;
if(a>b)
{
cout<<"a大於b"<<endl;
}
else if(a<b)
{
cout<<"a小於b"<<endl;
}
else
{
cout<<"a等於b"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
陳苡睿
時間:
2018-7-12 10:24
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a,b;
cout<<"請輸入a:";
cin>>a;
cout<<"請輸入b:";
cin>>b;
cout<<"a="<<a<<endl;
cout<<"b="<<b<<endl;
if(a>b)
{
cout<<"a大於b"<<endl;
}
else if(a>b)
{
cout<<"a小於b"<<endl;
}
else
{
cout<<"a等於b"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
葉辰卉
時間:
2018-7-12 10:24
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a,b;
cout<<"請輸入a:";
cin>>a;
cout<<"請輸入b:";
cin>>b;
cout<<"a="<<a<<endl;
cout<<"b="<<b<<endl;
if(a>b)
cout<<"a大於b"<<endl;
else if(a<b)
cout<<"a小於b"<<endl;
else
cout<<"a等於b"<<endl;
system("pause");
return 0;
}
複製代碼
作者:
楊侍穎
時間:
2018-7-12 10:26
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a,b;
cout<<"please type a value";
cin>>a;
cout<<"please type b value";
cin>>b;
cout<<"a="<<a<<endl;
cout<<"b="<<b<<endl;
if(a>b)
{
cout<<"a>b"<<endl;
}
else if(a,b)
{
cout<<"a<b"<<endl;
}
else
{
cout<<"a=b"<<endl;
}
system("pause");
return 0;
複製代碼
作者:
蔡承育
時間:
2018-7-12 10:34
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a, b;
cout<<"請輸入 a:";
cin>> a;
cout<<"請輸入b:";
cin>> b;
cout<<"a="<<a<<endl;
cout<<"b="<<b<<endl;
if(a>b)
{
cout<<"a 大於 b"<<endl;
}
else if(a<b)
{
cout<<"a 小於 b"<<endl;
}
else
{
cout<<"a 等於 b"<<endl;
}
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/)
Powered by Discuz! 7.2