Quick backstory: I am a college student taking C++ for an engineering major. I have never done any programming at all so my problems will be a touch elementary. I apologize in advance for my ignorance and greatly appreciate all the help I can get.
Now to my problem.
I have to write a simple program to calculate the volume of cylinders while drawing the numbers needed from a file. When I build the program, it builds successfully. However, when I run my program, it tells me my variable "h" is not initialized.
I want to think it has something to do with the source file for the numbers but as best I can tell, it's right where it needs to be.
cout << "Zachary Jones" << endl;
cout << "Project 3" << endl;
cout << "Febuary 23, 2011" << endl;
const float PI = 3.141592;
float volume2, h, r, i, V, c; // h = height, r = radius, i = increase %, v = volume, c = radius of new cylinder
char filename = "cylinderdata.txt";
// Create File
//Volume Program and loop
while (h > -999)
// Read in data
cylinderdata >> h >> r >> i ;
V = PI * pow(r,2) * h;
cout << "Volume of Cylinder is " << V <<endl <<endl;
volume2 = ((i/100) + 1) * V;
c = sqrt((volume2)/(PI*h));
cout << "The radius of the new cylinder is " << c << endl << endl;
Any help or suggestions?