Problem with functions

What am I doing incorrectly?? Create 3 additional functions: progDept, dbaDept and gameDept to handle the call within the programming, database and game development department, respectively. In the main function, after the user has chosen a department, invoke the appropriate function to handle the call within the department.

#include <cstdlib>
#include <iostream>
using namespace std;

int main()
{
double deptChoice = 0;
double instChoice = 0;

cout << "Thank you for calling the Computer Technologies Division." << endl;
cout << "Press 1 for Programming department" << endl;
cout << "Press 2 for Database Management department" << endl;
cout << "Press 3 for Game Development department" << endl;
cout << "Press any other number to go to the secretary" << endl;
cin >> deptChoice;

if (deptChoice == 1)
{
cout << "You have reached the Programming Department." << endl;
cout << "Press 1 for Al Molin" << endl;
cout << "Press 2 for Witold Sieradzan" << endl;
cout << "Press 3 for Hong Cui" << endl;
cout << "Press 4 for Mary Orazem" << endl;
cout << "Press 5 for Hillary Paul" << endl;
cout << "Press any other number to go to the secretary" << endl;
cin >> instChoice;
if (instChoice == 1)
{
cout << "You have reached the voicemail of Al Molin." << endl;
cout << "Please leave a message after the beep." << endl;
}
else if (instChoice == 2)
{
cout << "You have reached the voicemail of Witold Sieradzan." << endl;
cout << "Please leave a message after the beep." << endl;
}
else if (instChoice == 3)
{
cout << "You have reached the voicemail of Hong Cui." << endl;
cout << "Please leave a message after the beep." << endl;
}
else if (instChoice == 4)
{
cout << "You have reached the voicemail of Mary Orazem." << endl;
cout << "Please leave a message after the beep." << endl;
}
else if (instChoice == 5)
{
cout << "You have reached the voicemail of Hillary Paul." << endl;
cout << "Please leave a message after the beep." << endl;
}
else
{
cout << "You have reached the voicemail of the secretary." << endl;
cout << "Please leave a message after the beep." << endl;
}
}
else if (deptChoice == 2)
{
cout << "You have reached the Database Management Department." << endl;
cout << "Press 1 for Peter Chen" << endl;
cout << "Press 2 for Frank Chao" << endl;
cout << "Press any other number to go to the secretary" << endl;
cin >> instChoice;
if (instChoice == 1)
{
cout << "You have reached the voicemail of Peter Chen." << endl;
cout << "Please leave a message after the beep." << endl;
}
else if (instChoice == 2)
{
cout << "You have reached the voicemail of Frank Chao." << endl;
cout << "Please leave a message after the beep." << endl;
}
else
{
cout << "You have reached the voicemail of the secretary." << endl;
cout << "Please leave a message after the beep." << endl;
}
}
else if (deptChoice == 3)
{
cout << "You have reached the Game Development Department." << endl;
cout << "Press 1 for Cindy Foster" << endl;
cout << "Press 2 for Brad Sewaringen" << endl;
cout << "Press 3 for Brandon Crews" << endl;
cout << "Press any other number to go to the secretary" << endl;
cin >> instChoice;
if (instChoice == 1)
{
cout << "You have reached the voicemail of Cindy Foster" << endl;
cout << "Please leave a message after the beep." << endl;
}
else if (instChoice == 2)
{
cout << "You have reached the voicemail of Brad Sewaringen." << endl;
cout << "Please leave a message after the beep." << endl;
}
else if (instChoice == 3)
{
cout << "You have reached the voicemail of Brandon Crews." << endl;
cout << "Please leave a message after the beep." << endl;
}
else
{
cout << "You have reached the voicemail of the secretary." << endl;
cout << "Please leave a message after the beep." << endl;
}
}
else
{
cout << "You have reached the voicemail of the secretary." << endl;
cout << "Please leave a message after the beep." << endl;
}

system("pause");
return 0;
}
You didn't make any functions to begin with!

Edit: Here is an example of a function in case you forgot.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
void dbaDept()
{
	cout << "You have reached the Database Management Department." << endl;
	cout << "Press 1 for Peter Chen" << endl;
	cout << "Press 2 for Frank Chao" << endl;
	cout << "Press any other number to go to the secretary" << endl;
	int nInstChoice;
	cin >> nInstChoice;
	if (nInstChoice == 1)
	{
		cout << "You have reached the voicemail of Peter Chen." << endl;
		cout << "Please leave a message after the beep." << endl;
	}
	else if (nInstChoice == 2)
	{
		cout << "You have reached the voicemail of Frank Chao." << endl;
		cout << "Please leave a message after the beep." << endl;
	}
	else
	{
		cout << "You have reached the voicemail of the secretary." << endl;
		cout << "Please leave a message after the beep." << endl;
	}
}
Last edited on
Topic archived. No new replies allowed.