Results 1 to 5 of 5
  1. #1
    Orteez's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    62
    Reputation
    10
    Thanks
    1
    My Mood
    Relaxed

    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. #2
    Auxilium's Avatar
    Join Date
    Jul 2010
    Gender
    male
    Location
    深い碧の果てに
    Posts
    4,518
    Reputation
    445
    Thanks
    606
    My Mood
    Happy
    [php]#include <math.h>[/php]
    has lots of math functions.

  3. #3
    bayley60's Avatar
    Join Date
    Nov 2009
    Gender
    male
    Location
    Turn Around!
    Posts
    208
    Reputation
    12
    Thanks
    30
    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. #4
    Illuminatus's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Location
    New Zealand
    Posts
    1,497
    Reputation
    2
    Thanks
    46
    My Mood
    Tired




    Press The Thanks Button If I Helped =D
    Quote Originally Posted by mamakiller13 View Post

    and im aint fag,
    FORMERLY KNOWN AS SloaMoeDaea

  5. #5
    tylermp1's Avatar
    Join Date
    Aug 2010
    Gender
    male
    Location
    Maine
    Posts
    17
    Reputation
    10
    Thanks
    2
    My Mood
    Sad
    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

Similar Threads

  1. [Help Request] I want to learn how to program! Help Needed please
    By ballin299 in forum Minecraft Help
    Replies: 15
    Last Post: 10-27-2011, 03:07 PM
  2. I NEED A PROGRAM! HELP
    By KingDot in forum General
    Replies: 11
    Last Post: 06-15-2011, 04:56 PM
  3. [Help Request] I need some help with binding eps7
    By v1zhaixingv1 in forum Vindictus Help
    Replies: 3
    Last Post: 05-18-2011, 10:25 PM
  4. [Help Request] please i need ur help norton deleted (crossfire.exe) and the game stoped
    By nooraleman in forum CrossFire Help
    Replies: 22
    Last Post: 05-14-2011, 08:00 PM
  5. need some help to upgrade a program
    By ravencraft in forum Member Introduction & Return
    Replies: 19
    Last Post: 05-04-2011, 02:25 PM