#include <iostream>
#include <string>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
int x, y, temp, remainder, n, a=0, b=1, c=0, N, N2, h, w,s, z, v, size, count, exit;
char option, option2, option3;
cout<<"\n\n\t\t\tMAIN MENU";
cout<<"\n\nPress A for Math Algorithms";
cout<<"\n\nPress B for Figures";
cout<<"\n\nPress C for the program to Exit";
cout<<"\n\nEnter option:";
cin>>option;
switch (option)
{
case 'A':
{
cout<<"\t\t\n\nPress 1 for Euclidean Algorithm";
cout<<"\n\nPress 2 for Ulam Sequence";
cout<<"\n\nPress 3 for Fibonacci Series";
cout<<"\n\nPress 4 for Fermat Little Test";
cout<<"\n\nEnter option:";
cin>>option2;
if (option2 == '1')
{
cout<<" ";
cout<<"\nInput one number:";
cin>>x;
cout<<"\nInput another number:";
cin>>y;
if (x<y)
{
temp = x;
x = y;
y = temp;
}
remainder = x;
while (remainder != 0)
{
temp = remainder;
remainder = y % remainder;
y = temp;
}
cout <<" ";
cout <<"\n\nThe GCD is:"<<y;
}
break;
if (option2 == '2')
{
cout<<"\t\n\nInput N:";
cin>>n;
if(option2 == '4')
{
cout<<"\t\n\nInput N:";
cin>>N2;
while ((2^n)%N==2)
{
cout<<N2<<"has a high probability to be a prime number"<<endl<<endl;
}
}
break;
case 'B':
case 'b':
cout<<"Choose what to print"<<endl
<<"1. Print a rectangle"<<endl
<<"2. Pring a triangle"<<endl
<<"3. Print a rectangle outline"<<endl<<endl
<<"Input the letter for the action you want to accomplish.: ";
cin>>option;
switch (option)
{
case '1':
cout<<"A. Print a Rectangle"<<endl
<<"Please input the desired Height: ";
cin>>h;
cout<<"Please input the desired Width: ";
cin>>w;
cout<<endl;
count = 1;
while (count <= h)
{
cout<<setw(w)<<setfill('W')<<""<<endl;
count++;
}
cout<<endl;
break;
case '2':
cout<<"B. Print a triangle\n"<<endl
<<"Please input the desired size of the triangle."<<endl;
cin>>s;
cout<<endl;
count = 1;
while (count <= s)
{
cout<<setw(count)<<setfill('Y')<<""<<endl;
count++;
}
cout<<endl;
break;
case '3':
cout<<"C. Print a Rectangle Outline"<<endl
<<"Please input the desired Height: ";
cin>>h;
cout<<"Please input the desired Width: ";
cin>>w;
cout<<endl;
count = 1;
while (count <= h)
{
if (count == 1)
cout<<setw(w)<<setfill('Z')<<""<<endl;
else if (count == h)
cout<<setw(w)<<setfill('Z')<<""<<endl;
else
cout<<'Z'<<setw(w - 1)<<setfill(' ')<<'Z'<<endl;
count++;
}
cout<<endl;
break;
default:
cout<<"Error. Invalid Input.";
}
break;