#include
using namespace std;
int main()
{
int a,b;
char input;
Start:
cout <<"請輸入第一個數值:";
cin >>a;
cout <<"請輸入第二個數值:";
cin >>b;
cout <<"請輸入運算符號";
cin >>input;
switch(input)
{
case '+':
cout << a << input << b << "=" << a+b << endl;
break;
case '-':
cout << a << input << b << "=" << a-b << endl;
break;
case '*':
cout << a << input << b << "=" << a*b << endl;
break;
case '/':
cout << a << input << b << "=" << a/b << endl;
break;
default: //注意default前面不用加case
cout << "無效輸入" << endl;
break;
}
goto Start;
return 0;
}
文章標籤
全站熱搜
