whats wrong with my code
why it doesnt work i got some errors
it should output in the end x=3 and y=3 in the end of the program
PHP Code:
# include <iostream>
using namespace std;
void sFune();
void main()
{ for (int i=0; i<3; i++)
sFune();
}
void sFune ()
{
static int x=2;
int y=2;
x++;
y++;
cout << " X = "<<x<<endl;
cout << " Y = "<<y<<endl;
}
class secretclass
{
public :
void set ( int a)
{
y = a;
}
void printY()
{
cout <<y<<endl;
}
static void PrintNum ()
{
cout <<num<<endl;
}
static void increase(int n)
{
num+=n;
}
secretclass ( int a=0)
{
y=0;
num ++;
}
private :
int y;
static int num;
};
int secretclass::num=10;
int main ()
{
secretclass obj1(50);
secretclass::PrintNum();
secretclass.obj2 (20)
secretclass::PrintNum();
obj1.increase(5);
obj2.increase(2);
obj1.printY();
obj2.printY();
secretclass::increase(10);
obj1.PrintNum();
return 0;
}