   Some help please.
  I want to be able to move from one function into another and back  to the spot I want to get to. Problem is that I don''t know how. I am currently using a while statement which I believe is insufficient for the job.Could someone please give me a few pointers on how to move inbetween different functions.Thanks#include <iostream>#include <cstdlib>#include <string>#include <iomanip>using namespace std;/////////////////////////////////////////////////////////////////////////////struct player_properties{string szName;int attack;int health;int maxHealth;int strength;int dexterity;int defense;}pcName, pcStats, pcAttack;/////////////////////////////////////////////////////////////////////////////struct pcAction{int action;//EXTRA SIDE CALCULATIONS IE: TO HITint toHit;int round;//ENEMY CALCSint npcAttack;}pcOption, battleRound;/////////////////////////////////////////////////////////////////////////////struct npcEnemies{};/////////////////////////////////////////////////////////////////////////////struct npcFriends{string archadon;int attack;int health;int maxHealth;int strength;int dexterity;int defense;}npcArchadon, npcStats, npcOption;/////////////////////////////////////////////////////////////////////////////void play();void story();void name();void stats();void inventory();void bossBattle();/////////////////////////////////////////////////////////////////////////////int main() //MENU{int option=0;pcStats.health = 30;pcStats.maxHealth = 30;pcStats.strength = 7;pcStats.dexterity = 4;cout << "1. Play Game" << endl << "2. Exit Game" << endl;cout << "Enter the corresponding number to continue: ";cin >> option;switch(option){case 1:name();break;case 2:system("CLS");cout << "EXITING" << endl;break;default:cout << "Invalid Entry, please press key ''1'' or ''2''." << endl;system("PAUSE");system("CLS");cout << "1. Play Game" << endl << "2. Exit Game" << endl;cout << "Enter the corresponding number to continue: ";cin >> option;break;}system("Pause");return 0;}/////////////////////////////////////////////////////////////////////////////void play() //THE GAME PLAY{system("CLS");do{cout << endl;cout << "It is a dark and stormy night, the wind howls on the trees" << endl  << "like the cry of a banshee. However, something doesn''t feel right..." << endl << "You walk over to the window and stare at the window." << endl << "you notice there is a reflection in it, you notice a smell of rum." << endl << endl;cout << "What will you do?" << endl;cout << "1. Move on" << endl;cout << "2. Look at player statistics" << endl << "Select Option: ";cin >> pcOption.action;cout << endl;switch(pcOption.action){case 1:break;case 2:stats();break;}} while ( pcOption.action == 2 );do{system("CLS");cout << "You slowly walk over to the kitchen, you here a loud noise." << endl<< "CLAP! Like a blinding flash of thunder drops down a man with eight legs" << endl<< "What is it you want? " << pcName.szName << " shrieks." << endl<< "My name is Archadon. I am looking for a warrior called " << pcName.szName << ". " << endl<< "My name is " << pcName.szName << ". What is it you want from me Archadon?" << endl<< "Before I can believe you I need to make sure you truly are " << endl<< "the warrior called " << pcName.szName << endl << endl;cout << "What will you do?" << endl;cout << "1. Move on" << endl;cout << "2. Look at player statistics" << endl << "Select Option: ";cin >> pcOption.action;cout << endl;switch(pcOption.action){case 1:bossBattle();break;case 2:stats();break;default:break;}}while(pcOption.action == 2);while ( pcOption.action == 2 );do{system("CLS");cout << "You slowly walk over to the kitchen, you here a loud noise." << endl<< "CLAP! Like a blinding flash of thunder drops down a man with eight legs" << endl<< "What is it you want? " << pcName.szName << " shrieks." << endl<< "My name is Archadon. I am looking for a warrior called " << pcName.szName << ". " << endl<< "My name is " << pcName.szName << ". What is it you want from me Archadon?" << endl<< "Before I can believe you I need to make sure you truly are " << endl<< "the warrior called " << pcName.szName << endl << endl;cout << "What will you do?" << endl;cout << "1. Move on" << endl;cout << "2. Look at player statistics" << endl << "Select Option: ";cin >> pcOption.action;cout << endl;switch(pcOption.action){case 1:bossBattle();break;case 2:stats();break;default:break;}}while(pcOption.action == 2);}/////////////////////////////////////////////////////////////////////////////void name() //CHARACTERS NAME CHOICE{cout << "Please enter your name: ";cin >> pcName.szName;cout << endl << "Welcome " << pcName.szName << endl << endl;system("Pause");play();}/////////////////////////////////////////////////////////////////////////////void story(){}/////////////////////////////////////////////////////////////////////////////void stats() //PLAYER STATS{system("CLS");cout << "Player Statistics" << endl << endl;cout << "Name: " << pcName.szName << endl;cout << "Health: " << pcStats.health << "/" << pcStats.maxHealth <> pcOption.action;while(pcStats.maxHealth > 0 && npcStats.maxHealth > 0 && pcOption.action == 1){pcOption.round = 0;while(pcOption.round == 0 && pcStats.maxHealth > 0){pcAttack.attack = pcStats.strength;npcStats.maxHealth = npcStats.maxHealth - (pcAttack.attack-npcStats.defense);pcOption.round++;system("CLS");}while(pcOption.round == 1 && npcStats.maxHealth > 0){npcOption.attack = npcStats.strength;pcStats.maxHealth = pcStats.maxHealth - (npcOption.attack-pcStats.defense);pcOption.round--;system("CLS");}roundCount++;//if(npcStats.maxHealth > 0 || pcStats.maxHealth > 0)cout << "Battling " << npcArchadon.archadon << endl << endl;cout << "Battle Options:" << endl<< "1. Attack" << endl<< "2. Use Inventory Items" << endl<< "HP:" << pcStats.maxHealth << "/" << pcStats.health << endl<< "ENEMY HP: " << npcStats.maxHealth << "/" << npcStats.health << endl<< "ROUND: " << roundCount << endl << endl;cout << "ENTER: ";cin >> pcOption.action;}if(pcStats.maxHealth <= 0){system("CLS");cout << "You have died" << endl;system("pause");system("CLS");main();}if(npcStats.maxHealth <= 0){system("CLS");cout << "You have Won" << endl;system("pause");system("CLS");main();}} 
  I dont think anyone will read all that source.Its better if you state what you mean by using pseudo code.i.e. give an example of how you want the program to behave.;  Do you mean calling a function? because I don't see your functions being called by main().To call a function just use function();ie to call play() in main()... you'd do... int play(){ //Do some other stuff.}int main(){  //Do stuff in main  play();  //Back from function do other stuff}so that would execute "Do stuff in main... then call play and executre "do some other stuff" then, when play is finished, would execute "Back from function do other stuff.<You must declare a function being called BEFORE it is called.To get around this you can use prototypes, that is just writing the headers of your functions at the top of the file.(ie. play(); is the prototype of the function play when its not in the middle of the code.   [edited by - xmcbainx on July 31, 2003 9:29:16 AM]