|
-
June 3rd, 2006, 04:39 AM
#1
Error C2061 in header file!!
Im trying write a simple program to calculate the factorial of a number using VC++ 6,0 and i get an error which C2061 saying that factorial# is not an identifier and it couldn't be found and needs to be declared before being used????
heres the code:
#include <stdio.h>
#include <conio.h>
#include <D:\VC++\chapter3\factorial\factorial.h>
int number,factorial;
int main()
{
printf("enter the number\n");
scanf("%d",&number);
if (number = 0)
{
printf("the factorial is 1");
system("exit");
}
factorial = calc_fact(number);
printf("the factorial of %d is %d\n",number,factorial);
system("pause");
}
and heres the header file:
int calc_fact(int number)
{
int factorial3;
while(number != 0) do
number *= --number;
factorial3 = number;
return factorial3;
}
what changes do i have to make in the program and/or program settings to make this exceedingly simple program to work. and theres another thing i wanna know. If I include the file using the ".." after the #include then it agains gives me an error..thats a different Q but right now im bothered about my current program. And what header files shud be included for system functions?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|