|
if...else if...else 判斷式
- #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;
- }
複製代碼 |
|