Hello, I'm doing a problem for my C++ programming class online, and having problems, the error isn't a compiling problem, its when I enter the information into the program, even though I'm using if/else statements, the outcome still is referring to the switch cases witin the first if/else statement, even if I enter 2 or 3 for the offNum
Code:
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
int main()
{
int offNum = 0;
int actNum = 0;
cout << "Enter Office Number (1/2/3): ";
cin >> offNum;
cout << "Enter Activity number (1/2/3/4): ";
cin >> actNum;
if (offNum = 1)
switch (actNum)
{
case 1: cout << "Raleigh: Making a new appointment" << endl;
break;
case 2: cout << "Raleigh: Rescheduling an appointment" << endl;
break;
case 3: cout << "Raleigh: Billing questions" << endl;
break;
case 4: cout << "Raleigh: Talking to a nurse" << endl;
}
else
{
if (offNum = 2)
switch (actNum)
{
case 1: cout << "Durham: Making a new appointment" << endl;
break;
case 2: cout << "Durham: Rescheduling an appointment" << endl;
break;
case 3: cout << "Durham: Billing questions" << endl;
break;
case 4: cout << "Durham: Talking to a nurse" << endl;
}
else
{
if (offNum = 3)
switch (actNum)
{
case 1: cout << "Chapel Hill: making a new appointment" << endl;
break;
case 2: cout << "Chapel Hill: Rescheduling an appointment" << endl;
break;
case 3: cout << "Chapel Hill: Billing questions" << endl;
break;
case 4: cout << "Chapel Hill: Talking to a nurse" << endl;
}
else
cout << "Input Error" << endl;
}
}
system("pause");
return 0;
}
If you want to see the actual problem itself in text, just reply asking, I'll be sure to post it immediately, thanks in advance