Program To Print Number From 1 To 100 Without Using Loop,Recursion and Goto
#include<iostream>
using namespace std;
int i=0;
class goc{
/*
i is variable with initial value 0
goc is my class name
goc() is constructor
*/
public:
goc(){
i++;
cout<<i<<endl;
}
};
int main()
{
/*
goc a[100]
here i am creating array of 100 and it will create 1 to 100 object
and each time it would call construtore
*/
goc a[100];
return 0;
}
No comments :
Post a Comment