String Arrays

Reply

Join Date: Feb 2007
Posts: 3
Reputation: matt91turbo is an unknown quantity at this point 
Solved Threads: 0
matt91turbo matt91turbo is offline Offline
Newbie Poster

String Arrays

 
0
  #1
Nov 13th, 2008
I need a little help to get me going on how to start this program.

I know how to create a string array, but I'm having trouble getting the overall structure for this program. Any help or links to helpful sites would be appreciated.

Write a program that will read a paragraph into an array. Each word should then be stored in a pointer array. Punctuation characters should be ignored. Using the pointer array, print the words out in the original order, reverse order and backwards. Without using any C++ library string functions, print the number of letters in each word. Also keep track of the number of words read, the length of the longest word, the length of the shortest word and number of times each word length occurred.
The screen should pause after each section of output. Label your output. The maximum length of the paragraph should be 256 characters (or the size of your input buffer).The pointer array should be large enough to handle 20 words.
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 1,028
Reputation: MosaicFuneral is just really nice MosaicFuneral is just really nice MosaicFuneral is just really nice MosaicFuneral is just really nice MosaicFuneral is just really nice 
Solved Threads: 94
MosaicFuneral's Avatar
MosaicFuneral MosaicFuneral is online now Online
Veteran Poster

Re: String Arrays

 
0
  #2
Nov 13th, 2008
Everything for using C-style strings is in string.h
Here's a reference:
http://www.cplusplus.com/reference/clibrary/cstring/
"Jedenfalls bin ich überzeugt, daß der Alte nicht würfelt."
"I became very sensitive to what will happen to all this and all of us." -Two geniuses named Albert
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 1,820
Reputation: vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold vmanes is a splendid one to behold 
Solved Threads: 213
vmanes's Avatar
vmanes vmanes is offline Offline
Posting Virtuoso

Re: String Arrays

 
0
  #3
Nov 14th, 2008
It looks like you are supposed to read the entire text into one array, max size 256. Then, pull each word out, storing to a dynamically allocated array of strings (char ** ). You will have to find the length of each word, or at least the length of the longest word, in order to allocate the string arrays, before storing the individual words. Be sure to place null terminators at the end of each word as you store them.

From that point, it's just the easy stuff that's left.
Don't own a gun but I'm going to join the NRA.
I figure anything that irritates liberals is worth my support.
~~~~~~~~~~~~~~~~~~
Looking for an exciting graduate degree? Robotics and Intelligent Autonomous Systems (RIAS) at SDSM&T See the program brochure here.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 890 | Replies: 2
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2010 DaniWeb® LLC