標題:
if...else if...else 判斷式
[打印本頁]
作者:
tonyh
時間:
2016-2-3 13:54
標題:
if...else if...else 判斷式
本帖最後由 tonyh 於 2016-7-14 13: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;
}
複製代碼
作者:
謝以愛
時間:
2016-2-3 14:41
#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;
}
複製代碼
作者:
方宥鈞
時間:
2016-2-3 14:42
#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;
}
[/code]
作者:
林昱岑
時間:
2016-2-3 14:43
#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;
}
複製代碼
作者:
孫石青
時間:
2016-2-3 14:44
#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;
}
複製代碼
作者:
陳泓廷
時間:
2016-2-3 14:46
#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;
}
複製代碼
作者:
黃千瑜
時間:
2016-2-3 14:48
#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;
}
複製代碼
作者:
吳建錡
時間:
2016-2-3 14:54
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
int x,y;
cout<<"請輸入x:";
cin>>x;
cout<<"請輸入y:";
cin>>y;
if(x>y)
{
cout<<"x>y"<<endl;
}
else if(x<y)
{
cout<<"x<y"<<endl;
}
else
{
cout<<"x=y"<<endl;
}
system("pause");
return 0;
}
複製代碼
作者:
陳泓瑜
時間:
2016-2-3 15:00
#include<iostream>
#include<cstdlib>
using namespace std;
int main ()
{
int x,y;
cout<<"PLEASE SET THE X"<<endl;
cin>>x;
cout<<"PLEASE SET THE Y"<<endl;
cin>>y;
if(x<y)
{
cout<<"Y IS BIGGER THAN X"<<endl;
}
else if (x>y)
{
cout<<"X IS BIGGER THAN Y"<<endl;
}
else
{
cout<<"X EQUALS Y"<<endl;
}
system("pause");
return 0;
}
複製代碼
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/)
Powered by Discuz! 7.2