1.

What is the output of this program?
#include <iostream>
#include <string>
using namespace std;
void PermutationString( string& orig, string& Permutation )
{
if (orig.empty())
{
cout << Permutation << endl;
return;
}
for (int k = 0; k < orig.size(); ++k)
{
string orig2 = orig;
orig2.erase(k, 1);
string Permutation2 = Permutation;
Permutation2 += orig.at(k);
PermutationString(orig2, Permutation2);
}
}
int main()
{
string orig = "Sumi";
string Permutation;
PermutationString(orig, Permutation);
return 0;
}

A. Sumi
B. imus
C. suim
D. returns all the combination of Sumi
E. None of these
Answer» E. None of these


Discussion

No Comment Found

Related MCQs