Start New Discussion within our Software Development Community

ok so im doing a project for a class, no body but me is doing c++ for it, im the only one in my school that knows some of it, and heres what i have so far, havnt gotten into too much detail for it because i need to know how to do the functions first...

#include <iostream>

using namespace std;
int Unitedstates()
{
     
 cout << "You have chosen to learn more about: The United States."  << endl;   
     
}
int main()
{
int action;
 cout << "What would you like to learn more about?" << endl; 
 cout << "1. Medecine in the United States." << endl;  
 cout << "2. Medecine in Europe." << endl;
 cout << "3. Medecine in China." << endl;
 cout << "4. Medecine in Australia." << endl;  
 cout << "5. Medecine in Africa." << endl;  
 cout << "6. Medecine in Brazil." << endl;  
 cin >> action;
 if (action == 1)
 int Unitedstates();
 
 system("pause");
 return 0;   
    
}

so basically what i want to do is make it so the int main()
is just the basic thing, is there a way i can put whats in the
int main() right now as something like a void mainmenu()
and then just during the script call on it later, then can i put the
int Unitedstates() as a void unitedstates()
then put options there and just come back to it later when they press 1 for UnitedStates?

well there are a lot of ways in which u can do .
I think it would be prudent to , learn a bit more about functions and classes in c++ . That will give u a fairly good idea on how to organize as well as write secure code .

U can refer books authored by stanley lippman or herbert schild for this purpose . I personally felt they are quite good.

This article has been dead for over six months. Start a new discussion instead.