I fail to understand what I need to do

Hi guys

I tried to put together a code for taking any base value and converting it to base 10, but when I try compiling the code, I get an error message saying that my d4,d3,d2,d1 and R are used uninitialized in this function. I

//File: ComsApp.cpp
#include <iostream>
#include <math.h>
using namespace std;
int main (void)
{
float R;
float valueinbase10;
float d4;
float d3;
float d2;
float d1;

cout << "Enter the first digit" << cin << d4 <<"\n";
cout << "Enter the second digit" << cin << d3 <<"\n";
cout << "Enter the third digit" << cin << d2 <<"\n";
cout << "Enter the fourth digit" << cin << d1 <<"\n";
cout << "Enter the base value" << cin << R <<"\n";

valueinbase10 = d4*(pow(R,3)) + d3*(pow(R,2)) + d2*R + d1;

cout << valueinbase10 <<"\n";

return (0);
}

I am still new to programming, and this is the second program I tried compiling that gave me the same error message, just with different variables. really don't know what I am supposed to. I would very much appreciate your assistance.
1
2
cout << "Enter the first digit ";
cin >> d1;
Thank you very much ne555....the code works now :-D...thank you...a lot
Last edited on
Topic archived. No new replies allowed.