Question: q19) CONSIDER THE FOLLOWING CODE: void Question() { string x = 12; mystery1(x); string str1 = 21; mystery2(str1); string str2 = 11; mystery2(str2); string str3
q19)
CONSIDER THE FOLLOWING CODE: void Question() { string x = "12"; mystery1(x); string str1 = "21"; mystery2(str1); string str2 = "11"; mystery2(str2); string str3 = "31"; mystery2(str3); string str4 = "91"; mystery2(str4); string str5 = "81"; mystery1(str5); x = x + str1 + str2 + str3 + str4 + str5; cout << x; } //////////////////////////////////////////////////////////// void mystery1(string &a) { int num = a.length(); string temp; for (int i = 0 ; i < num ; i++) { temp = a.at(i) + temp; } a = temp; } //////////////////////////////////////////////////////////// void mystery2(string &b) { int num = b.length(); string temp =""; for (int i = 0; i < num; i++) { if(b.at(i) == '1') temp = temp + b.at(i); } b = temp; }
Select one:
a. 122111319181
b. 21329181
c. 211111118
d. 123181
please explain how you get the answer. Thank you
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
