Results 1 to 9 of 9

Thread: My simple cheat my homework prog. :) but it dont work.

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2000
    Location
    New Hampshire
    Posts
    32

    Talking

    OK today i desided no more hard math work and i made a program to increase my efficiancy.
    calling a function that does stuff aint that easy like vb. please tell me what im forgetting.

    Code:
    
    #include <stdio.h>
    #include <iostream.h>
    
    const double Pi = 3.141592654;
    char choice;
    
    int main()
    {
    	printf("a.	Cylinder\n");
    	printf("b.	Cone\n");
    	printf("c.	Prism\n");
    	printf("d.	Pyramid\n");
    	printf("--------------\n");
    	printf("x.	Exit\n");
    
    	cin>>choice;
    
    	switch ( choice ){
    	case 'a':
    		  LaSaCylinder();
    		  break;
    	case 'x':
    		return 0;
    	};
    
    };
    //////////////////////////
    //Cylinder Calculation ///
    //////////////////////////
    //LA = Lateral Area    ///
    //////////////////////////
    //SA = Surface Area    ///
    //////////////////////////
    void LaSaCylinder(int radius, int hieght, double LA, double SA);
    { 
    	cout << "What is the radius of the base?\n";
    	cin >> radius;
    	cout << "What is the height of the Cylinder?\n";
    	cin >> height;
    
    	LA = (2 * Pi * radius) * height;
    	SA = LA + (2 * (Pi * (radius^2)));
    
    	cout << LA << " is the Lateral area.\n";
    	cout << SA << " is the Surface area.\n";
    };
    this has been more work than i thought! m8's! Heres my craptacular error!
    |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ||||||||||||||
    --------------------Configuration: Math - Win32 Debug--------------------
    Compiling...
    Math.cpp
    D:\Ftp\BIN\Math\Math.cpp(21) : error C2065: 'LaSaCylinder' : undeclared identifier
    D:\Ftp\BIN\Math\Math.cpp(35) : error C2373: 'LaSaCylinder' : redefinition; different type modifiers
    D:\Ftp\BIN\Math\Math.cpp(36) : error C2447: missing function header (old-style formal list?)
    Error executing cl.exe.

    Math.exe - 3 error(s), 0 warning(s)
    ---------------------------------------------------------------------------------------

    it just Got worse!
    Last edited by factor777; Feb 13th, 2001 at 08:40 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width