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
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;