Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CSCI 14-02 Lab Assigament 4 15 Points, Due 3/12/2019 For Loop All programming languages have a one or more lines ofcoeoop capability. Looping is the

image text in transcribed
CSCI 14-02 Lab Assigament 4 15 Points, Due 3/12/2019 For Loop All programming languages have a one or more lines ofcoeoop capability. Looping is the program logic's ability to repeat A set number of times, a "for loop"Ge. 10, 100, 500, 763 or more times) 2.An "unknown" number of times (i.e. loop terminates if a tested condition becomes "true" or as ong as the tested condition remains "false"), a ""while" loop, a "do until" loop, a "do while" loop. This Lab exercise demonstrates the use of the "For Leop", a standard loop in all programming languages. C++ standard For Loop format looks like: For (n 1; n100; n+) Loop line 1 code; Loop line 2 code; Loop line 3 code; Loop line N code; The loop code needs: 1. A "loo p counter variable" (n in the above example) to keep track of how many iterations this loop has run 3. A stop test Ge, run as long as the loop counter variable is 100 or less in the above example) The loop will start at 1 and increment by I until the counter exceeds 100. The loop will then stop at e can substitute variables for the start and stop numeric constant values such as: for (n 1; nNumberofTimes; n++) Lines of Loop code; This Lab Assignment will allow the user to: 1. Enter a positive number (we will dispense with GIGO code) 2. Run a For Loop from 1 to N times keeping a running count of the loop iteration values (i.e. I Display the number of iterations and the total. You might also wish to display the iteration count as the loop progresses: You ran the for loop 5 times 1 +2+3+4+5 15

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions