cpp prints I love Computer Science! 10 times. Copy it to your directory and add code as directed to get the while loop working.

values-and-ethics-reflection-paper-outside-sources-are-not-required
September 9, 2020
statistics-homework-20
September 9, 2020

cpp prints I love Computer Science! 10 times. Copy it to your directory and add code as directed to get the while loop working.

I need help with Counting and Looping

The program in lab8.cpp prints

“I love Computer Science!!” 10 times.

1. Copy it to your directory and add code as directed to get the while loop working.

2. Once the program is compiling and running, modify it as follows:

•Instead of using constant LIMIT, ask the user how many times the message should be printed. You will need to declare a variable (e.g.int numTimes) to store the user’s response and use that variable to control the loop. (Remember that all caps is used only for constants!)

•Number each line in the output, and add a message at the end of the loop that says how

many times the message was printed.

// ****************************************************************

//lab8.cpp

//

// Use a while loop to print many messages declaring your

// passion for computer science

// ****************************************************************

#include<iostream>

using namespace std;

int main{

// *** Step 2: I need to Create an int called numTimes

// *** Step 2: Get rid of this, prompt the user for numTimes instead const

int LIMIT = 10;

int count = 1;

// *** Step 2: Change this to check if count is <= numTimes

while(count <= LIMIT)

{

// *** Step 2: Change this line to output count before the phrase

cout<<I love Computer Science!!”<<endl

;

// *** Step 1: Increment count (hint: use the ++ operator)

}

// *** Step 2: Output the “Printed this message…” line

}

}

Here’s an example of how the program should look when it’s all finished. Bold, bracketed text stands for user input.

How many times should I print? [3]

1 I love Computer Science!!

2 I love Computer Science!!

3 I love Computer Science!!

Printed this message 3 times.

Thanks for installing the Bottom of every post plugin by Corey Salzano. Contact me if you need custom WordPress plugins or website design.

The post cpp prints I love Computer Science! 10 times. Copy it to your directory and add code as directed to get the while loop working. first appeared on Submit Your Homeworks.


cpp prints I love Computer Science! 10 times. Copy it to your directory and add code as directed to get the while loop working. was first posted on September 9, 2020 at 8:28 pm.
©2019 "Submit Your Assignment". Use of this feed is for personal non-commercial use only. If you are not reading this article in your feed reader, then the site is guilty of copyright infringement. Please contact me at support@termpaperswriter.com

 

"Is this question part of your assignment? We Can Help!"

Essay Writing Service