#include <iostream>
#include <string>
usingnamespace std;
//fucntions
void intro(string name[subName]);
int main()
{
string name[5];
int subName;
intro(name[subName]);
cout << string name[5];
}
void intro(string name[subName])
{
string name[5];
char redoName;
do
{
cout << "Please type the names of the people you wish to take with you. \n"
<< "You may only bring 5 people. " << endl <<endl;
int subName;
for(subName = 0; subName <= 4; subName++)
{
cout << "enter name: ";
cin >> name[subName];
}
//outputting all names
cout << endl;
for(subName = 0; subName <= 4; subName++)
{
cout << name[subName] << endl;
}
cout << "\nAre you sure that this is the party you want to take with you? [Y/N] " <<endl;
cin >> redoName;
}
while(redoName == 'n' || redoName == 'N');
}
I am trying to bring back the 5 names to use in main for future use
#include <iostream>
#include <string>
usingnamespace std;
int main()
{
string name[5];
char redoName;
do
{
cout << "Please type the names of the people you wish to take with you. \n"
<< "You may only bring 5 people. " << endl <<endl;
int subName;
for(subName = 0; subName <= 4; subName++)
{
cout << "enter name: ";
cin >> name[subName];
}
//outputting all names
cout << endl;
for(subName = 0; subName <= 4; subName++)
{
cout << name[subName] << endl;
}
cout << "\nAre you sure that this is the party you want to take with you? [Y/N] " <<endl;
cin >> redoName;
}
while(redoName == 'n' || redoName == 'N');
}