SlideShare a Scribd company logo
class Array
{
    private:
        int size;
        int *pointer;

     public:
        Array()
        {
             size=0;
                           pointer=NULL;
       }

     void load()
     {
         cout <<"Enter the number of integers in the array.nn";
         cin >>size;
         pointer = new int[size];
         int i;
         for (i=0; i< size; i++)
         {
             cout <<"Enter interger # " << i+1 <<"n";
             cin >>*(pointer+i);


           }
                     }//end of load

     void print()
     {
        int i =0;
        cout <<"The array contains " <<size << "integers.nn";
        cout <<"They are:n";
         while (i < size)
            {
                cout <<i+1<<")t"<<*(pointer+i)<<endl;
                  i++;

               }//end of loop

       }

     ~Array()        //destructor to delete the array
     {
         delete []pointer;
     }

};

void main (void)
{
    Array array1;
    array1.load();
    array1.print();
    array1.~Array();
}

____________________________________________

More Related Content

What's hot (20)

Introduction to Go for Java Programmers
Introduction to Go for Java Programmers
Kalpa Pathum Welivitigoda
 
basic programs in C++
basic programs in C++
Arun Nair
 
C- Programs - Harsh
C- Programs - Harsh
Harsh Sharma
 
ProgrammingwithGOLang
ProgrammingwithGOLang
Shishir Dwivedi
 
week-5x
week-5x
KITE www.kitecolleges.com
 
Cpp c++ 2
Cpp c++ 2
Sltnalt Cosmology
 
Array using recursion
Array using recursion
Swarup Boro
 
Oopsprc1c
Oopsprc1c
Ankit Dubey
 
CODE Data Structures
CODE Data Structures
Sonia Pahuja
 
Program membalik kata
Program membalik kata
haqiemisme
 
Static Variable in C++
Static Variable in C++
Nasir Hamidon
 
Include
Include
Shi Chakep
 
C++ question 6 || solution of Programming Problem
C++ question 6 || solution of Programming Problem
Topics MixeR
 
Cpp
Cpp
Ankit Dubey
 
Ooprc4 b
Ooprc4 b
Ankit Dubey
 
Cpp tutorial
Cpp tutorial
Vikas Sharma
 
Functors, applicatives, monads
Functors, applicatives, monads
rkaippully
 
Oop1
Oop1
Vaibhav Bajaj
 
メディアアートにおけるプログラミング言語Rubyの役割
メディアアートにおけるプログラミング言語Rubyの役割
Koichiro Eto
 
cosc 281 hw2
cosc 281 hw2
Brian Goggins
 
basic programs in C++
basic programs in C++
Arun Nair
 
C- Programs - Harsh
C- Programs - Harsh
Harsh Sharma
 
Array using recursion
Array using recursion
Swarup Boro
 
CODE Data Structures
CODE Data Structures
Sonia Pahuja
 
Program membalik kata
Program membalik kata
haqiemisme
 
Static Variable in C++
Static Variable in C++
Nasir Hamidon
 
C++ question 6 || solution of Programming Problem
C++ question 6 || solution of Programming Problem
Topics MixeR
 
Functors, applicatives, monads
Functors, applicatives, monads
rkaippully
 
メディアアートにおけるプログラミング言語Rubyの役割
メディアアートにおけるプログラミング言語Rubyの役割
Koichiro Eto
 

Viewers also liked (20)

Autor do mês
Autor do mês
teresamferreira
 
Group Risk Assessment Form
Group Risk Assessment Form
t012588
 
Yoli planta(1)
Yoli planta(1)
yolandaruizr
 
A beleza dos números
A beleza dos números
profroberto2009
 
Presentación3.ppt
Presentación3.ppt
darymary
 
Boekenhouder evaluatie 1.2 b
Boekenhouder evaluatie 1.2 b
JasmienDecancq
 
Cabo Coaxial DLC 58 - RF
Cabo Coaxial DLC 58 - RF
Alfacomp Automação Industrial Ltda.
 
Preguntas abuelo
Preguntas abuelo
inasadaba
 
Product Work Log
Product Work Log
Specter-kc
 
FOTOyMÁS
FOTOyMÁS
fotoymas
 
Document11
Document11
isteven
 
Lawspeed Awr Handout
Lawspeed Awr Handout
Rickycoleman
 
Workshop Enunciados Gerais e Enunciados Específicos
Workshop Enunciados Gerais e Enunciados Específicos
Sílvia Baltazar
 
Hirlevel
Hirlevel
JobbikLadany
 
Examiner new frontiers july 2011 page 1
Examiner new frontiers july 2011 page 1
retreathouse
 
30 new products for our 30 years
30 new products for our 30 years
Lika Electronic
 
2ª Fase - Nível 2 - 2011
2ª Fase - Nível 2 - 2011
oim_matematica
 
Dicas
Dicas
srdimitrov
 
Group Risk Assessment Form
Group Risk Assessment Form
t012588
 
Presentación3.ppt
Presentación3.ppt
darymary
 
Boekenhouder evaluatie 1.2 b
Boekenhouder evaluatie 1.2 b
JasmienDecancq
 
Preguntas abuelo
Preguntas abuelo
inasadaba
 
Product Work Log
Product Work Log
Specter-kc
 
Document11
Document11
isteven
 
Lawspeed Awr Handout
Lawspeed Awr Handout
Rickycoleman
 
Workshop Enunciados Gerais e Enunciados Específicos
Workshop Enunciados Gerais e Enunciados Específicos
Sílvia Baltazar
 
Examiner new frontiers july 2011 page 1
Examiner new frontiers july 2011 page 1
retreathouse
 
30 new products for our 30 years
30 new products for our 30 years
Lika Electronic
 
2ª Fase - Nível 2 - 2011
2ª Fase - Nível 2 - 2011
oim_matematica
 
Ad

Similar to Class array (20)

Oops lab manual2
Oops lab manual2
Mouna Guru
 
Arrays matrix 2020 ab
Arrays matrix 2020 ab
Dr .Ahmed Tawwab
 
Computer Programming for Engineers Spring 2023Lab 8 - Pointers.pptx
Computer Programming for Engineers Spring 2023Lab 8 - Pointers.pptx
ab11167
 
Pointer
Pointer
saeeb12
 
2DArrays.ppt
2DArrays.ppt
Nooryaseen9
 
Notes
Notes
Hitesh Wagle
 
Array notes
Array notes
Hitesh Wagle
 
FP 201 - Unit 6
FP 201 - Unit 6
rohassanie
 
Lec 40.41 - pointers
Lec 40.41 - pointers
Princess Sam
 
File yuan.h#include iostream#include fstream#include .pdf
File yuan.h#include iostream#include fstream#include .pdf
MALASADHNANI
 
Array and string in C++_093547 analysis.pptx
Array and string in C++_093547 analysis.pptx
JumanneChiyanda
 
STL
STL
Naoya Nakazawa
 
Lecture1 classes2
Lecture1 classes2
Noor Faezah Mohd Yatim
 
fully comments for my program, thank you will thumb up#include io.pdf
fully comments for my program, thank you will thumb up#include io.pdf
arjuncp10
 
g++ -o simpleVector.exe simpleVector.cpp #include stdio.h #i.pdf
g++ -o simpleVector.exe simpleVector.cpp #include stdio.h #i.pdf
arakalamkah11
 
Lecture#5-Arrays-oral patholohu hfFoP.ppt
Lecture#5-Arrays-oral patholohu hfFoP.ppt
SamanArshad11
 
Lecture#8 introduction to array with examples c++
Lecture#8 introduction to array with examples c++
NUST Stuff
 
Module7
Module7
Seid Hussein
 
C++ Nested loops, matrix and fuctions.pdf
C++ Nested loops, matrix and fuctions.pdf
yamew16788
 
Lecture 2: arrays and pointers
Lecture 2: arrays and pointers
Vivek Bhargav
 
Oops lab manual2
Oops lab manual2
Mouna Guru
 
Computer Programming for Engineers Spring 2023Lab 8 - Pointers.pptx
Computer Programming for Engineers Spring 2023Lab 8 - Pointers.pptx
ab11167
 
FP 201 - Unit 6
FP 201 - Unit 6
rohassanie
 
Lec 40.41 - pointers
Lec 40.41 - pointers
Princess Sam
 
File yuan.h#include iostream#include fstream#include .pdf
File yuan.h#include iostream#include fstream#include .pdf
MALASADHNANI
 
Array and string in C++_093547 analysis.pptx
Array and string in C++_093547 analysis.pptx
JumanneChiyanda
 
fully comments for my program, thank you will thumb up#include io.pdf
fully comments for my program, thank you will thumb up#include io.pdf
arjuncp10
 
g++ -o simpleVector.exe simpleVector.cpp #include stdio.h #i.pdf
g++ -o simpleVector.exe simpleVector.cpp #include stdio.h #i.pdf
arakalamkah11
 
Lecture#5-Arrays-oral patholohu hfFoP.ppt
Lecture#5-Arrays-oral patholohu hfFoP.ppt
SamanArshad11
 
Lecture#8 introduction to array with examples c++
Lecture#8 introduction to array with examples c++
NUST Stuff
 
C++ Nested loops, matrix and fuctions.pdf
C++ Nested loops, matrix and fuctions.pdf
yamew16788
 
Lecture 2: arrays and pointers
Lecture 2: arrays and pointers
Vivek Bhargav
 
Ad

Recently uploaded (20)

Analysis of Quantitative Data Parametric and non-parametric tests.pptx
Analysis of Quantitative Data Parametric and non-parametric tests.pptx
Shrutidhara2
 
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
razelitouali
 
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
parmarjuli1412
 
Exploring Ocean Floor Features for Middle School
Exploring Ocean Floor Features for Middle School
Marie
 
Sustainable Innovation with Immersive Learning
Sustainable Innovation with Immersive Learning
Leonel Morgado
 
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Veera Pallapu
 
Capitol Doctoral Presentation -June 2025.pptx
Capitol Doctoral Presentation -June 2025.pptx
CapitolTechU
 
Overview of Off Boarding in Odoo 18 Employees
Overview of Off Boarding in Odoo 18 Employees
Celine George
 
What are the benefits that dance brings?
What are the benefits that dance brings?
memi27
 
IDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptx
ArneeAgligar
 
The Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdf
dennisongomezk
 
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Rajdeep Bavaliya
 
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Restu Bias Primandhika
 
Battle of Bookworms 2025 - U25 Literature Quiz by Pragya
Battle of Bookworms 2025 - U25 Literature Quiz by Pragya
Pragya - UEM Kolkata Quiz Club
 
LDMMIA Spring Ending Guest Grad Student News
LDMMIA Spring Ending Guest Grad Student News
LDM & Mia eStudios
 
Allomorps and word formation.pptx - Google Slides.pdf
Allomorps and word formation.pptx - Google Slides.pdf
Abha Pandey
 
LDMMIA GRAD Student Check-in Orientation Sampler
LDMMIA GRAD Student Check-in Orientation Sampler
LDM & Mia eStudios
 
Nice Dream.pdf /
Nice Dream.pdf /
ErinUsher3
 
Introduction to Generative AI and Copilot.pdf
Introduction to Generative AI and Copilot.pdf
TechSoup
 
How to Create an Event in Odoo 18 - Odoo 18 Slides
How to Create an Event in Odoo 18 - Odoo 18 Slides
Celine George
 
Analysis of Quantitative Data Parametric and non-parametric tests.pptx
Analysis of Quantitative Data Parametric and non-parametric tests.pptx
Shrutidhara2
 
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
Energy Balances Of Oecd Countries 2011 Iea Statistics 1st Edition Oecd
razelitouali
 
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
THERAPEUTIC COMMUNICATION included definition, characteristics, nurse patient...
parmarjuli1412
 
Exploring Ocean Floor Features for Middle School
Exploring Ocean Floor Features for Middle School
Marie
 
Sustainable Innovation with Immersive Learning
Sustainable Innovation with Immersive Learning
Leonel Morgado
 
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Webcrawler_Mule_AIChain_MuleSoft_Meetup_Hyderabad
Veera Pallapu
 
Capitol Doctoral Presentation -June 2025.pptx
Capitol Doctoral Presentation -June 2025.pptx
CapitolTechU
 
Overview of Off Boarding in Odoo 18 Employees
Overview of Off Boarding in Odoo 18 Employees
Celine George
 
What are the benefits that dance brings?
What are the benefits that dance brings?
memi27
 
IDF 30min presentation - December 2, 2024.pptx
IDF 30min presentation - December 2, 2024.pptx
ArneeAgligar
 
The Man In The Back – Exceptional Delaware.pdf
The Man In The Back – Exceptional Delaware.pdf
dennisongomezk
 
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Paper 108 | Thoreau’s Influence on Gandhi: The Evolution of Civil Disobedience
Rajdeep Bavaliya
 
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Basic English for Communication - Dr Hj Euis Eti Rohaeti Mpd
Restu Bias Primandhika
 
Battle of Bookworms 2025 - U25 Literature Quiz by Pragya
Battle of Bookworms 2025 - U25 Literature Quiz by Pragya
Pragya - UEM Kolkata Quiz Club
 
LDMMIA Spring Ending Guest Grad Student News
LDMMIA Spring Ending Guest Grad Student News
LDM & Mia eStudios
 
Allomorps and word formation.pptx - Google Slides.pdf
Allomorps and word formation.pptx - Google Slides.pdf
Abha Pandey
 
LDMMIA GRAD Student Check-in Orientation Sampler
LDMMIA GRAD Student Check-in Orientation Sampler
LDM & Mia eStudios
 
Nice Dream.pdf /
Nice Dream.pdf /
ErinUsher3
 
Introduction to Generative AI and Copilot.pdf
Introduction to Generative AI and Copilot.pdf
TechSoup
 
How to Create an Event in Odoo 18 - Odoo 18 Slides
How to Create an Event in Odoo 18 - Odoo 18 Slides
Celine George
 

Class array

  • 1. class Array { private: int size; int *pointer; public: Array() { size=0; pointer=NULL; } void load() { cout <<"Enter the number of integers in the array.nn"; cin >>size; pointer = new int[size]; int i; for (i=0; i< size; i++) { cout <<"Enter interger # " << i+1 <<"n"; cin >>*(pointer+i); } }//end of load void print() { int i =0; cout <<"The array contains " <<size << "integers.nn"; cout <<"They are:n"; while (i < size) { cout <<i+1<<")t"<<*(pointer+i)<<endl; i++; }//end of loop } ~Array() //destructor to delete the array { delete []pointer; } }; void main (void) { Array array1; array1.load(); array1.print(); array1.~Array();