Author Question: What is the output of the following code segment? int x = 5;if (x = 2) cout (Read 19 times)

stephzh

  • Hero Member
  • *****
  • Posts: 556
What is the output of the following code segment?
int x = 5;
if (x = 2)
    cout << "This is true!" << endl;
else
    cout << "This is false!" << endl;
    cout << "That's all, folks!" << endl;

This is true!
That's all folks

This is false!
That's all, folks

This is true!
This is false!
That's all, folks!

This is true!
This is false!


fromAlphatoOmega22

  • Sr. Member
  • ****
  • Posts: 345
This is true!
That's all folks



Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
 

Did you know?

Every flu season is different, and even healthy people can get extremely sick from the flu, as well as spread it to others. The flu season can begin as early as October and last as late as May. Every person over six months of age should get an annual flu vaccine. The vaccine cannot cause you to get influenza, but in some seasons, may not be completely able to prevent you from acquiring influenza due to changes in causative viruses. The viruses in the flu shot are killed—there is no way they can give you the flu. Minor side effects include soreness, redness, or swelling where the shot was given. It is possible to develop a slight fever, and body aches, but these are simply signs that the body is responding to the vaccine and making itself ready to fight off the influenza virus should you come in contact with it.

Did you know?

Eating carrots will improve your eyesight. Carrots are high in vitamin A (retinol), which is essential for good vision. It can also be found in milk, cheese, egg yolks, and liver.

Did you know?

Of the estimated 2 million heroin users in the United States, 600,000–800,000 are considered hardcore addicts. Heroin addiction is considered to be one of the hardest addictions to recover from.

Did you know?

Only 12 hours after an egg cell is fertilized by a sperm cell, the egg cell starts to divide. As it continues to divide, it moves along the fallopian tube toward the uterus at about 1 inch per day.

Did you know?

About 100 new prescription or over-the-counter drugs come into the U.S. market every year.

For a complete list of videos, visit our video library