Thread: simple program question...

  1. #1
    Unregistered
    Guest

    Question simple program question...

    i am trying to make a program that when someone types their name it says something like "your name is..." and i have something like this cout<<"your name is... " <<name; but it only shows the first letter that i typed. how do i show the whole name?

  2. #2
    Anti-Terrorist
    Join Date
    Aug 2001
    Location
    mming, Game DevelopmentCSR >&<>&2Minimization of boolean functions, PROM,PLA design >&0>&WA, USA guitar, dogsCommercial Aviation >&>>&USAProgramming
    Posts
    742
    Code:
    int main()
    {
    	
    	using namespace std;
    	string name;
    	cout << "What is your name? ";
    	cin >> name;
    	cout << "Hello " << name << endl;
    	return 0;
    }
    I compile code with:
    Visual Studio.NET beta2

  3. #3
    Unregistered
    Guest
    thanks!

  4. #4
    Unregistered
    Guest
    ok i copied and pasted it in my thing and i get an error what do i do now? sorry i'm a newbie ; )

  5. #5
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    Code:
    #include <iostream>
    #include <string>
    
    using namespace std;
    
    int main()
    {
        
        
        string name;
        cout << "What is your name? ";
        cin >> name;
        cout << "Hello " << name << endl;
        return 0;
    }
    

  6. #6
    Unregistered
    Guest
    ok thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Possibly simple question
    By PAragonxd in forum C++ Programming
    Replies: 1
    Last Post: 09-14-2008, 02:43 AM
  2. Replies: 16
    Last Post: 09-30-2007, 11:08 PM
  3. Problem with simple XOR program
    By spike_ in forum C++ Programming
    Replies: 8
    Last Post: 08-17-2005, 12:09 AM
  4. Mystery bug in simple program? - I am beginner
    By archie123 in forum C++ Programming
    Replies: 7
    Last Post: 04-08-2005, 07:23 AM
  5. question about the loop in case conversion program
    By Elhaz in forum C++ Programming
    Replies: 8
    Last Post: 09-20-2004, 04:06 PM