how can i place a string in an array??

This is a discussion on how can i place a string in an array?? within the C++ Programming forums, part of the General Programming Boards category; i have a cin.getline string that i want to place in an array. wut do i need to do ??if ...

  1. #1
    adventurer
    Guest

    Arrow how can i place a string in an array??

    i have a cin.getline string that i want to place in an array. wut do i need to do ??if u know. plz tell me wut to add to the code i have.

    Code:
    void newperson ()
    {
    	int count, numppl;
    	cout<<"How many people do you want to introduce?"<<endl;
    	cin>>numppl;
    	for (count=0 ; count <=numppl ; count=count +1)
    	{
    		cin.getline (input, 50);
    		
    	}
    	
    }
    thx.

  2. #2
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    string* array=new string[numppl]

    /*EDIT*/ Don't forget delete [] array when done /*EDIT*/
    Last edited by golfinguy4; 04-27-2002 at 06:34 PM.

  3. #3
    adventurer
    Guest

    Question

    hmm. im still puzzled. any1 else have another idea.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 04:45 PM
  2. Message class ** Need help befor 12am tonight**
    By TransformedBG in forum C++ Programming
    Replies: 1
    Last Post: 11-29-2006, 10:03 PM
  3. Quick question about SIGSEGV
    By Cikotic in forum C Programming
    Replies: 30
    Last Post: 07-01-2004, 07:48 PM
  4. lvp string...
    By Magma in forum C++ Programming
    Replies: 4
    Last Post: 02-26-2003, 11:03 PM
  5. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 06:49 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21