1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #include<iostream.h> #include<conio.h> int n=1,i=0; class numbers { public: void display() { cout<<"\n"; for(i=1;i<=n;i++) { cout<<" "<<i; } } void next() { if(n<20) { n++; display(); next(); } } }; void main() { numbers s; clrscr(); s.display(); s.next(); getch(); } |
No comments:
Post a Comment