I just need help with the finishing touches

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Apr 2008
Posts: 4
Reputation: WilliamBaxter is an unknown quantity at this point 
Solved Threads: 0
WilliamBaxter WilliamBaxter is offline Offline
Newbie Poster

I just need help with the finishing touches

 
-1
  #1
Apr 11th, 2008
I have done this based on the other post ....... all I need is too arrange the words entered
first the biggest word , then the smallest word and then the remaining word
please do tell me what ad to this





  1. #include <iostream>
  2.  
  3. #include <vector>
  4. #include <string>
  5. #include <algorithm>
  6. using namespace std;
  7. int main()
  8.  
  9. {
  10. std:string str, str2, str3;
  11. std::cin >> str;
  12. std::cin >> str2;
  13. std::cin >> str3;
  14. std::cout<<str.length()<<std::endl;
  15. std::cout<<str2.length()<<std::endl;
  16. std::cout<<str3.length()<<std::endl;
  17. std::vector<std::string> strarray[3];
  18. system ("pause");
  19. return 0;
  20.  
  21. }
Last edited by Ancient Dragon; Apr 11th, 2008 at 10:12 am. Reason: add code tags
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 2,879
Reputation: niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute 
Solved Threads: 301
Moderator
Featured Poster
niek_e's Avatar
niek_e niek_e is offline Offline
Cenosillicaphobiac

Re: I just need help with the finishing touches

 
0
  #2
Apr 11th, 2008
Why did you open another thread with the same question as before?

[edit] Only this time you stole the code from someone else
Last edited by niek_e; Apr 11th, 2008 at 10:20 am.
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 4
Reputation: WilliamBaxter is an unknown quantity at this point 
Solved Threads: 0
WilliamBaxter WilliamBaxter is offline Offline
Newbie Poster

Re: I just need help with the finishing touches

 
0
  #3
Apr 11th, 2008
Originally Posted by niek_e View Post
Why did you open another thread with the same question as before?

[edit] Only this time you stole the code from someone else


hey i no i am using the other post but its incomplete .... as I said I need to Arrange the biggest word first and then smallest word and the remaining word
I cant sem to d it
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 2,879
Reputation: niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute niek_e has a reputation beyond repute 
Solved Threads: 301
Moderator
Featured Poster
niek_e's Avatar
niek_e niek_e is offline Offline
Cenosillicaphobiac

Re: I just need help with the finishing touches

 
0
  #4
Apr 11th, 2008
Apparently not. Did you even try?
So far you have showed us 2 snippets of code that were written by someone else.
The rules here on Daniweb state that you will not receive homework-help unless you show some effort.

So what did YOU try so far, or what part are you having trouble with?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,445
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: 1475
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: I just need help with the finishing touches

 
0
  #5
Apr 11th, 2008
put the longest string in strarray[0], the shortest in strarray[1] and the third string in strarray[2]. Then you can easily print each of the three strings in order they appear in that array.

How do you find out which string is the longest? Here is an example
  1. std::string shortest, longest, other;
  2. longest = str;
  3. if( str1.length() > longest.length() )
  4. longest = str1;
  5. if(str2.length() > longest.length() )
  6. longest = str2;
  7. // now make the same tests for shortest
Last edited by Ancient Dragon; Apr 11th, 2008 at 10:38 am.
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 is more than three months old.
Perhaps start a new thread instead?
Message:



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