I need to use a formula and output a variable in C++ but I have an issue. Im using the variable in the forumla but I want the formula to ouput the value of the variable. Sounds complicated so here is my code:
code:
#include <cmath>
#include <iostream>
int v1;
int =v2;
int vc1;
int vc2;
float t;
float ans;
using namespace std;
void main()
{
cout << "Enter v1: ";
cin >> v1;
cout << "Enter v2: ";
cin >> v2;
cout << "Enter vc1: ";
cin >> vc1;
cout << "Enter vc2: ";
cin >> vc2;
ans = (v1 * ((1-t)*(1-t)*(1-t))) + vc1 * (3 * ((1-t)*(1-t))) * t + vc2 * ( 3 * ((1-t) * (t*t)))+ (v2 * (t*t*t));
cout << "Answer = " << ans << endl;
}
Basically, the "t" in the formula is what I want. I need the output to be in terms of "t".
Its kinda hard to explain.