C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 10th, 2004, 11:25 AM
mak 23 mak 23 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 1 mak 23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
confused how to do this program

i am confused as to how to do this problem. i am takin a cpsc 140 class and i need to finish this assignment to graduate...please someone help me!! i just need help getting started

Write a C++ program that reads in an unknown number of characters from the a text file, count the number of words, and print each word in reverse to the screen.
Words are delimited by blanks, tabs, newlines and the end of file. Note that mulitple whitespace characters should only count one word. Hint: You can use the get method to enter whitespace

Reply With Quote
  #2  
Old December 10th, 2004, 07:52 PM
marmo marmo is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 37 marmo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 15 m 20 sec
Reputation Power: 4
There is similar postings in this forum. One way you can do it is to open the file using an istream object, and read it into a string . Use the member functions of the string class to format text. Here is a link to the string class description http://www.msoe.edu/eecs/ce/courseinfo/stl/string.htm
Use the find method to look for whitespace, and use the reverse algorithm found in the <algorithm> library to reverse the words. I will leave the finer details to you.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > confused how to do this program


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway