I have the following three short codes with their outputs. I am seeking clarifications as to how the output was come to. Any explanations are welcome. Thanks in advance.
Output: BAMOCode:include <iostream> using namespace std; int main() { char str[] = "ABKALM!OV"; for (int m=1; str[m]; m=m+2) cout << str[m]; return 0; }
Output: 12468Code:include <iostream> using namespace std; int main() { int arr[] = {1,2,3,4,5}; for (int m=4; m; m=m-1) arr[m] = arr[m-1] + m; for (int m=0; m<5; m=m+1) cout << arr[m]; }
Output: UDNHOPPLAUNDCode:include <iostream> using namespace std; int main() { char arr[]="UND"; try { for (int m=0; arr[m]; m=m+1) { cout << arr[m]; if (arr[m]=='N') throw 3; cout << arr[m+2]; } } catch (…) { cout << "HOPPLA"; } cout << arr; return 0; }



LinkBack URL
About LinkBacks


