Question
What will the following programs print on the screen?
A)
#include <iostream>
using namespace std;
int main()
{
int freeze = 32, boil = 212;
freeze = 0;
boil = 100;
cout << freeze << endl << boil << endl;
return 0;
}
B)
#include <iostream>
using namespace std;
int main()
{
int x = 0, y = 2;
x = y * 4;
cout << x << endl << y << endl;
return 0;
}
C)
#include <iostream>
using namespace std;
int main()
{
cout << "I am the incredible";
cout << "computing\nmachine";
cout << "\nand I will\namaze\n";
cout << "you.\n";
return 0;
}
Solutions
VerifiedSolution A
Solution B
Answered 1 year ago
Step 1
1 of 2(A)
freeze= 32, boil = 212;
freeze = 0;
boil = 100 ;
freeze endl boil endl ;
The output for (A):
0
100
(B)
x=0, y= 2;
; $\text{\textcolor{#c34632}{value assigned to x is updated to }}$
x endl y endl ;
The output for (B):
8
2
(C) Since n is newline escape character it jumps to a new line.
The output for (C):
I am the incrediblecomputing
machine
and I will
amaze
you.
Answered 1 year ago
A) This program will print latest values of freeze and boil in separate lines.
That is
0
100
B) This program will print following
8
2
C) This program will print following
I am incrediblecomputing
machine
and I will
amaze
you.
Create an account to view solutions
By signing up, you accept Quizlet's Terms of Service and Privacy Policy
Create an account to view solutions
By signing up, you accept Quizlet's Terms of Service and Privacy Policy