Code
string getname ( int*** array3d, string vendor1, string vendor2, string vendor3, string vendor4)
{
ifstream entrada("entrada.txt");
string aline;
while( getline(entrada,aline))
{
if (aline[0] == 'V' || aline[0] == 'v') // get the names and puts them into a string
{
if ( aline[7] == '1')
{
cout << "\n Vendor number 1 should be ";
vendor1 = aline.substr(9);
cout <<vendor1;
cout << "\n";
}
else if (aline[7]== '2')
{
cout << " Vendor number 2 is";
vendor2 =aline.substr(9);
cout << vendor2;
cout << " \n";
}
else if (aline[7]== '3')
{
cout << " vendor number 3 is";
vendor3= aline.substr(9);
cout << vendor3 ;
cout << "\n";
}
else if ( aline[7] == '4')
{
cout << "Vendor number 4 is ";
vendor4 = aline.substr(9);
cout << vendor4;
cout << "\n";
}
}
}
entrada.close();
return vendor1,vendor2,vendor3,vendor4;}
I managed to go use this function to get the names of the vendors and assigned them to the strings vendor1,vendor2,vendor3,vendor4
but for some reason the function does not want to return the string names that are now vendor1-4.
How can i get this function to work :/
also ignore that fact that i am passing a 3d array into the function xD, i got to edit that out.
also pretend the text i posted in the first post, has 1 more vendor added to it.