Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include int main(void) /YOUR CODE GOES HERE return 8; 1. Using the Xendesktop, open Visual Studio 2015. Create a new project and add a new.cpp

image text in transcribed

#include int main(void) /YOUR CODE GOES HERE return 8; 1. Using the Xendesktop, open Visual Studio 2015. Create a new project and add a new.cpp file to the project. Type the programming shell template as stated up above and continue with the following steps below. Be sure to include comments throughout your program for readability purposes 2. (Housekeeping): Declare the following variables in your program using appropriate data type. When selecting a data type keep in mind the type of value you want to store, i.e., int, float, character. Also, be sure to use conventional naming standards for all variable declarations. number Hint): Since sum is going to be used for adding the value, it needs to be initialized to zero 3. (Display Prompt: Write a printf0 statement to ask user for the following message. Enter the number of values to be processed 4. (Input): Add a scanfO statement to store user input for the number of values they wish to process 5. (Loop structure): Now, you will write a loop structure to iterate for the number of values you want user to input. for (inti-Iii-number; i++) /code to enter a value and total the values To begin with, your loop structure will look like this- 8. Declare the following variable inside the loop to store the current value. Remember, the scope of this variable is limited to the loop onhy. It can't be referred or used outside the loop e value 7. (Output): Inside the loop, write a display prompt using a printf0 statement for user to input a value using the following message. Enter a value 8. (Input): Write a scanf0 statement to store the value the user keys in from the keyboard into the variable named value. 9. (Assignment Statement]: Here comes the main part of your program. Now, you need to add this value into the variable sum. So write an assignment statement to add the input value. sum sum+ value; 10. (Output): Outside of the loop, write a printf0 statement to display the value of sum. Remember, the variable sum is declared outside of the loop so it can be referred/used anywhere within the main function. Also, to display the value stored in a variable you need to include a conversion specifier inside of the quotation marks in the printf0 and the variable names within the parentheses. 11. (Output Screen) When you execute the program, it should be similar to the following

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

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions