enter 3 srings.The program outputs the 6 permutation of those strings. When i run my progr. permutation appears scattered. I want the permuations to appear like this
abc
cba
bca (in order)
my program:
**************************************...
This program outputs the six permutations of a string
**************************************...
#include %26lt;iostream%26gt;
#include %26lt;string%26gt;
using namespace std;
int main()
{
string word1;
string word2;
string word3;
cout %26lt;%26lt; "Enter a word: ";
cin %26gt;%26gt; word1;
cout %26lt;%26lt; "Enter a second word: ";
cin %26gt;%26gt; word2;
cout %26lt;%26lt; "Enter a third word: ";
cin %26gt;%26gt; word3;
cout %26lt;%26lt; "The permutation of the words you enter are: " %26lt;%26lt; endl;
cout %26lt;%26lt; word3 %26lt;%26lt; word2 %26lt;%26lt; word1 %26lt;%26lt;endl;
cout %26lt;%26lt; word2 %26lt;%26lt; word1 %26lt;%26lt; word3 %26lt;%26lt;endl;
cout %26lt;%26lt; word1 %26lt;%26lt; word3 %26lt;%26lt; word2 %26lt;%26lt;endl;
cout %26lt;%26lt; word3 %26lt;%26lt; word1 %26lt;%26lt; word2 %26lt;%26lt;endl;
cout %26lt;%26lt; word1 %26lt;%26lt; word3 %26lt;%26lt; word2 %26lt;%26lt;endl;
cout %26lt;%26lt; word3 %26lt;%26lt; word1 %26lt;%26lt; word2 %26lt;%26lt;endl;
return o;
}
Help me with a C++ program that I have created. the assignment: write a program that promts the user to?
1'st tell me in which standard u r,bcoz i am also having c++.i want 2 know ur level 1'st tan may b i can help u.
forsythia
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment