0

```
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int main()
{
string Choice;
string On, off;
char a = 'A';
int i = 0, j= 0 , NUM = 2 , z = 1;
cout << "Please enter 'start' to start the program\n";
cin >> On;
if (On == "start")
{
cout << endl << "Please enter 'choice1' for pattern A or 'choice2' for pattern B \n ";
cin >> Choice;
cout << endl;
if (Choice == "choice1")
{
for(j=-NUM; j<=NUM; j++){
for(i=-NUM; i<=NUM; i++){
if( abs(j)==abs(i) && j < 1 )
{
cout<<a;
a++;
}
else if (abs(j)==abs(i) && j < 3)
{
cout<<z;
z++;
}
else
{
cout<<" ";
}
}
cout<<endl;
}
}
}
if (Choice == "choice2")
{
for(j=-NUM; j<=NUM; j++){
for(i=-NUM; i<=NUM; i++){
if( abs(j)==abs(i) && j < 1 )
{
cout<<z;
z++;
}
else if (abs(j)==abs(i) && j < 3)
{
cout<<a;
a++;
}
else
{
cout<<" ";
}
}
cout<<endl;
}
}
cout << "enter 'stop' to stop the program\n";
cin >> off;
while (off == "stop") {
{
return 0;
}
}
cin.get();
return 0;
}
```