rendered paste body// Lab2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <string>
#include <stdio.h>
#include <time.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
string style;
int amount;
int tamount;
char question;
const MAX_WALLET = 10;
const MAX_3X5 = 6;
const MAX_8X10 = 4;
const MAX_POSTER = 1;
cout << "*************************************************" << endl;
cout << "*************************************************" << endl;
cout << "************Welcome to Photo Hut 3042************" << endl;
cout << "*************************************************" << endl;
cout << "*************************************************" << endl;
cout << endl;
cout << endl;
cout << "Please select a letter for the type of photo you would like to take: " << endl;
enum type {WALLET, P3X5, P8X10, POSTER};
type pPhoto=WALLET;
char photo;
cout << "(a)Wallet, (b)3x5, (c)8x10 or (d)Poster? " << endl;
cin >> photo;
switch (photo)
{
case 'a':
case 'A':
pPhoto=WALLET;
break;
case 'b':
case 'B':
pPhoto=P3X5;
break;
case 'c':
case 'C':
pPhoto=P8X10;
break;
case 'd':
case 'D':
pPhoto=POSTER;
break;
default:
cout << "Incorrect Entry. Please Try Again." << endl;
}
switch (pPhoto)
{
case WALLET:
style="Wallet";
break;
case P3X5:
style="3x5";
break;
case P8X10:
style="8x10";
break;
case POSTER:
style="Poster";
break;
}
cout << "Great choice! Your mother would love some "<< style <<"'s of you!" << endl;
switch (pPhoto)
{
case WALLET:
amount=10;
break;
case P3X5:
amount=6;
break;
case P8X10:
amount=4;
break;
case POSTER:
amount=1;
break;
}
bool max;
switch(pPhoto)
{
case WALLET:
for(tamount = 1;tamount <= 10;tamount ++)
{
cout << "**" << endl << "**" << endl;
cout << "You have taken " << tamount << " photos out of the " << amount << " alotted for this size." << endl << "You have " << 10 - tamount << " left." << endl<< "Would you like to take another? Y or N?" << endl;
cin >> question;
while (question != 'n' && question != 'y')
{
cout << "Error: Invalid input given! Please select either Y or N." << endl;
cin >> question;
}
if(question == 'n')
{break;}
}
break;
case P3X5:
for(tamount = 1;tamount <= 6;tamount ++)
{
cout << "*****" << endl << "*****" << endl << "*****" << endl;
cout << "You have taken " << tamount << " photos out of the " << amount << " alotted for this size." << endl << "You have " << 6 - tamount << " left." << endl<< "Would you like to take another? Y or N?" << endl;
cin >> question;
while (question != 'n' && question != 'y')
{
cout << "Error: Invalid input given! Please select either Y or N." << endl;
cin >> question;
}
if(question == 'n')
{break;}
}
break;
case P8X10:
for(tamount = 1;tamount <= 4;tamount ++)
{
cout << "******" << endl << "******" << endl << "******" << endl;
cout << "You have taken " << tamount << " photos out of the " << amount << " alotted for this size." << endl << "You have " << 4 - tamount << " left." << endl<< "Would you like to take another? Y or N?" << endl;
cin >> question;
while (question != 'n' && question != 'y')
{
cout << "Error: Invalid input given! Please select either Y or N." << endl;
cin >> question;
}
if(question == 'n')
{break;}
}
break;
case POSTER:
for(tamount = 1;tamount <= 1;tamount ++)
{
cout << "*******" << endl << "*******" << endl << "*******" << endl << "*******" << endl << "*******" << endl;
cout << "You have taken " << tamount << " photos out of the " << amount << " alotted for this size." << endl << "You have " << 1 - tamount << " left." << endl<< "Would you like to take another? Y or N?" << endl;
cin >> question;
while (question != 'n' && question != 'y')
{
cout << "Error: Invalid input given! Please select either Y or N." << endl;
cin >> question;
}
if(question == 'n')
{break;}
}
break;
}
cout << "*************************************************" << endl;
cout << "*******Thank you for using Photo Hut 3042.*******" << endl;
cout << "*********************Goodbye!********************" << endl;
cout << "*************************************************" << endl;
return 0;
}