Issue on constracting a programm

Hello im new in C++ and i have been asked to make a simple program as a project for my university.A program which will culculate the dimensions of a cycle of which radian is given by the user.I build it but i had some errores on compiling (C2062 and C2447) if some can help me please do so thank you very much.

>Here is the programm



void Cycle(*float R,*float P, *float E);
{
float PI = 3.14159;
P=2*PI*R;
E=PI*R*R;
printf("I perimetros tou kulou einai %f kai to embadon tou %f",P,E);
}




//============main programm======================//

#include <stdio.h>
void Cycle(float R);
float main()
{
float R;
printf("Dose aktina kuklou");
scanf("%f",&R);
Cycle(R);
return 0;
}
Last edited on
When you define your function "void Cycle(float R);" it takes only 1 argument and you passed only one argument at Cycle(R). However you have written your function to accept 3 arguments. Define and use your function accordingly.
Thank you very much for your help but i still have problem it says error C2447: missing function header (old-style formal list?) thanks again
>here is the new programm



void Cycle(float R,float P, float E);
{ //the error appears to be here
float PI = 3.14159;
P=2*PI*R;
E=PI*R*R;
printf("I perimetros tou kulou einai %f kai to embadon tou %f",P,E);
}




//====================main programm==============================//

#include <stdio.h>
void Cycle(float R, float P, float E);
float main()
{
float R,P=0,E=0;
printf("Dose aktina kuklou");
scanf("%f",&R);
Cycle(R,P,E);
return 0;

}
just remove the semicolon after the header...
it should be


void Cycle(float R,float P, float E) // No ; here.... never
{
float PI = 3.14159;
P=2*PI*R;
E=PI*R*R;
printf("I perimetros tou kulou einai %f kai to embadon tou %f",P,E);
}
Topic archived. No new replies allowed.