#include <iostream>
#include <cmath>
#include <iomanip>
#include <fstream>
#include <stdio.h>
using namespace std;
int main ()
{
// Declared Variables.
int choice;
ifstream inputFile;
inputFile.open("C:\\temp\\RowPrices.txt");
if (!inputFile)
{
cout << "Error opening file.\n";
}
inputFile.close();
// These are my details.
cout << "******************************************************* \n" << endl;
cout << "Name: Bhupendra Valji Patel\n\n";
cout << "Student number: 16273450\n\n";
cout << "Date: 30/03/08\n\n";
cout << "File name: assignment2_16273450\n\n";
cout << "******************************************************* \n\n" << endl;
// Theses are the 5 choices that are available to the user.
cout << " Program that can be used by a small theatre to sell tickets for performance.\n\n\n ";
cout << " 1. View Available Seats\n ";
cout << " 2. View Seating Prices\n ";
cout << " 3. View Ticket Sales\n ";
cout << " 4. Purchase a Ticket\n ";
cout << " 5. Exit the Program\n ";
cout << " \n Enter your choice (1-5): \n\n";
cin >> choice;
// This will make the executable file background Green with blue font.
system ("COLOR 8");
// This is a while loop which takes care of ivalid inputs.
while ( choice < 1 || choice > 5)
{
cout << " THE CHOICE ENTERED IS INCORRECT. PLEASE ENTER CHOICE FROM 1-5 ONLY!!\n";
cin >> choice;
}
// This is choice one using an if statement.
if( choice ==1 )
{
cout << "\n\t\tSeats";
cout << " \n\t123456789012345678901234567890\n\n";
cout << "Row 1\t##############################\n";
cout << "Row 2\t#############***##############\n";
cout << "Row 3\t###########**###**############\n";
cout << "Row 4\t#########**#######**##########\n";
cout << "Row 5\t########*###########*#########\n";
cout << "Row 6\t########*##*#####*##*#########\n";
cout << "Row 7\t#######*#############*########\n";
cout << "Row 8\t#######*#############*########\n";
cout << "Row 9\t########*###*###*###*#########\n";
cout << "Row 10\t########*####***####*#########\n";
cout << "Row 11\t#########**#######**##########\n";
cout << "Row 12\t###########**###**############\n";
cout << "Row 13\t#############***##############\n";
cout << "Row 14\t##############################\n";
cout << "Row 15\t##############################\n";
cout << "\n\tLegend: * = Sold";
cout << "\n\t\t# = Available\n\n";
}
// This is the choice two using an if statement.
if( choice ==2 )
{
cout << "\nRow 1 = $40\n";
cout << "Row 2 = $40\n";
cout << "Row 3 = $35\n";
cout << "Row 4 = $35\n";
cout << "Row 5 = $30\n";
cout << "Row 6 = $25\n";
cout << "Row 7 = $25\n";
cout << "Row 8 = $10.50\n";
cout << "Row 9 = $10.50\n";
cout << "Row 10 = $10.50\n";
cout << "Row 11 = $10.50\n";
cout << "Row 12 = $10.50\n";
cout << "Row 13 = $10.50\n";
cout << "Row 14 = $10.50\n";
cout << "Row 15 = $10.50\n\n";
ofstream outputFile;
outputFile.open("C:\\temp\\RowPrices.txt");
outputFile << "RowPrices\n";
outputFile << "\nRow 1 = $40\n";
outputFile << "Row 2 = $40\n";
outputFile << "Row 3 = $35\n";
outputFile << "Row 4 = $35\n";
outputFile << "Row 5 = $30\n";
outputFile << "Row 6 = $25\n";
outputFile << "Row 7 = $25\n";
outputFile << "Row 8 = $10.50\n";
outputFile << "Row 9 = $10.50\n";
outputFile << "Row 10 = $10.50\n";
outputFile << "Row 11 = $10.50\n";
outputFile << "Row 12 = $10.50\n";
outputFile << "Row 13 = $10.50\n";
outputFile << "Row 14 = $10.50\n";
outputFile << "Row 15 = $10.50\n\n";
outputFile.close();
}
// This is the choice two using an if statement.
if( choice ==2 )
{
}
// This is the choice three using an if statement.
if( choice ==3 )
{
}
system("pause");
return 0;
}
wafie 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.