Im a complete noob with C++ and i was wandering if this is possible, I would like to switch from int main() to int game() im not sure if its entirely possible.
#include <iostream>
#include <cstdlib>
using namespace std;
string name;
int main()
{
//So this is where we get the users name.
string namechoice;
cout << "Hello adventurer." << endl;
cout << "What is your name?\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << "\n";
cout << " Name: ";
cin >> name;
system("CLS");
cout << "So your name is " << name << ", Correct? (Y / N)\n";
cin >> namechoice;
namechoice[0] = toupper(namechoice[0]);
system("CLS");
if (namechoice == "Y"){
}
else if (namechoice == "N"){
while(namechoice == "N"){
cout << "Please enter your name: ";
cin >> name;
system("CLS");
cout << "You're name is " << name << ", Correct? (Y / N)\n";
cin >> namechoice;
namechoice[0] = toupper(namechoice[0]);
system("CLS");
}
}
}
int game()
{
cout << "Test";
return 0;
}
So what im asking is how do i go to int game() if either of the conditions i have in int main are eventually fulfilled.
Thanks in advance!