Noob Help......Calculating volume and area of a sphere...
Hey guys,
I'm new to this language and am having a little problem getting the code below to run, its for a program this asks a user to enter a radius, and then computes the area and volume of a sphere...
any help would be greatly appreciated. Thanks :)
Code:
//INCLUDE SECTION
#include <stdio.h> //def's 4 printf, scanf, getchar, puts, gets, fflush
#include <conio.h> //def's for getch
#include <stdlib.h> //def's 4 system
#define PI 3.14159
//FUNCTION PROTOTYPES
void explanation(void);
void volume_calc(void);
void printresults();
int main (void)
{
explanation();//FUNCTION CALL
volume_calc();//FUNCTION CALL
printresults();
printf("\n\t\t\tPRESS ANY KEY TO EXIT");
_getch();
return 0;
}
//FUNCTION DEFINITIONS
void explanation(void)
{
system ("cls");
puts ("This program will ask you to enter the RADIUS of a sphere...");
puts ("and then calculate the volume and surface area...");
}
void volume_calc(void)
{
//VARIABLE DECLARATIONS
double radius, area, volume;
//GET USER INPUT
printf ("\n\n\nPlease entert the radius of the sphere==> ");
fflush (stdin);
scanf ("%f", &radius);
;
//CALCULATIONS
volume=(4/3)*PI*(radius,3);
area=4*PI*(radius,2);
//OUTPUT
printresults();
}
void printresults(float area, float radius, float volume)
{
printf("You entered a radius of %.3f...", radius);
printf("\nthe volume of this sphere is ==> %.3f", volume);
printf("\n\nthe area of this sphere is ==> %.3f", area);
}
These are the errors that are coming up....
Code:
1>LAB7A.obj : error LNK2019: unresolved external symbol "void __cdecl printresults(void)" (?printresults@@YAXXZ) referenced in function _main
1> : fatal error LNK1120: 1 unresolved externals