Well, downloaded Visual Studio Express and started toying around making calculators, such as this simple one, that calculates the area of a circle after having the user declare it's radius.
(The following code is not part of the problem, it's just a hint to how simple my coding is. They could've teached this in Elementary school, even in some countries they do.)
#include<iostream>
using namespace std;
int main(void)
{
double dRadius = 0.0;
double dPi = 3.14159265;
cout << "Please enter the radius of the circle." << endl;
cin >> dRadius;
double dArea = (dRadius*dRadius / dPi);
cout << "The area of your the circle is " << dArea << endl;
system("pause");
return 0;
}
Simple right?
Well i have a slight issue with how i have written the calculations
in this calculator. This one functions by prompting the user for a cylinders radius and height, and then calculates the volume of the cylinder.
dVolume = ((pow(dRadius,2) / dPi) * dHeight);
Using this equation, the program starts and is functional, however dVolume equals 1.#INF, meaning it's infinite (i beleive).
This is the line with the calculation in it, attempting to use the cmath or math.h librarys power function (i.e Making dRadius sqared).
Using this equation, the program starts and is functional, however dVolume equals 1.#INF, meaning it's infinite (i beleive).
For those interested in the entire code, or in case it can be used to more thouroughly solve my problem, here's the rest of it.
cout << "Please enter the radius of the top of the sylinder." << endl;
cin >> dRadius;
cout << "Please enter the height of your cylinder." << endl;
cin >> dHeight;
dVolume = ((pow(dRadius,2) / dPi) * dHeight);
cout << "The Volume of your cylinder is " << dVolume << endl;
cout << "Please enter the radius of the top of the sylinder." << endl;
cin >> dRadius;
cout << "Please enter the height of your cylinder." << endl;
cin >> dHeight;
dVolume = ((pow(dRadius,2) * dPi) * dHeight);
cout << "The Volume of your cylinder is " << dVolume << endl;