How do I write an INLINE iterative function called AddValueToVector () which prompts the user to enter ten (10) integer values, which will be used throughout the program. The values should be stored in a vector and the function should be used when the user presses A from the menu options. The vector should be passed to the function by reference.`
This is what I have so far.
#include <iostream>
#include <vector>
using namespace std;
inline void AddValueToVector(char Option)
{
int i = 0;
vector <int> store;
for (i = 0; i<11; i++){
cout<<"Enter Integer"<<endl;
cin>>i;
}
}
void menu ()
{
char Option;
cout << " Vector Manipulations" <<endl;
cout <<" ***********************"<<endl;
cout <<" MENU OPTIONS"<<endl;
cout <<" *********************"<<endl;
cout <<"Press [A] - To ADD values to Vector"<<endl;
cout <<"Press [S] - To SEARCH Vector Contents"<<endl;
cout <<"Press [P] - To PRINT Vector Contents"<<endl;
cout <<"Press [M] - To find the MINIMUM Value in the Vector"<<endl;
cout <<"Press [L] - To find the MAXIMUM value in the Vector"<<endl;
cout <<"Press [X] - To EXIT program"<<endl;
cout <<"Please Select an Option From The Menu: "<<endl;
cin >>Option;
switch(Option)
{
case 'A':
cout<<"You Have Selected: To Add Values to Vector: "<<endl;
AddValueToVector('A');
break;
}
}
int main ()
{
menu();
return 0;
}