In C++, use SML programs to accomplish each of the following tasks: a) Use a sentinel-controlled loop...

70.2K

Verified Solution

Question

Programming

In C++, use SML programs to accomplish each of the followingtasks:

a) Use a sentinel-controlled loop to read positive numbers andcompute and display their sum. Terminate input when a negativenumber is entered.

b) Use a counter-controlled loop to read seven numbers, somepositive and some negative, and compute and display theiraverage.

c) Read a series of numbers, and determine and display thelargest number. The first number read indicates how many numbersshould be processed.

For input you should read the instructions from a file (afterprompting the user for the name of the file to read). Make theintro banner say \"Welcome to Simpletron! Enter the name of the filecontaining your program:\"

Here is a sample of the output expected:

Execution halted normally

REGISTERS:

accumulator -1

instructionCounter 6

instructionRegister 4300

opcode 43

operand 0

MEMORY:

0 1 2 3 4 5 6 7 8 9

0 1007 1008 2007 3008 2109 1109 4300 4 -5 -1

10 0 0 0 0 0 0 0 0 0 0

. . .

90 0 0 0 0 0 0 0 0 0 0

Please show the output files for a, b, and c. Thank you.

Answer & Explanation Solved by verified expert
4.0 Ratings (436 Votes)
Question asentinel controlled loop to calculate the sum    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students