Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
enum cat {
4.
temp = 7
5.
};
6.
int main()
7.
{
8.
int age = 14;
9.
age /= temp;
10.
cout
Options:
A .  If you were cat, you would be 5
B .  If you were cat, you would be 2
C .  If you were cat, you would be 7
D .  none of the mentioned
Answer: Option B

The age will be divided by using compound assignment operator and so it will return the age of the 

cat according to your age.
$ g++ enum1.cpp
$ a.out
If you were cat, you would be 2



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers