Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lecture: Iteration 4: While Loops Objective: Practice using while loops Problem 1 Keep track of max input value Create a new C project named whatever

Lecture: Iteration 4: While Loops

Objective: Practice using while loops

Problem 1 Keep track of max input value

Create a new C project named whatever you want in Visual Studio using the Windows Desktop Wizard.

If you're using Visual Studio, add a main.c file to your project; you can use the main.c template I provided on Canvas if youd like. If youre using Xcode, Xcode automatically generates a main.c file for you.

While the user hasn't entered -1, read in an integer from the user; don't prompt for the user input, because that will confuse the automated grader.

After the user enters -1, print the maximum number they entered (be sure to exclude -1).

If the user entered -1 as their first input, print NO INPUT instead of printing their max input (since they didn't input any numbers except to quit).

Hint 1: If you want to initialize the max user input to the minimum possible int, you should look at the limits.h documentation

Hint 2: You can use a bool to keep track of whether or not the user entered anything other than -1. If you do, be sure to #include

Example 1

If the user enters 1, 2, 3, -1 your code should print 3

Example 2

If the user enters -1 your code should print NO INPUT

Submitting Your Solution

Click on the gray box below that says Load Graded Exercise 9: While Loops in a new window.

Click on the link for this graded assignment from the list of Live Coursework and click the green Submit button under Actions on the left on the assignment page. Upload your main.c file by clicking the Choose File button and navigating to it or by dragging that file onto the upload box. Click the green Submit button on the bottom right of the dialog box.

Once the test case(s) for the assignment have been run (which typically happens pretty quickly), you can check your results for each test case and your overall score at the top right of the Test Cases section. If youre happy with your results, youre done.

If you need (or want) to improve your score, you can look at the test case results, modify your code as appropriate, and resubmit again. If you click on a specific test case, you can get additional information about the output generated by your submission, the expected output for a correct submission, and the difference between the two outputs (in the Pretty Diff section at the bottom of the dialog box).

All assignments in the course are set for unlimited submissions, so you can resubmit as many times as you want until the due date/time. The grade youll receive for the assignment will be the highest grade you achieved across all your submissions for the assignment.

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

More Books

Students also viewed these Databases questions