Home > database >  The order of the elements in the class a function template
The order of the elements in the class a function template

Time:09-27

[problem description] write two function template, bubble sort of different types of data and output,
(1) void Bubble_Sort (T a [], int n); N in the array is a data in ascending order
(2) the void outputArray (T a [], int n); For the data elements of an array a output, the main function is defined in three array: int a [8]; Double b [8]; Student c [3]; The Student class has a private data member name, score, the order of the score of the sort is, the output is the output value of the two private data member,
The main function is as follows, please do not modify:
Int main () {//the main function of const int A_COUNT=8, B_COUNT=8, C_COUNT=3; Int a [A_COUNT]={7, 8, 1, 6, 5, 4, 3, 2};//define an int array double b [B_COUNT]={5.5, 2.2, 8.8, 4.4, 1.1, 6.6, 7.7, 3.3};//define a double array Student c [C_COUNT]={{" Zhao ", 90}, {" Qian ", 88}, {" Sun ", 66}};//cout definition Student array & lt; <"A array contains:" & lt; (a, A_COUNT); OutputArray (a, A_COUNT);//cout call a function template & lt; <"B array contains:" & lt; (b, B_COUNT); OutputArray (b, B_COUNT);//cout call a function template & lt; <"C array contains:" & lt; (c, C_COUNT); OutputArray (c, C_COUNT); cout
  • Related