|
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;
- }
複製代碼 |
|