error c2447

I am very new to c++ and I am teaching myself functions. My code comes up with a an error:
error C2447: '{' : missing function header (old-style formal list?)
Any clues on what is wrong?

#include <cmath>


void calculation( int a, int b);
{
int a;
int b;
int c;
int d;
int c = ((int a * int a)+(int b * int b));
int d = sqrt(int c);
}
1) You aren't supposed to have a ; after your function declaration if you are going to define it.
2) Once you have defined a variable (like int x;), do not place the type in front. e.g.:

1
2
3
int x = 2;
int y = 3;
int z = x + y; //no ints before x/y 
Also you shall not declare variables with the same name as parameters in the outermost scope of a function as you did

void calculation( int a, int b);
{
int a;
int b;
I am very new to c++ and I am teaching myself functions. My code comes up with a an error:
error C2447: '{' : missing function header (old-style formal list?)
Any clues on what is wrong?


struct node *current;
int option= 0;

void add_node_at_end();

{
node *temp, *temp2;

temp = new node;
cout<<"Please entre the name of the person:";
cin>> temp->name;
cout<<"Please entre the name of the person:";
cin>> temp->age;
temp->nxt=NULL;

if (start_ptr == temp;
{
start_ptr =temp;
current = start_ptr;

}

else
{
temp2 =start_ptr;
while (temp2->nxt !=NULL)
{
temp2 = temp2->nxt;
}
temp2->nxt=temp;
}
}
1) Do not hijack other people threads.
2) Answer to your problem are already posted in this thread.
Topic archived. No new replies allowed.