Why Nostr? What is Njump?
2023-02-07 11:32:07

Patrick on Nostr: #[0] 帮我看看下面这段C++代码有没有问题 #include <iostream> using ...


帮我看看下面这段C++代码有没有问题
#include <iostream>
using namespace std;
int main()
{
int num1, num2;
char sign;
cout << "Please enter two numbers: ";
cin >> num1 >> num2;
cout << "Please enter the sign: ";
cin >> sign;
switch(sign)
{
case '+':
cout << num1 << " + " << num2 << " = " << num1+num2 <<endl;
break;
case '-':
cout << num1 << " - " << num2 << " = " << num1-num2 <<endl;
break;
case '*':
cout << num1 << " * " << num2 << " = " << num1*num2 <<endl;
break;
case '/':
cout << num1 << " / " << num2 << " = " << num1/num2 <<endl;
break;
default:
cout << "Invaid operand";
break;
}
return 0;
}
Author Public Key
npub1ezhr4nvujak7ukh6zpzprjhg6m0llta9j23j3lnlsftc5uypyvpq3psyud