Thread: string of women (names)

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    8

    Question string of women (names)

    Code:
    Hi All,
    
    I've got a few lines of code 
    
    - void getinfo(char &, char &, string &, string &, int);
    - int getmove(char [], string);
    - string name1, name2;
    
    which use <string> header, but my compiler can only use <string.h> so these lines don't work properly
    i.e. name1 and name2 came out as single character instead of Michelle, or Gwen for example. 
    
    So how do I replace string to make the prog work on my compiler?
    
    Many thanks for your help and advice.

  2. #2
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    char name1[256], name2[256];

  3. #3
    Registered User
    Join Date
    Sep 2002
    Posts
    1,640
    Originally posted by RoD
    char name1[256], name2[256];
    You can better make it dynamic

    Code:
     char name1[];
     char name2[];

  4. #4
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    good point, it would be better that way.

  5. #5
    Registered User abrege's Avatar
    Join Date
    Nov 2002
    Posts
    369
    a multidimensional array

    Code:
    char names[][256];
    I am against the teaching of evolution in schools. I am also against widespread
    literacy and the refrigeration of food.

  6. #6
    samurai warrior nextus's Avatar
    Join Date
    Nov 2001
    Posts
    196
    pointer to chars! (dynamic memory allocation)...after all strings are nothing but a char array..am i right :P
    nextus, the samurai warrior

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Inheritance Hierarchy for a Package class
    By twickre in forum C++ Programming
    Replies: 7
    Last Post: 12-08-2007, 04:13 PM
  2. Linked List Help
    By CJ7Mudrover in forum C Programming
    Replies: 9
    Last Post: 03-10-2004, 10:33 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. Gender Humour Thread
    By stevey in forum A Brief History of Cprogramming.com
    Replies: 39
    Last Post: 06-01-2002, 01:12 PM