#include #define MAX 10 class insertion { int a[MAX], n; public : void read(); void sort(); void display(); }; void insertion :: read() { int i; cout << "\nEnter the size of the array : "; cin >> n; cout << "\nEnter the elements : \n"; for (i = 1; i <= n; i++) cin >> a[i]; } void insertion :: sort() { int i, j, key; for (i = 2; i <= n; i++) { key = a[i]; j = i - 1; while (j >= 1 && a[j] > key) { a[j + 1] = a[j]; j = j - 1; } a[j + 1] = key; } } void insertion :: display() { int i; cout << "\nThe Sorted list in Ascending order is :"; for (i = 1; i <= n; i++) { cout << "\n"; cout << a[i]; } } int main() { insertion s; s.read(); s.sort(); s.display(); return 0; }