Answer to Question #219312 in C++ for kwame

Question #219312

Using the code stub below, output all combinations of character variables a, b, and c, in the order shown below. If a = 'x', b = 'y', and c = 'z', then the output is: xyz xzy yxz yzx zxy zyx

Your code will be tested in three different programs, with a, b, c assigned with 'x', 'y', 'z', then with '#', '$', '%', then with '1', '2', '3’.


#include

using namespace std;


int main() {

char a;

char b;

char c;


cin >> a;

cin >> b;

cin >> c;


/* Your solution goes here */


cout << endl;


return 0;

}


1
Expert's answer
2021-07-23T17:31:16-0400
#include <iostream>


using namespace std;


int main() {
	char a;
	char b;
	char c;
	cin >> a;
	cin >> b
	cin >> c;

	/* Your solution goes here */
	cout << a << b << c << " ";
	cout << a << c << b << " ";
	cout << b << a << c << " ";
	cout << b << c << a << " ";
	cout << c << a << b << " ";
	cout << c << b << a << " ";
	cout << endl;
	
	return 0;


}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS