Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- /*
- class Myclass{
- public:
- int value;
- Myclass(int x){
- value=x;
- }
- Myclass(){
- value = 0;
- }
- void print(){
- cout<< value << endl;
- }
- };
- */
- class List{
- public:
- int *array,index,size;
- List (){
- array=new int[10];
- size=10;
- index=0;
- }
- ~List(){
- delete [] array;
- }
- void Append(int i){
- array[index]=i;
- index++;
- }
- void get(int N){
- cout<<array[N]<<endl;
- }
- void print(){
- for (int i=0 ; i<index ; i++){
- cout << array[i]<< " ";
- }
- }
- };
- int main()
- {
- int n=6;
- List a = List();
- a.Append(1);
- a.Append(1);
- a.Append(1);
- a.Append(1);
- a.Append(1);
- a.Append(1);
- a.Append(1);
- a.Append(1); a.Append(1);
- a.Append(1);
- a.get(2);
- /*Myclass a = Myclass(2), b = Myclass(), c = Myclass();
- a.value=5;
- b.value=6;
- c.value;
- cout<< a.value << endl;
- cout<< b.value << endl;
- cout<< c.value << endl;
- a.print();
- b.print();
- c.print();*/
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment