Hello, I have an exam on wednesday and was given a practice exam but I'm having a little a bit of trouble.
8.What will be displayed on the screen after the following statements are executed in a C++ program?
int a=5, b=2, c=1, d=3;
int t;
if(a>b){
t=a;
a=b;
b=t;
}
if(b>c){
t=b;
b=c;
c=t;
}
if(c>d){
t=c;
c=d;
d=t;
}
cout<<a<<" "<<b<<" "<<c<<" "<<d<<endl
my answer: cout<<a<<"2"<<b<<"1"<<
My question is what happens when the statement fails? Would c output 1 and d output 3?
Thanks for the help.