# Thread: need programming help! (C++)

1. ## need programming help! (C++)

I'm doing a geometric calculations thing using microsoft visual basic and I don't know how to set up the stuff so it calculates the volume and area. I just have to make up a problem. If you know this stuff type the code that I need to write in the cout section. Do the volume of a cylinder and area of a circle if you can set up an example for me. Volume of a cylinder is pi*radius squared*height, area of a circle is pi*radius squared. Note it has to solve the problems for you, you can't put the answer down.

If you need more clarification on what I'm doing go to my programming teacher's website at MsPetr.org and click on programming 1 C++, then click on geometric calculator (calc) and Math Operations.

2. [php]#include <math.h>[/php]
has lots of math functions.

3. dude i dont no anything about c++ but you will get alot more help if u move your thread to the c++ section here:C++/C - MPGH - MultiPlayer Game Hacking

4. Assuming the homework isn't due yet ;-)

Here's most of the shapes listed in the syllabus, I'll let you figure out the rest yourself.

Code:
```
#include "stdafx.h"

int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}

#include <iostream>

using namespace std;

int main()
{
float length;
float width;
float height;
float pi;
float volume;
float area;

pi = 3.1416;

cout << "The length of the shape  is: ";
cin >> length;

cout << "The width of the shape  is: ";
cin >> width;

cout << "The height of the shape  is: ";
cin >> height;

if (height == 0 && length > 0 && width > 0)
{
cout << "The area of the rectangle is: ";
cout << length * width;
}

else if (height > 0 && length > 0 && width > 0){
cout << "The volume of the rectangular prism is: ";
cout << length * width * height;
}
else if (width > 0 && height == 0 && length == 0){
cout << "The area of the circle is: ";
cout << (width / 2) * (width / 2) * pi;
}
else if (width > 0 && height > 0 && length == 0){
cout << "The volume of the cylinder is: ";
cout << (width / 2) * (width / 2) * pi * height;
}

system("pause");
}```
Did that with two days knowledge of C++...maybe you should pay attention in class? Haha