Author Question: What will the following code display?int x = 0;while (x < 5){ cout (Read 59 times)

Beheh

  • Hero Member
  • *****
  • Posts: 520
What will the following code display?
int x = 0;
while (x < 5)
{
    cout << x << " ";
    x++;
}

0 1 2 3 4
0 1 2 3 4 5
0
1
2
3
4

◦ This is an infinite loop


nanny

  • Sr. Member
  • ****
  • Posts: 313

Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
 

Did you know?

Alcohol acts as a diuretic. Eight ounces of water is needed to metabolize just 1 ounce of alcohol.

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?

Sperm cells are so tiny that 400 to 500 million (400,000,000–500,000,000) of them fit onto 1 tsp.

Did you know?

Fewer than 10% of babies are born on their exact due dates, 50% are born within 1 week of the due date, and 90% are born within 2 weeks of the date.

Did you know?

The immune system needs 9.5 hours of sleep in total darkness to recharge completely.

For a complete list of videos, visit our video library