// Solution of Assignment 5

#include <iostream>
#include <iomanip>
#include <windows.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
#include <dos.h>
#include <stdlib.h>
using namespace std;
int main()
{
	char **b, chr;
	int *n;
	int i, j;
	
	for (;;)
	{
		system("cls");
		cout << "Enter number of rows: ";
		n = new int;
		cin >> *n;

		b = new char*[*n];
		for (i = 0; i < *n; i++)
			b[i] = new char[*n-i];

		for (i = 0; i < *n; i++)
			for (j = 0; j < *n - i; j++)
				b[i][j] = '*';
		
		for (i = 0; i < *n; i++)
		{
			for (j = 0; j < *n - i; j++)
				cout << b[i][j];
			cout << endl;
		}


		for (i = 0; i < *n; i++)
			delete [] b[i];
		delete [] b;
	
		cout << "Enter number of rows: ";
		cin >> *n;

		int (*c) [3] = new int[*n][3];
		for (i = 0; i < *n; i++)
			for (j = 0; j < 3; j++)
				c[i][j] = i + j;

		for (i = 0; i < *n; i++)
		{
			for (j = 0; j < 3; j++)
				cout << setw(6) << c[i][j];
			cout << endl;
		}
	
		delete [] c;
		delete n;
		cout << "To stop, press n, else press "
			<< "any other key: ";
		chr = getch();
		if (toupper(chr) == 'N')
			exit(0);
	}

	return 0;
}
