Page 2 of 2 First 12
  • Jump to page:
    #16
  1. pogremar
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2003
    Location
    At Work
    Posts
    958
    Rep Power
    14
    look over the code so you can see where I made the changes. I'll bold some.
    Code:
    #include <iostream>
    #include <string>
    #include <windows.h> // for the function Sleep, you don't need it
    
    
    using namespace std; 
    
    
    
    int main()
    {
    	// CopyRight 2003 Shadowillusions
    	// Justin Shreve
    	// http://Shadowillusions.com
    	// Site UnderContruction
    
        string name, lastname, landname, confirmINFO, geteverything, tooksolong;
    	char message[1000]; // general purpose
    	int age, HP, MP;
    	int i = 0; // general purpose 
    
    	cout << "Enter your name: ";
        cin >> name;
    
        cout << "Enter your lastname: ";
        cin >> lastname;
    
    	cout << "Enter your age: ";
        cin >> age;
    
    	cout << "Enter your landname: ";
        cin >> landname;
    
    	cout <<name <<" " <<lastname <<" of " <<landname <<"? (Y/N)";
    	cin >> confirmINFO;
    	
    	
    
    if (confirmINFO =="Y" || confirmINFO =="y" || confirmINFO =="Yes" || confirmINFO =="yes")
    
    		{
    		cout <<endl;
    		}
    
    		else
    		{
    			cout <<"Well Okay Then - good bye";
    			cout <<endl;
    			return(0);
    		}
    
    		cout <<"The Renegadeillusion \n";
    		cout <<name <<" was woken up by his mother on a late stormy night...... \n";
    		cout <<"Mom: It's Stormy badly - the town is going to the shelter near the \nMagic Gem in the center of the town... \n";
    	
    		
    		bool ok = false;
    		do{
    		
    			cout <<"Mom: Did you get everything you needed?" << endl << "> ";
    			cin >> geteverything;
    			cout <<endl;
    
    	
    				if (geteverything =="yes" || geteverything =="Yes" || geteverything =="Y" || geteverything =="y")
    				{
    					cout <<"Mom: Good Let's Goin!" << endl ;
    					ok = true;
    				}
    
    
    				else if (geteverything =="no" || geteverything =="No" || geteverything =="N" || geteverything =="n")
    				{
    					cout <<"Mom: We Don't have enogh Time to go get it - we will have to leave it" << endl;
    					ok = true;
    				}
    
    
    				else 
    				{
    					cout <<"Mom: What? I didn't understand that....." << endl;
    					ok = false;
    				}
    
    				}while(ok == false);
    		
    		cout <<name <<" And his Mom run as fast as they could to the gem..." << endl;	
    		cout <<"Stephine: Thanks god your safe what took you so long? " << endl << "> ";
    
    		cin.ignore();
    		cin.get(message, strlen(message));
    		cout <<name << ": " << message << endl;
    
    
    
    		/// this bottom part is just for so you can see other things you can do
    
    		cout <<"Mom: Sounds like an excuse to me. What do you want to eat for dinner?" << endl << "> ";
    
    		cin.ignore();
    		cin.get(message, strlen(message));
    		cout <<name << ": " << message << endl;
    
    		cout <<"Mom: Are you sure you want to eat ";
    
    		for(i=0; i<strlen(message);i++){
    			Sleep(300);
    			cout << message[i];
    		}
    
    
    		cout <<endl <<" You know what, I know what you can eat";
    
    
    		for(i=0; i<10;i++){
    		Sleep(500);
    		cout <<".";
    		}
    
    		cout <<" DIRT!" << endl << endl;
    
    
    
    		// this is where i want a whole sentance of words to be taken so it can show this:
    		// eg: cout <<name <" " <<tooksolong
    		//along with a string or any other way you can get it to work
    		// I have not used MP or HP yet so if you use Mircrosof Visual c++ you will get these two messages:
    		// C:\Program Files\Microsoft Visual Studio\MyProjects\Renegadeillusion\Renegadeillusion.cpp(12) : warning C4101: 'HP' : unreferenced local variable
    		//C:\Program Files\Microsoft Visual Studio\MyProjects\Renegadeillusion\Renegadeillusion.cpp(12) : warning C4101: 'MP' : unreferenced local variable
    
    		return(0);
    }
    This concerns what you're asking.

    cin.ignore();
    cin.get(message, strlen(message));


    see how I made a character array like this:
    char message[1000];
    this is equivalent to a string that can hold 1000 chars.

    use cin.get() to get whole sentences. You have to use cin.ignore(); before it. I think it also works after it. I forgot why you need it but if you don't use cin.ignore then cin.get won't function properly.

    Also take a look at how you should check for strings matching "y", "Y", "Yes", "yes".

    hope that helps
    Some day I'll create a smart quote to put here.
  2. #17
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    29
    Rep Power
    0
    63 error(s), 10 warning(s)

    i would post them but there are so many >_< i'll see if i can fix them
  4. #18
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    29
    Rep Power
    0
    wow - i forgot the #include files >_< nvm then
  6. #19
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    29
    Rep Power
    0
    anyway it works! Thanks dude - i'll just finsh up the game now and after that i'll add that save file that you gave me (that was you right?) thanks for all your help
  8. #20
  9. pogremar
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2003
    Location
    At Work
    Posts
    958
    Rep Power
    14
    no doubt!
Page 2 of 2 First 12
  • Jump to page:

IMN logo majestic logo threadwatch logo seochat tools logo