標題:
if...else if...else 判斷式
[打印本頁]
作者:
tonyh
時間:
2020-7-17 10:25
標題:
if...else if...else 判斷式
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a, b;
cout<<"請輸入a: ";
cin>>a;
cout<<"請輸入b: ";
cin>>b;
if(a>b)
{
cout<<"a>b"<<endl;
}else if(a<b)
{
cout<<"a<b"<<endl;
}else
{
cout<<"a=b"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
林彥廷
時間:
2020-7-17 10:32
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a, b;
cout<<"請輸入a: ";
cin>>a;
cout<<"請輸入b: ";
cin>>b;
if(a>b)
{
cout<<"a>b"<<endl;
}else if(a<b)
{
cout<<"a<b"<<endl;
}else
{
cout<<"a=b"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
邱睿宸
時間:
2020-7-17 10:35
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a, b;
cout<<"請輸入a: ";
cin>>a;
cout<<"請輸入b: ";
cin>>b;
if(a>b)
{
cout<<"a>b"<<endl;
}else if(a<b)
{
cout<<"a<b"<<endl;
}else
{
cout<<"a=b"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
楊秉翰
時間:
2020-7-17 10:37
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a, b;
cout<<"請輸入a: ";
cin>>a;
cout<<"請輸入b: ";
cin>>b;
if(a>b)
{
cout<<"a>b"<<endl;
}else if(a<b)
{
cout<<"a>b"<<endl;
} else
{
cout<<"a=b"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
張宸綝
時間:
2020-7-17 10:38
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a,b;
cout<<"請輸入a:";
cin>>a;
cout<<"請輸入b:";
cin>>b;
if(a>b)
{
cout<<"a>b"<<endl;
}
else if(a<b)
{
cout<<"a<b"<<endl;
}
else
{
cout<<"a=b"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
季禹妡
時間:
2020-7-17 10:38
#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;
}
複製代碼
作者:
張詰
時間:
2020-7-17 10:38
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a,b;
cout<<"請輸入a:";
cin>>a;
cout<<"請輸入b:";
cin>>b;
if(a>b)
{
cout<<"a>b"<<endl;
} else if(a<b)
{
cout<<"a<b"<<endl;
}else
{
cout<<"a=b"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
陳顥丰
時間:
2020-7-17 10:39
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a,b;
cout<<"請輸入a:";
cin>>a;
cout<<"a="<<a<<endl;
cout<<"請輸入b:";
cin>>b;
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;
}
複製代碼
作者:
葉品蓉
時間:
2020-7-17 10:40
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a, b;
cout<<"請輸入a: ";
cin>>a;
cout<<"請輸入b: ";
cin>>b;
if(a>b)
{
cout<<"a>b"<<endl;
}else if(a<b)
{
cout<<"a<b"<<endl;
}else
{
cout<<"a=b"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
廖敏亘
時間:
2020-7-17 10:40
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a,b;
cout<<"請輸入a: ";
cin>>a;
cout<<"請輸入b: ";
cin>>b;
if(a>b)
{
cout<<"a>b"<<endl;
}else if(a<b)
{
cout<<"a<b"<<endl;
}else
{
cout<<"a=b"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
王翊豪
時間:
2020-7-17 10:41
#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;
}
複製代碼
作者:
張銘軒
時間:
2020-7-17 10:41
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a,b;
cout<<"請輸入a:";
cin>>a;
cout<<"請輸入b:";
cin>>b;
cout<<"a="<<b<<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;
}
複製代碼
作者:
林妤芹
時間:
2020-7-17 10:42
#include<iostream>
#inciude<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"<<b<<endl;
}
else if(a<b)
{
cout<<"a小於b"<<endl;
}
else
{
cout<<"a等於b"<<endl;
}
system("pause");
return0;
}
複製代碼
作者:
黃丞軒
時間:
2020-7-17 10:45
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a, b;
cout<<"請輸入a: ";
cin>>a;
cout<<"請輸入b: ";
cin>>b;
if(a>b)
{
cout<<"a>b"<<endl;
}else if(a<b)
{
cout<<"a<b"<<endl;
}else
{
cout<<"a=b"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
陳均睿
時間:
2020-7-17 10:48
#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;
}
複製代碼
作者:
鄭稟弘
時間:
2020-7-17 10:51
#include<iostream>
#include<cstdlib>
using namespace std ;
int main()
{
int a, b;
cout<<"請輸入a: ";
cin>>a;
cout<<"請輸入b: ";
cin>>b;
if(a>b)
{
cout <<"a>b"<<endl;
}else if(a<b)
{
cout <<"a<b"<<endl;
}else
{
cout <<"a=b"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
林煜宸
時間:
2020-7-17 11:09
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int a,b;
cout<<"請輸入a;";
cin>>a;
cout<<"a="<<a<<endl;
cout<<"請輸入b;";
cin>>a;
cout<<"b="<<b<<endl;
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