C++ How to prompt the user to search and display within the vector. The user should be able to search and it should display CULIST: College and location. FBTEAM: FBTeam, Price_Of_Ticket,...


C++


How to prompt the user to search and display within the vector. The user should be able to search and it should display  CULIST: College and location. FBTEAM: FBTeam, Price_Of_Ticket, Total_tuition.


Here are the instructions for this function



  • The function should allow a user to search for any institution and display the information such as the institution name, location, tuition cost, football team and ticket price when searching for the institution in the vectors.


#include "stdafx.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "ConsoleApplication11.h"


using namespace std;


string FBTeam;
string College[5];
string location;
string Price_of_Ticket;
int choice;




int main()
{
vector CULIST(5);
vector FBTEAM(5);
string itemNumber;




int tuition = 0;
int dorm = 0;
int meal = 0;
int total_tuition[5];
int average;


const int size = 5;
double averages[size] = { 0.0 };
bool stop = false, itemFound;




cout < "--------------------------------------------------------------------------------"=""><>
cout < "="" colleges="" in="" texas=""><>
cout < "--------------------------------------------------------------------------------"=""><>
cout <>
<>




{
repeat:;
cout < "\n\n***********************************************"=""><>
cout < "*="" 1.="" add="" colleges="" and="" city="" *"=""><>
cout < "*="" 2.="" add="" football="" team="" and="" ticket="" price="" *"=""><>
cout < "*="" 3.="" calculate="" total="" tution.="" *"=""><>
cout < "*="" 4.="" calculate="" average="" tuition="" of="" the="" schools="" *"=""><>
cout < "*="" 5.="" search="" and="" display="" information="" *"=""><>
cout < "*="" 6.="" exit=""><>
cout < "***********************************************"=""><>
cout < "\nchoose="" one:="" \n"=""><>
cin >> choice;
switch (choice)
{
case 1:
for (vector::size_type num=0; num < 5;="">
{
cout < "please="" enter="" the="" name="" for="" college="" #="" "="">< (num="" +="" 1)="">< ":="">
cin >> College[num];
CULIST.push_back(College[num]);
cout < "enter="" city="" of="" college="" #=""><>< ":="">
cin >> location;
CULIST.push_back(location);
}
goto repeat;
case 2:
for (int num = 0; num < 5;="">
{
cout < "enter="" the="" name="" for="" football="" team="" #="" "="">< (num="" +="" 1)="">< ":="">
cin >> FBTeam;
FBTEAM.push_back(FBTeam);
cout < "enter="" the="" cost="" of="" tickts="" for="" football="" team="" #="" "="">< (num="" +="" 1)="">< ":="">
cin >> Price_of_Ticket;
FBTEAM.push_back(Price_of_Ticket);
}
goto repeat;


case 3:
cout < "cost="" of="" total="" tution="" for="" the="">
for (vector::size_type num = 0; num < 5;="">
{




cout < "enter="" semester="" tution:="">
cin >> tuition;
cout < "enter="" the="" cost="" of="" room:="">
cin >> dorm;
cout < "enter="" the="" cost="" of="" meal:="">
cin >> meal;
total_tuition[num] = (tuition + dorm + meal);


cout < "total="" tution="" for="" college=""><><" is:="" "="">< total_tuition[num]=""><><>



string s = to_string(total_tuition[num]);
FBTEAM.push_back(total_tuition[num]);




}


goto repeat;


case 4:
{
int sum = 0;
int P = sizeof(College) / sizeof(College[0]);
for (int i = 0; i < p;="">
{


cout < "\n"="">< college[i]="">< "="" "=""><>
cout <>
cout <>


sum += total_tuition[i];


}
cout < "***calculate="" average="" tuition="" of="" the="" five="" universities***="">
average = sum / P;
cout < "the="" average="" is="" "="">< average=""><>
}
goto repeat;


case 5:
cout < "******search="" and="" display******="">

cout < "please="" type="" in="" the="" item="" you="" are="" looking="" for:="">
cin >> itemNumber;
cout <>

itemFound = false;
for (vector::size_type i = 0; i < culist.size();="">

{
cout < culist[i]="">< "="">
}


for (vector::size_type i = 0; i < fbteam.size();="">
{
cout < fbteam[i]="">< "="">
}


cout <>


goto repeat;
case 6:
exit(0);


default:
cout < "invalid="">
}
}
return 0;
}

Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here