Show the output of the following codes:   i. #include using namespace std;   int main() { int x1, x2, i, j, k, y, z; float f; x1 = 1; x2 = 1; y = 5 + x1--; z = 5 + ++x2; i = 6 % 4; j = 1; j += j + 3; k = 25 / 2; f = (float)((2 / 5) * k);   cout << "x1 is " << x1 << endl; cout << "x2 is " << x2 << endl; cout << "i is " << i << endl; cout << "j is " << j << endl; cout << "k is " << k << endl; cout << "y is " << y << endl; cout << "z is " << z << endl; cout << "f is " << f;   return 0; }     ii.   #include using namespace std; int main() {   cout<< "9.3 * 12 / 6 – 7.6 is "; cout<< 9.3 * 12/6 – 7.6;   return 0; }   iii.   #include using namespace std;   int main() {   double a = 6.5; a += a + 1; cout<< a << endl; a = 6; a /=2;   cout<< a << endl; return 0; }

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 1TF
icon
Related questions
icon
Concept explainers
Question

Show the output of the following codes:

 

i.

#include <iostream> using namespace std;

 

int main()

{

int x1, x2, i, j, k, y, z; float f;

x1 = 1;

x2 = 1;

y = 5 + x1--; z = 5 + ++x2; i = 6 % 4;

j = 1;

j += j + 3; k = 25 / 2;

f = (float)((2 / 5) * k);

 

cout << "x1 is " << x1 << endl; cout << "x2 is " << x2 << endl; cout << "i is " << i << endl; cout << "j is " << j << endl; cout << "k is " << k << endl; cout << "y is " << y << endl; cout << "z is " << z << endl; cout << "f is " << f;

 

return 0;

}

 

 

ii.

 

#include <iostream> using namespace std;

int main()

{

 

cout<< "9.3 * 12 / 6 – 7.6 is ";

cout<< 9.3 * 12/6 – 7.6;

 

return 0;

}

 

iii.

 

#include <iostream> using namespace std;

 

int main()

{

 

double a = 6.5; a += a + 1;

cout<< a << endl; a = 6;

a /=2;

 

cout<< a << endl; return 0;

}

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Control Structure
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr