GithubHelp home page GithubHelp logo

ch2assignment1's Introduction

Chapter 2 Assignment 1

Problem Analysis:

Problem:

A program must be created which performs basic operations in declaring and initializing variables, arithmetic operations, and output in the program, while also compiling and running successfully.
    Program must perform the following;
  • Use cin, cout, and endl without std:: prefix
  • Variables declared as num1, num2, num3, and average as type int
  • Variables initialized as follows; 115 = num1, 29 = num2, -15=num3.
  • One statement which initializes variable average with the average of num1, num2, and num3
  • Statement(s) that output the values of all variables
  • Program must compile and run

Data definitions:

Num1 should equal 115, num2 should equal 29, num3 should equal -15, and average should be the total of all num variables defined, summed and divided by the total number of num variables (3). Return to end main function should be 0.

Desired Output:

Output should be in the form of whole integers. average variable should be a single integer, a result of the sum of all three num variables divided by the total number of num variables.

Algorithm:

  • Initialize standard inclusion statement to allow input/output and compiling via
  • Declare the namespace std to allow use of cin, cout, and endl
  • Declare main function
  • Within main function declare variables num1/num2/num3/average
  • Assign variable values based on parameters; num1=115, num2=29 num3=-15 and average=all num variables summed then divided by three (using precedence via parenthetical around addition): (num1 + num2 + num3) / 3
  • Print each variable individually
  • Insert a pause to allow verification of final values of all variables
  • return statement to end main function
  • User Documentation:

    If downloading from GitHub user must pull the entirety of the folder contents, not just the .sln (needs the .cpp file included).User may open the executable or run the solution in Visual Studio via Debugger (F5). No input from the user is required, when finished press any input key to exit the program.

ch2assignment1's People

Contributors

joe-mccallister avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.