Hello, i would like to know how this program is being trace step by step.
i know the first thing that will be print is
output
first 3 5
second after that i am lost on what to do
#include <iostream>
using namespace std;
int main()
{
int e = 3, f = 5;
cout << "first: " << e
<< " " << f << endl;
while (e <= 4) {
e = f + 1;
f = e + 2;
if (e <= 5)
f = f + 10;
else
e = e - 2;
cout << "second: " << e
<< " " << f << endl;
cout << "enter the next 2 values" << endl;
cin >> e;
cin >> f;
cout << "third: " << e
<< " " << f << endl;
}
cout << "fourth: " << e
<< " " << f << endl;
return 0;
}
#include <iostream>
usingnamespace std;
int main()
{
int e = 3, f = 5;
cout << "first: " << e
<< " " << f << endl;
while (e <= 4) {//3 < 4 so the loop is entered
e = f + 1;// e = 5+1 = 6
f = e + 2;// f = 6+2 = 8
if (e <= 5)//6 is not <= 5
f = f + 10;
else//,thus
e = e - 2; //e = 6-2=4
cout << "second: " << e//4
<< " " << f << endl;//8
cout << "enter the next 2 values" << endl;
cin >> e;
cin >> f;
cout << "third: " << e
<< " " << f << endl;
}
cout << "fourth: " << e
<< " " << f << endl;
return 0;
}