Thread: how can i place a string in an array??

  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,138
    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, 05:45 PM
  2. Message class ** Need help befor 12am tonight**
    By TransformedBG in forum C++ Programming
    Replies: 1
    Last Post: 11-29-2006, 11: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-27-2003, 12:03 AM
  5. Warnings, warnings, warnings?
    By spentdome in forum C Programming
    Replies: 25
    Last Post: 05-27-2002, 06:49 PM