Hello everyone, so I have this coding assignment that I have to for class. The issue I'm having is the last part of the question where it asks for storing the 125 into num1, 28 into num2, and –25 into num3. I want to able to learn how to do this, not just getting the answer right off the bat you know. Tell me what you think, pretty sure I missed something. Thank you, coders.
Write a C++ statement that includes the header file iostream.
Write a C++ statement that allows you to use cin, cout, and endl without the prefix std::.
Write C++ statement(s) that declare the following variables: num1, num2,num3, and average of type int.
Write C++ statements that store 125 into num1, 28 into num2, and –25 into num3.
Write a C++ statement that stores the average of num1, num2, and num3 into average.
Write C++ statement(s) that output the values of num1, num2, num3, and average.
Then compile and run your program by clicking the blue run button on the right side of the screen.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
// Programming Exercise 2-3
//include statement(s)
#include <iostream>
//using namespace statement
using namespace std;
int num1 = 125;
int num2 = 28;
int num3 = -25;
int average;
int main ()
{
//variable declaration
cout << "Enter the first nummber of your choice " << endl;
cin >> num1;
cout << "Now enter another number of your choice" << endl;
cin >> num2;
cout << "And finally enter the last number of your choice" << endl;
cin >> num3;
//executable statements
average = num1 + num2 - num3;
cout << "Your lucky number is " << average << endl;
//return statement
return 0;
}
|