Thread: Newbie

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Apr 2004
    Posts
    19
    Isnt he forgeting to #include <string.h>?

    Well I am new as well but you would put that if you wanted the user to input something with spaces for example

    Code:
    #include <string.h>
    #include <iostream.h>
    
    int main()
    {
         char userName[25]="";
    
              cout<<"Hello, enter your name ";
              cin.getline(userName,25);
    
              cout<<"Hello, "<<userName<<endl;
         return 0;
    }
    errr sorry I think I have complicated it up a bit, and in doing so I forgot the question...enjoy.
    jotun

    n : (Norse mythology) one of a race of giants often in conflict with the Aesir [syn: Jotun, Jotunn]

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >Isnt he forgeting to #include <string.h>?
    None of the code posted previously has used anything from <string.h> (which should be <cstring> to be correct C++).

    >if you wanted the user to input something with spaces for example
    Well, yes. That's correct. However, both your code and your post have no bearing on the question, which is most likely an incorrect installation of the compiler.
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. getting to grips with allegro and ms vc++ (newbie)
    By jimjamjahaa in forum C++ Programming
    Replies: 4
    Last Post: 11-18-2005, 07:49 PM
  2. Newbie in problem with looping
    By nrain in forum C Programming
    Replies: 6
    Last Post: 11-05-2005, 12:53 PM
  3. Newbie Programmer
    By Extropian in forum C++ Programming
    Replies: 3
    Last Post: 05-18-2004, 01:17 PM
  4. Some help for a newbie?
    By Ilmater in forum C++ Programming
    Replies: 23
    Last Post: 04-19-2004, 07:44 PM
  5. Newbie Game Develpoers Unite!
    By Telenosis in forum Game Programming
    Replies: 10
    Last Post: 06-22-2002, 02:02 PM