compiling error in function

# include<iostream.h>
int fact(int x);
int main ()
{
int n,r,a,b,c,d,e;
cout<<"find the value of nCr "<<endl;
cout<<"value for n "<<endl;
cin>>n;
cout<<"value for r "<<endl;
cin>>r;
a=n-r;
b=int fact(int n);
c=int fact(int r);
d=int fact(int b);
e=b/(c*d);
cout<<"value of factorial is "<<endl;
return 0;
}
int fact(int x)
{
int z =1;
for (int i=1;i<=x;i++)
z=z*i;
return z;
}

but now also always give error expression syntax in function main , inline 12,13,14
pls help me...
Last edited on
You are calling your functions incorrectly. Go look up how to call them again.

Only put type names in when declaring.
When you are calling you only need the values.

1
2
3
b=fact(n);
c=fact(r);
d=fact(b);


Give the correct advice, get reported.

Such crazy times we live in...
Last edited on
is it possible to find out which idiot reported him?
I doubt it. I guess Twicker might know but it's not worth following up, really. You're always going to get people like that.

I have a feeling it might actually be the OP, given that he edited his post way after firedraco's response. Could be wrong, though.
I think it was OP too, it was already reported before i posted.
Topic archived. No new replies allowed.