|
Hey all so im working on this project and ran into some problems and could use some help. The project is split into functions with a single file project. Their is a menu that display the user enters a choic and then goes to the entered area, their is a add person which adds a name and $amount. then a view option to display what was entered and then a sort option using a bubble sort. So i know i have problems with my code but im not sure where. Any help would be greatly appriciated.
Code:
//searches.cpp
#include<iostream>
#include<string>
usingnamespace std;
int displayMenu(void);
void processChoice(int); //missing argument
void Add(string, int);
void View(string, int);
//sort list
int main()
{
int num;
do
{
num=displayMenu();
if (num !=4)
processChoice(num);
}while (num !=4);
return 0;
}
int displayMenu (void)
{
int choice;
cout << "\nMenu\n";
cout << "==============================\n\n";
cout << "1. Add student to waiting list\n";
cout << "2. View waiting list\n";
cout << "3. Sort list\n";
cout << "4. Exit program\n\n";
cout << "Please enter choice: ";
cin >> choice;
return choice;
}
void processChoice(int choice)
{
switch (choice)
{
case 1: Add();//(string, int);
break;
case 2: View();//(string, int);
break;
//case 3: Sort(); break;
}
}
void Add(string n[], int b[])
{
for (int j = 0; j<5; j++)
{
cout <<"Enter students name\n ";
cin>>n[j];
}
for (int x = 0; x<5; x++)
{
cout<<"Enter bribe amount\n ";
cin>>b[x];
}
}
void View(string nam[], int brib[])
{
for (int i=1; i<5; i++)
{
cout<<i<<" "<<nam[]<<" $"<<brib[]<<endl;}
}
//sort stuff will go here
|