#include <iostream>
#include <string>
using namespace std;
int main()
{
int first;
int second;
int sum;
int summ;
std::string input;
cout << "Choose arithmetic: Addition or Subtraction? " << endl;
cin >> input;
if(input == "Addition")
{
int first;
int second;
int sum = first+second;
cout << "Enter the first number: " << endl;
cout << "Enter the second number: " << endl;
cout << "The sum of these numbers is: " << sum << endl;
}
{
if(input == "Subtraction")
int first;
int second;
int summ = first-second;
cout << "Enter the first number: " << endl;
cout << "Enter the second number: " << endl;
cout << "The sub of these numbers is: " << sum << endl;
}
#include <iostream>
#include <string>
usingnamespace std;
int main()
{
std::string input;
cout << "Choose arithmetic: Addition or Subtraction? " ;
cin >> input;
if(input == "Addition")
{
int first;
cout << "Enter the first number: " ;
cin >> first ;
int second;
cout << "Enter the second number: " ;
cin >> second ;
int sum = first + second; // compute the sum *after* reading in the values
cout << "The sum of these numbers is: " << sum << '\n' ;
}
if(input == "Subtraction")
{
int first;
cout << "Enter the first number: " ;
cin >> first ;
int second;
cout << "Enter the second number: " ;
cin >> second ;
int diff = first - second;
cout << "The difference of these numbers is: " << diff << '\n' ;
}
}