| | |
I just need help with the finishing touches
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Apr 2008
Posts: 4
Reputation:
Solved Threads: 0
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
first the biggest word , then the smallest word and then the remaining word
please do tell me what ad to this
C++ Syntax (Toggle Plain Text)
#include <iostream> #include <vector> #include <string> #include <algorithm> using namespace std; int main() { std:string str, str2, str3; std::cin >> str; std::cin >> str2; std::cin >> str3; std::cout<<str.length()<<std::endl; std::cout<<str2.length()<<std::endl; std::cout<<str3.length()<<std::endl; std::vector<std::string> strarray[3]; system ("pause"); return 0; }
Last edited by Ancient Dragon; Apr 11th, 2008 at 10:12 am. Reason: add code tags
Why did you open another thread with the same question as before?
[edit] Only this time you stole the code from someone else
[edit] Only this time you stole the code from someone else
Last edited by niek_e; Apr 11th, 2008 at 10:20 am.
•
•
Join Date: Apr 2008
Posts: 4
Reputation:
Solved Threads: 0
•
•
•
•
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
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?
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?
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
How do you find out which string is the longest? Here is an example
C++ Syntax (Toggle Plain Text)
std::string shortest, longest, other; longest = str; if( str1.length() > longest.length() ) longest = str1; if(str2.length() > longest.length() ) longest = str2; // 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.
![]() |
Other Threads in the C++ Forum
- Previous Thread: array errors
- Next Thread: pixel information from an image
| Thread Tools | Search this Thread |
api array arrays beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion convert count data database delete desktop developer directshow dll download dynamic encryption error file forms fstream function functions game generator getline givemetehcodez google graph gui homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux loop looping loops map math matrix memory multiple news node number output parameter pointer problem program programming project proxy python random read recursion recursive return string strings struct temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






