| | |
String Arrays
![]() |
•
•
Join Date: Feb 2007
Posts: 3
Reputation:
Solved Threads: 0
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.
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.
Everything for using C-style strings is in string.h
Here's a reference:
http://www.cplusplus.com/reference/clibrary/cstring/
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
"I became very sensitive to what will happen to all this and all of us." -Two geniuses named Albert
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.
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.
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.
![]() |
Similar Threads
- Trying to figure out how to change a couple string Arrays to Boolean arrays.. (Java)
- Switch Statement with String (C++)
- string array size (C++)
- Reverse string arrays (C)
- Declaring string array, initializing later... (C++)
- Please help me with arrays (C++)
- pls i need help in this simple program of arrays... (C)
Other Threads in the C++ Forum
- Previous Thread: Could I possibly do this?
- Next Thread: Getting a weird error
Views: 890 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for C++
6 algorithm array arrays assignment beginner binary c++ c/c++ calculator char class classes code command compile compiler console constructor conversion convert count data delete desktop display dll dynamic encryption error exception file files fstream function functions game givemetehcodez graph gui homework http iamthwee ifstream input int lazy linker list loop looping loops math matrix memory newbie number object objects opengl output parameter pointer pointers problem program programming project random read recursion recursive reference return simple sort spoonfeeding string strings struct student studio system template templates text time tree variable vc++ vector video visual void win32 window windows winsock wxwidgets xml






