factor777
Feb 13th, 2001, 07:19 PM
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.
#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!
calling a function that does stuff aint that easy like vb. please tell me what im forgetting.
#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!