string trouble

This is a discussion on string trouble within the C++ Programming forums, part of the General Programming Boards category; Thanks andy, that just cleared up alot of confusion. Thank you everyone for your help. I'll get this one day...

  1. #16
    Registered User
    Join Date
    Oct 2004
    Posts
    11
    Thanks andy, that just cleared up alot of confusion.

    Thank you everyone for your help. I'll get this one day

  2. #17
    Registered User
    Join Date
    Feb 2002
    Posts
    13
    Hell my friend,
    I blieve someone posted something here in regards to syntx errors u are having, I strongly recommend the same sites to be viewed.

    here is how I so far fixed .... going from here on might help u a little bit.. see what changes have been made..


    esp with '\n' or "\n" u had a bunch of them there plus the } closing... of start function..


    Good luck..

    Code:
    #include <iostream>
    #include <windows.h>
    #include <stdlib.h>
    #include <string>
    
    using std::cin;
    using std::cout;
    using std::string;
    
    unsigned long int money;
    unsigned short int reputation;
    unsigned short int time_worked;
    unsigned short int skill;
    string name;
    //string hospital name;
    string state;
    string country;
    
    void start();
    //void instruction();
    void begin();
    void yourstats();
    void gamemenu();
    void work();
    void buyitem();
    void sellitem();
    void patientdied();
    void patientgotwell();
    void paycheck();
    void bills();
    void fired();
    void hired();
    void sued();
    void gameover();
    
    void instruction()
    {
    	cout<<"What is there to explain? Follow the promts and get money! boink" << '\n';
    	start();
    }
    void start()
    {
    	string mainmenuchoice;
    	cout<<"Welcome to Doctor Sim v1!" << '\n\n';
    	cout<<"Main Menu"<<'\n';
    	cout<<"1)Begin Simulation" << '\n';
    	cout<<"2)Instruction" << '\n';
    	cout<<"3)Exit" << '\n';
    	cin>>mainmenuchoice;
    	cin.ignore();
    
    	if (mainmenuchoice == "1") {
    		begin();
    	}
    	else if (mainmenuchoice == "2") {
    		instruction();
    	}
    	else if (mainmenuchoice == "3") {
    
    	}
    	else {
    		cout<<"Wrong Answer! Simulation will now begin!" << '\n\n';
    		begin();
    	}
    
    }
    void begin()
    {
    	string name, answer1;
    	name = "Doctor";
    	cout<<"Hello, are you here to apply for the job?";
    	cin>>answer1;
    	cin.ignore();
    	if (answer1 == "yes") {
    		cout<<"good";
    	}
    	else if (answer1 == "no") {
    		cout<<"That's too bad, you look like a fine doctor. I think you should see the hospital manager anyway.";
    	}
    	cout<<"Hello, you must be the doctor I heard about. We're looking for a another doctor to hire, so let's preceed to the interview.";
    	cout<<"First, what's your name?";
    		cin>>name;
    	cout<<"Let me write this down...Name:" << name << ", what college did you goto?";
    	cout<<"Really...";
    	//cin>>;
    	cout<<"Well, i'll hire you, but only on a trial basis. You screw up and you're gone.";
    }
    
    int main()
    {
    	start();
    	return 0;
    }
    Ok...

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Custom String class gives problem with another prog.
    By I BLcK I in forum C++ Programming
    Replies: 1
    Last Post: 12-18-2006, 03:40 AM
  2. RicBot
    By John_ in forum C++ Programming
    Replies: 8
    Last Post: 06-13-2006, 07:52 PM
  3. Classes inheretance problem...
    By NANO in forum C++ Programming
    Replies: 12
    Last Post: 12-09-2002, 03:23 PM
  4. creating class, and linking files
    By JCK in forum C++ Programming
    Replies: 12
    Last Post: 12-08-2002, 02:45 PM
  5. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 07:49 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21