Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - At the console input, create an integer array with the size of 5, and the input and output are loop, which is realized by object-oriented.
At the console input, create an integer array with the size of 5, and the input and output are loop, which is realized by object-oriented.
# Contains? & ltiostream & gt

Use? Namespace? std

Class? IntegerReader{

Public:

IntegerReader(const? int? cnt)

{

Array? =? 0;

Count? =? cnt

What if? (Does it count? & gt? 0)

Array? =? New? int[count];

}

~IntegerReader()

{

What if? (Does it count? & gt? 0)

{

Delete []? Array;

Array? =? 0;

}

}

Invalid? Reading ()

{

cout? & lt& lt? "Please? Input? 5? Integer: "? & lt& lt? endl

For what? (int? Me? =? 0; ? Me? & lt? Count; ? i++)

{

cin? & gt& gt? array[I];

}

}

Invalid? Sort ()

{

int? tmp = 0;

For what? (int? Me? =? 0; ? Me? & lt? Count; ? i++)

{

For what? (int? j? =? 0; ? j? & lt? count- 1; ? j++)

{

What if? (array[j]& gt; Array [j? +? 1])

{

tmp? =? array[j];

array[j]? =? Array [j? +? 1];

Array [j? +? 1]? =? tmp

}

}

}

}

Invalid? Output ()

{

For what? (int? Me? =? 0; ? Me? & lt? Count; ? i++)

{

cout? & lt& lt? array[I];

What if? (me? & lt? Count? -? 1)

cout? & lt& lt? ",?" ;

}

cout? & lt& lt? endl

}

Private:

intcount

int? *? Array;

};

Invalid? Master ()

{

IntegerReader? rdr(5);

rdr。 read();

rdr。 sort();

rdr。 output();

}