#include <iostream>
int _tmain(int argc, _TCHAR* argv[])
{
int capacity;
char name[30];
char userchoice;
int sold;
Inputsection:
cout << "Hello, Welcome to the movie purchase services:" << endl;
cout << "Please enter a Movie name? Please indicate when you want to stop typing with a %" << endl;
cin.getline(name, 30, '%');
cout << "The Movie that you entered was:" << name << endl;
cout << "What is the ticket capacity for this movie?" << endl;
cin >> capacity;
cout << "The movie capacity for this movie is:" << capacity << endl;
cout << "The number of tickets that are sold for this movie are:" << endl;
cin >> sold;
cout << "The amount of tickets sold are:" << capacity - sold << endl;
cout << " Would ou like to add additonal Information? [Y/N]" << endl;
cin >> userchoice;
if(userchoice== 'Y')
{
goto Inputsection;
}
system("PAUSE");
return 0;
}
i was trying to use a loop to store the input of the user into the array, then be able to cout what is in the array. but i am not am not sure how to go about this part.
#include <iostream>
#include <string>
using std::string;
using std::cout;
using std::endl;
using std::cin;
int main()
{
int n = 0;
int capa[5], size;
char name[30];
char userchoice;
int sold;
Inputsection:
cout << "Hello, Welcome to the movie purchase services:" << endl;
cout << "Please enter a Movie name? Please indicate when you want to stop typing with a %" << endl;
cin.getline(name, 30, '%');
cout << "The Movie that you entered was:" << name << endl;
cout << "What is the ticket capacity for this movie?" << endl;
cin >> size;
// Reads n elements
for(int i = 0; i <n;i++)
{
cout<<" enter element "<<(i+1);
cin>>capa[i];
}
cout << "The movie capacity for this movie is:" << size << endl;
cout << "The number of tickets that are sold for this movie are:" << endl;
cin >> sold;
cout << " Would you like to add additonal Information? [Y/N]" << endl;
cin >> userchoice;
if (userchoice == 'y')
{
goto Inputsection;
}
if (userchoice == 'n')
{
for( int i = 0; i < 5; i++ ) {
capa[i] = i + 1;
cout << capa[i] << endl;
}
system("PAUSE");
return 0;
}
}
i am trying to write a program that continues to accept a movie name (a max of 30 characters), its ticketing capacity, and the number of the tickets sold until the user indicates to stop. The program should display, in table form with the column headings given below, the movie name, ticketing capacity, number of tickets sold, and number of seats available.
Sample Input and Output:
Enter a movie name: Mummy II
Enter its ticketing capacity: 500
Enter number of the tickets sold: 492
Additional data (Y/N)? Y
Enter a movie name: Meet the Parents
Enter its ticketing capacity: 600
Enter number of the tickets sold: 600
Additional data (Y/N)? N
Movie/Capacity/Tickets Sold/Seats Available
------------------------------------------------------
Mumm II/500/492/8
Meet the Parents/600/600/0