5
rated 0 times
[
5]
[
0]
/ answers: 1 / hits: 7675
/ 1 Year ago, sat, december 10, 2022, 4:27:55
I read somewhere that I need to install 'build essential packager' & so I tried:
sudo apt-get install build-essential
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
But the file still wont compile or run...
gcc -Wall -W -Werror factorial.cpp -o factorial.
gives me:
gcc -Wall -W -Werror factorial.cpp -o factorial.
factorial.cpp:3:22: fatal error: iostream.h: No such file or directory
compilation terminated
This is my piece of code:
//WAP to demonstrate static member for calculating factorial
#include<iostream.h>
#include<conio.h>
class fact
{
int i;
static int count;
public :
void calculate()
{
long int fact1=1;
count++;
for(i=0;i<=count;i++)
{
fact1=fact1*i;
}
cout<<"
Factorial of"<<count<<"="<<fact1<<"
";
}
};
int fact :: count;
void main()
{
int i;
clrscr();
fact f;
for(i=1;i<=15;i++)
{
f.calculate();
}
getch();
}
What shoud I do..???
More From » c++