Adblock breaks this site

Someone help me please =(

Discussion in 'Programming General' started by WoW Sucks, Nov 19, 2007.

Thread Status:
Not open for further replies.
  1. WoW Sucks

    WoW Sucks Global Moderator
    Banned

    Joined:
    Jan 21, 2007
    Posts:
    3,708
    Referrals:
    3
    Sythe Gold:
    0
    Someone help me please =(

    Ok, well i started learning C++ yesterday and i was doing fine untill i started a text game, which went wrong =(

    Code:
    #include <iostream>
    
    using namespace std;
    
    
    
    void main()
    {
    	char name;
    
    	cout << "Welcome To The Adventure Text Game" << "\n";
    
    	cout << "Please Choose a name: " << name;
    	cin >> name;
    
    		cout << name << "\n";
    
    
    
    }
    This is what happens when i compile it:

    [​IMG]

    How can i make those stupid characters go away, and make it print the name you insert?

    Thanks.
     
  2. The End

    The End Forum Addict

    Joined:
    Dec 10, 2005
    Posts:
    397
    Referrals:
    0
    Sythe Gold:
    0
    Someone help me please =(

    You tried to display a character before it was defined by the user (see commented out part) ;P
     
  3. Olan14

    Olan14 Forum Addict

    Joined:
    Jan 26, 2007
    Posts:
    581
    Referrals:
    0
    Sythe Gold:
    0
    Someone help me please =(

    Printing a 'garbage value', as stated by K&R.
     
  4. Nullware

    Nullware Guru

    Joined:
    Jan 30, 2007
    Posts:
    1,761
    Referrals:
    4
    Sythe Gold:
    0
    Someone help me please =(

    Yeah they've already both told you Dave but if you need more help next time look for me on MSN. I'm not a C++ guru but no offense, I'm better than you. =P
     
  5. WoW Sucks

    WoW Sucks Global Moderator
    Banned

    Joined:
    Jan 21, 2007
    Posts:
    3,708
    Referrals:
    3
    Sythe Gold:
    0
    Someone help me please =(

    Umm im pretty sure this thread is from november >_>

    Lockage please!
     
< Mouse Recorder help | Java question! >
Thread Status:
Not open for further replies.


 
 
Adblock breaks this site