C++ problem

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Nov 2008
Posts: 5
Reputation: chchiu is an unknown quantity at this point 
Solved Threads: 0
chchiu chchiu is offline Offline
Newbie Poster

C++ problem

 
0
  #1
Nov 30th, 2008
can someone help me to slove this using c++ please.
Last edited by chchiu; Nov 30th, 2008 at 10:08 am.
Attached Thumbnails
task.png  
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 488
Reputation: Bench has a spectacular aura about Bench has a spectacular aura about Bench has a spectacular aura about 
Solved Threads: 49
Bench's Avatar
Bench Bench is offline Offline
Posting Pro in Training

Re: C++ problem

 
0
  #2
Nov 30th, 2008
Noone will spoonfeed you any solutions. have a good attempt at the problem for yourself and come back if you get stuck on anything along with a description of whatever it is you need help with, and the code you've tried so far.
¿umop apisdn upside down?
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 5
Reputation: chchiu is an unknown quantity at this point 
Solved Threads: 0
chchiu chchiu is offline Offline
Newbie Poster

Re: C++ problem

 
0
  #3
Nov 30th, 2008
How should i begin??
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,413
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: 1470
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: C++ problem

 
0
  #4
Nov 30th, 2008
There are a couple approaches in c++ language:

1) if input is in the form of a std::string object, you can use it's find() method to determine if it contains any of the words, example:
  1. std::string input;
  2. cout << "Enter a word\n";
  3. cin >> input;
  4. if( input.find("ONE") != std::npos)
  5. {
  6. // found it.
  7. }

2) The other way, using standard C style character arrays
  1. char input[20];
  2. cout << "Enter word\n";
  3. cin >> input;
  4. if( strstr(input,"ONE") != NULL)
  5. {
  6. // found it
  7. }

Now if course you will have to change the above to check each of the words listed in your assignment, as well as all the other requirements which I did not mention.

And don't forget to include the appropriage header files.
Last edited by Ancient Dragon; Nov 30th, 2008 at 12:36 pm.
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: Nov 2008
Posts: 5
Reputation: chchiu is an unknown quantity at this point 
Solved Threads: 0
chchiu chchiu is offline Offline
Newbie Poster

Re: C++ problem

 
0
  #5
Nov 30th, 2008
I really don't know how to code it....could you help me...Please x10000. I have to hand it in soon. I will remember you forever! Please help me!
Last edited by chchiu; Nov 30th, 2008 at 1:52 pm.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 182
Reputation: mrboolf will become famous soon enough mrboolf will become famous soon enough 
Solved Threads: 18
mrboolf mrboolf is offline Offline
Junior Poster

Re: C++ problem

 
1
  #6
Nov 30th, 2008
I will remember you forever!
Seriously, how much do you think we care? Moreover, I hardly think so. I'm pretty sure that you won't hold gratitude or appreciation soon after you'll hand that assignment. Not that I'd pay a penny for you being eternally grateful to me.

Ancient Dragon already gave you a start. I'm feeling to give you just some general advices:

1 - Divide your program in steps - most common are input, processing and output but you can elaborate this further
2 - Write one step at a time, for example begin with a program that only accepts one string input and quits. Then try to solve the problem for simplest cases (i.e. the user enters "one" or "nine").
3 - Post your code. We will gladly help you (not for the glory, however) if you show us you do care enough. When I ask for help I think that the time of people more expert than me is more precious than mine. Consequently, I have to devote more time than they do in solving my problem. If I don't act this way, I won't learn anything. Try to think this way and you'll be surely helped.

Regards
Reply With Quote Quick reply to this message  
Reply

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



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



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

©2003 - 2009 DaniWeb® LLC