|
|
#include <iostream>
#include <string.h>
#include <iomanip>
#include <fstream>
#define p printf
using namespace std;
void menu(int &selection);
int the_count();
int the_random();
int main()
{
int selection;
do
{
menu(selection);
if (selection == 1)
{
system("cls");
the_count();
}
else if (selection == 2)
{
system("cls");
the_random();
}
else if (selection == 3)
{
system("cls");
cout << "The End!!!" << endl;
system("pause");
}
else
{
system("cls");
cout << "Invalid selection!" << endl;
system("pause");
}
}
while (selection != 0);
return 0;
}
void menu(int &selection)
{
system("cls");
cout << "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" << endl;
cout << "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" << endl;
cout << "$$$$ T H I S I S A T E S T $$$$" << endl;
cout << "$$$$ $$$$" << endl;
cout << "$$$$ P R O G R A M $$$$" << endl;
cout << "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" << endl;
cout << "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" << endl;
cout << "$$$$ $$$$" << endl;
cout << "$$$$ $$$$" << endl;
cout << "$$$$ 1 Count the Characters $$$$" << endl;
cout << "$$$$ 2 Random Numbers $$$$" << endl;
cout << "$$$$ 3 Exit program $$$$" << endl;
cout << "$$$$ $$$$" << endl;
cout << "$$$$ $$$$" << endl;
cout << "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" << endl;
cout << "$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$" << endl << endl << endl << endl;
cout << "Enter your selection : " ;
cin >> selection;
}
int the_count()
{
int items = 0;
char another = 'Y';
do
{
cout << "Would you like to run the receipt program again? (Y/N) : ";
cin >> another;
if(toupper(another)=='N');
{
cout << "**************************************" << endl;
cout << "**************************************" << endl;
cout << "******* T H A N K Y O U *******" << endl;
cout << "******* F O R U S I N G *******" << endl;
cout << "******* T H I S P R O G R A M *******" << endl;
cout << "**************************************" << endl;
cout << "**************************************" << endl;
return 0;
}
}while(toupper(another)=='Y');
}
int the_random()
{
int strlength;
int item = 0;
char *str;
char another = 'Y';
do
{
p("\nEnter the string: ");
gets(str);
strlength=strlen(str);
p("\nThe length of the string is %d.",strlength);
cin >> another;
if(toupper(another)=='N');
{
cout << "Thank You For Using This Program" << endl;
return 0;
}
}while(toupper(another)=='Y');
}
|
|
|
|
|