So I am in need for two programs to be created. They are very simple, but I am very poor at C++
here is the questions
write a program that declares and integer named summer and initialize the value to 7. Then print the value of summer to the screen. Next write a statement to increase the value of summer by two. Then print that value to the screen
and the second one is
write a program that will evaluate the expressions below and will print their value (answer) to the screen. You are not to figure out the value, the program is to do that. Store the values as a float.
2 + 6/3 + 1 * 6 - 7
(2+6)/(3+1)*6-7
(2.6)/(3+1)*(6-7)
Thanks, Much appreciated
#include <iostream> // include the library for the input output stream
#include <windows.h> // include windows stuff like the PAUSE function
int main()
{
usingnamespace std; // always use this
int summer = 7; // declaring an integer named summer and immediately
// giving it a value of 7
cout << "Summer = " << summer << endl << endl; // printing "Summer = " and then the value
// of summer. Then ending the line twice (moving down
// two lines).
int summerIncreased = summer + 2; // declaring an integer called summerIncreased
// and giving it the value of summer and increasing it by 2.
cout << "Summer increased by two is " << summerIncreased << endl << endl; // printing "Summer increased by two is "
// and then the value of SummerIncreased to the screen
// and ending the line twice;
system("PAUSE"); // pause the program and wait for
// the user to press the enter key.
return 0; // return nothing as a result and end the program
}
int summerIncreased = summer + 2; // declaring an integer called summerIncreased
// and giving it the value of summer and increasing it by 2.
// This isn't increasing the value of summer by 2.
#include <iostream>
#include <cstdlib>
usingnamespace std;
int main()
{
int summer=7;
cout<<"The value of summer is: "<<summer<<endl;
summer+=2;
cout<<"The value of summer increased by 2 is: "<<summer<<endl;
system ("pause");
return 0;
}
2.
1 2 3 4 5 6 7 8 9 10 11
#include <iostream>
#include <cstdlib>
usingnamespace std;
int main()
{
float a=2 + 6/3 + 1 * 6 - 7, b=(2+6)/(3+1)*6-7, c=(2.6)/(3+1)*(6-7)
cout<<"The value of the first expression is: "<<a;
cout<<"The value of the second expression is: "<<b;
cout<<"The value of the third expression is: "<<c;
If this isn't for +++A+++ or more, I don't know what is!