extracting info to another array

Thread Solved
Reply

Join Date: Mar 2007
Posts: 144
Reputation: mrjoli021 is an unknown quantity at this point 
Solved Threads: 0
mrjoli021 mrjoli021 is offline Offline
Junior Poster

extracting info to another array

 
0
  #1
Mar 4th, 2008
I have some sentences in a 2 dimensional char array. I need to change to first letter of each sentence to caps. I was thinking of removing the first char and placing it into 1 array and the rest of the sentence into another array. run toupper on the first array and then print them both out. my question is how do I populate 1 array to the other??
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,142
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1434
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: extracting info to another array

 
0
  #2
Mar 4th, 2008
why use two different character arrays when you can do it directly in the original, assuming the original is not string literals
  1. char str[] "hello world";
  2. str[0] = toupper(str[0]);
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 144
Reputation: mrjoli021 is an unknown quantity at this point 
Solved Threads: 0
mrjoli021 mrjoli021 is offline Offline
Junior Poster

Re: extracting info to another array

 
0
  #3
Mar 4th, 2008
ok so now how do I print the entire sentence.

  1. int i;
  2.  
  3. for (i = 0; i < FIindex; i++)
  4. {
  5. fragments[i][0] = toupper(fragments[i][0]);
  6. std::cout << fragments << endl;
  7. }
Last edited by Ancient Dragon; Mar 4th, 2008 at 7:00 pm. Reason: correct code tags -- use /code not \code
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 144
Reputation: mrjoli021 is an unknown quantity at this point 
Solved Threads: 0
mrjoli021 mrjoli021 is offline Offline
Junior Poster

Re: extracting info to another array

 
0
  #4
Mar 4th, 2008
go it working.

thanks
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,142
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1434
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: extracting info to another array

 
0
  #5
Mar 4th, 2008
>>std::cout << fragments << endl;

should be this:
std::cout << fragments[i] << endl;
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC