Assignment 6

For Assignment 6 I decided to choose one of the Coding Assignments Here is the link: http://assignments.ds106.us/assignments/make-a-simple-program/

In this assignment I am supposed to create a simple program, 10-20 lines, where my code can solve a simple problem. and that I should test it using an online compiler afterwards to make sure it works

So for this assignment I actually took out my notes from my computer science course in my freshman year to remember the simple coding steps in “C++” program

and I chose to write a program that makes simple mathematical addition problems

Code:

  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.    int firstNumber, secondNumber, sumOfTwoNumbers;
  6.    cout << “Enter two integers: “;
  7.    cin >> firstNumber >> secondNumber;
  8.    sumOfTwoNumbers = firstNumber + secondNumber;
  9.    cout << firstNumber << ” + ” <<  secondNumber << ” = ” << sumOfTwoNumbers;    
  10.    return 0;
  11. }

Then I run it into an online C++ compiler to make sure that it works

The result:

One thought on “Assignment 6

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create your website at WordPress.com
Get started
%d bloggers like this: