Calculastions

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?
@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.
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;
So you don't need dark GDP for this?
Topic archived. No new replies allowed.