compiling error in function

Jun 24, 2013 at 3:35am
# 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 Jun 24, 2013 at 4:15am
Jun 24, 2013 at 3:40am
You are calling your functions incorrectly. Go look up how to call them again.
Jun 24, 2013 at 9:01am

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


Jun 24, 2013 at 9:09am
Give the correct advice, get reported.

Such crazy times we live in...
Last edited on Jun 24, 2013 at 9:09am
Jun 24, 2013 at 9:18am
is it possible to find out which idiot reported him?
Jun 24, 2013 at 9:25am
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.
Jun 24, 2013 at 9:28am
I think it was OP too, it was already reported before i posted.
Topic archived. No new replies allowed.