Calculastions

Sep 19, 2012 at 3:06am
how would you write a code for


1. Use follow variable value
double a=1.0;
double b=3.0;
double c=4.0;
double d=2.0;
double answer = 2.0;
2. Create a program that will calculate the result answer of:
answer += a+++c++*d/--b;

can anyone help?
Sep 19, 2012 at 3:32am
@instantsting

Your program is pretty much finished. All you need to do is add in a cout << answer << endl;. Start with your includes, add in your list of variables, put in your int main() then the cout. Viola, program done. Oh yeah, don't forget the opening and closing brackets.
Sep 19, 2012 at 3:34am
First you need to begin the program by doing the standard
#include <iostream>
using namespace std;

Then you would declare your variables :

double a=1.0;
double b=3.0;
double c=4.0;
double d=2.0;

Then in your main :

int main() {

.................. Your calculation. Pretty straight forward.

return 0;
Sep 19, 2012 at 8:35pm
So you don't need dark GDP for this?
Topic archived. No new replies allowed.