write C++ statements for a – f, and then compile and run your program: Review Se
ID: 674924 • Letter: W
Question
write C++ statements for a – f, and then compile and run your program:
Review Segment
//include statement(s)
//using namespace statement
int main()
{
//variable declaration
//executable statements
//return statement
}
Write C++ statements that include the header files iostream.
Write a C++ statement that allows you to use cin, cout, and endl without the prefix std::.
Write C++ statements 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++ statements that output the values of num1, num2, num3, and average.
Explanation / Answer
#include<iostream>
using namespace std;
int main()
{
int num1,num2,num3,average;
num1 = 125;
num2 = 28;
num3 = -25;
average = (num1+num2+num3)/3;
cout << "Num1 is : " << num1 << endl;
cout << "Num2 is : " << num2 << endl;
cout << "Num3 is : " << num3 << endl;
cout << "Average is : " << average << endl;
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.