C++ :: Airline Reservation - Assign Seats On Each Flight

Jun 24, 2013

A small airline has just purchased a computer for its new automated reservation system. you have been asked to program a new system. Develop a program to assign seats on each flight of the airline's only plane (capacity = 10 seats) your program should display the following alternatives

Please type 1 for "SMOKING"
Please type 2 for "Non-Smoking"

if the person types 1, your program should assign a seat in the smoking section (seats 1-5). If a person types 2, your program should assign a seats in the non-smoking section (seats 6-10). your program should then print a boarding pass indicating the person's seat number and whether it is in the smoking or non-smoking section of the plane.

Use a single-subscripted array to represent the seating chart of the plane. Initialize all the elements of the array to 0 to indicate that all seats are empty. As each seats is assigned, set the corresponding elements of the array to 1 to indicate that the seat is no longer available.

Your program should never assign a seat that has already been assigned. When the smoking section is full, your program should ask a person if it is acceptable to be placed in the non-smoking area section ( and vice versa ), If yes, make the appropriate a seat assignment. If no, print the message " Next flight leaves in 3 hours! ".

View 5 Replies


ADVERTISEMENT

C++ :: Airline Reservation Simulator - Binary File Errors

Aug 11, 2014

For a big project for school I have to make an airline reservation simulator but I have run into a problem. I want to save the the flight code and its location in a binary file so that I can obtain a code according to the location but this happens:

[URL] ... (link to current output and expected output)

Here is the source class

class file {
private:
char code[8];
char from[20];
public:
void input();

[Code] ....

View 4 Replies View Related

C/C++ :: Create Program To Calculate Flight Time And Fuel Burn Of Airplane?

Aug 8, 2014

I'm trying to create a program to calculate the flight time and fuel burn of an airplane. However when I repeated the whole calculation, it did not show any data or result like the previous calculation. In addition, the "If" statement that I used to test the "fuelRemain" doesn't work properly. I can't figure out why.

Here are the outputs [URL]

#include <iostream>
#include <fstream>
#include <string>

[Code].....

View 2 Replies View Related

C/C++ :: Random Array Filling Of Airline Seating Assignment?

Dec 25, 2014

int firstarray[12][7] = { };
double firstClass(int airplane, int seats, double price)
{cout<<setw(60)<<"---------------------...
cout<<setw(60)<<"You are in **first class** booking screen

[Code] .....

The thing is, The first 2 rows having 7 columns like this:

0000000
0000000

User gives an input of seats reserved, for example user inputs 3 seats, then the program should give output like:

1110000
0000000

I will not ask any specific seat but put assign seats randomly where available.. How to do it?

View 5 Replies View Related

C++ ::  can't Get Program To Print Only Available Seats

May 1, 2014

I can't get my program to print only AVAILABLE SEATS; instead it prints Both Available and Taken.

//Program allows you to delete and add seats to the Airplane. Also to upload seat settings as a text file.
#include <iostream>
#include <fstream> //file stream for text file
#include <string>
using namespace std;

[code].....

View 6 Replies View Related

C/C++ :: Program That Assigns Passenger Seats In Airplane?

Apr 26, 2014

I am supposed to create a program that assigns passenger seats in an airplane. First I am suppose to generate an array with random X's. Then I am supposed to ask the user to pick a seat. From there I am supposed to check if the seat is already taken. My problem is when I ask them to pick a seat it generates an array of nothing but X's. Also how would I allow the program to accept the seat numbers as either uppercase or lowercase letters. for example if they want seat '3C' how would I allow them to enter the C as either a lower case or upper case.

//Oscar Lopez
#include <iostream>
#include <cmath>

[Code].....

View 2 Replies View Related

C/C++ :: How To Change Seat Reservation

Jun 9, 2014

#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main(void) {
char answer;//예약 선택
int select1 = 0, select2 = 0, i, j;//필요 변수 선언
int seat[5][5] = { 0 };

[Code] .....

well this is my seat reservation code and my program show the seats like

1 1 2 3 4 5
2 0 0 0 0 0
3 0 0 0 0 0
4 0 0 0 0 0
5 0 0 0 0 0

I want to change these numbers to "■" and "□"(when it's empty seat)

View 1 Replies View Related

C/C++ :: Sorting Airplane Seats And Their Passengers By Seat Order?

May 2, 2014

The assignment is to read in a text file of passenger names (first and last initial), seats (A1, B1, C1, D1, A2, etc.), and ticket prices. The output is specified to be a table of passengers and their seats sorted by seat order, and I also have to print the minimum and maximum ticket prices along with the owner of each ticket, along with the average of all ticket prices. My arrays are all reading in correctly, and the minimum, maximum, and average ticket prices were all easy to find. My problem is the sorting.

We were introduced to arrays a couple weeks ago and this is our first time doing any sorting. We are supposed to use a bubble sort, and while I think I gather how to use a bubble sort, it's not working in my program (so obviously I don't really know how to use it). I have tried several different things, and sometimes a few seats/names will switch around (never the way I want them to) and sometimes nothing will happen at all.

New to programming, not trying to get homework done for me, need to bubble sort airplane passengers and seats by seat order (A1, B1, C1, D1, A2, etc).

My input looks like this:

A Z A1 555.55

repeat with different initials, seats, and prices however many times the user sees fit.

I have a 1D character array for the columns(A - D), a 1D integer array for rows (1 to maximum integer), 1D float array for prices, and 2D array for name initals.

Here's the function to read in the arrays:

void read_Arrays(char seat_cols[], int seat_rows[], char name[][LAST], float price[]) {
int i, j;
for(i = 0; i < FIRST; i++) {
for(j = 0; j < LAST; j++) {
scanf(" %c", &name[i][j]);
} scanf(" %c %d %f ", &seat_cols[i], &seat_rows[i], &price[i]);
}
}

Here's the sort. The way we were shown to do it was with a 'for' loop nested within a 'do while':

{
do {
flag = 0;
for(i=0; i < ROWSIZE-1; i++) {
if(seat_rows[i] > seat_rows[i + 1]) {

[code]....

View 6 Replies View Related

C++ :: Airport Reservation Program - Binary Files Comparing

Aug 18, 2014

I am working on a airport reservation program and i have run into a brick wall. i want to ask the user its name, gender, passport no, age, destination, and travel class and figure out the day and flight code of the flight which i have saved in a binary file. now every thing works fine except the code and the day.

The programs important section

the flight class Code:
class flights {
char code[9],location[21];
public:
void display();
char *retloc() //to get the Location

[Code] .....

View 13 Replies View Related

C/C++ :: Train Reservation Program - Declaration Terminated Incorrectly

Dec 8, 2013

//PROGRAM - TRAIN RESERVATION
#include<iostream.h>
#include<conio.h>
#include<string.h>
#include<dos.h>
#include<stdio.h>
#include<fstream.h>
#include<process.h>

[Code] .....

View 1 Replies View Related

C++ :: Assign Value To Interval

Oct 2, 2014

This is my code , i should Assign value val to interval [keyBegin, keyEnd).

#include <assert.h>
#include <map>
#include <limits>

void assign( K const& keyBegin, K const& keyEnd, const V& val ) {

if(!(keyBegin<keyEnd))

[Code] .....

View 7 Replies View Related

C++ :: Assign Value Dynamically?

Jun 18, 2013

I have array of pointers and when i tried to assign values dynamically all array items have the same value which is last value.

char* list[];
int DynamicDemo(void)
{

[Code].....

View 2 Replies View Related

C++ :: How To Assign City To The List

Apr 21, 2013

I am having some difficulties knowing how to assign city to the list.

Code:

class DestinationList
{
private:
int num;
// number of objects in the list
Destination list[MAX_CITIES];
// array of destinations
public:

[Code]...

View 14 Replies View Related

C :: Assign A Pointer To A Function?

Jan 24, 2013

How can we assign a pointer to a function? const char* function_name(), here what exactly does the pointer point to?

View 4 Replies View Related

C :: How To Assign Value From A Function To Variable

May 26, 2013

Im starting with C. Like I said in the title, how do I assign the value from a function to a variable? I mean I have this function:

Code:

int EnteroAleatorio(){
rand();
return rand();
}

and I would like to assign the value of EnteroAleatorio to a variable in my main function, but when I try to do it and compile, I got the next error: non-lvalue in assignment

View 1 Replies View Related

C++ :: Why Assign A Pointer To Array

Jan 15, 2015

Why would you ever assign a pointer to an existing array?Take this link for example. URL....I understand that pointers use dynamic memory allocation so they are much more flexible then a built in array, but if you already have an existing array, don't you already have static memory allocation for that array? Why bother assigning a pointer? Regardless of the pointer, doesn't the program still allocate static memory to the array anyway?

View 3 Replies View Related

C/C++ :: How To Assign Text To A Textbox

Apr 24, 2015

I have a silverlight app that uses TextBox XAML controls.

In the c++ code-behind, IXRTextBoxPtr types are associated with these textboxes using "FindName" like this:

FindName(L"ColNum3", &m_pColNum3);

(where ColNum3 corresponds with the XAML CODE like this: )

Then, the code assigns the pointer like this:

std::wstring wsTransfer; // gets the wstring from imput
const WCHAR * wpszInput;
wpszInput = wsTransfer.c_str();
m_pColNum3->SetText(wpszInput);
but the display does not show the text data.

What am I missing? What steps am I missing to have this text modification display on the screen?

View 6 Replies View Related

C Sharp :: How To Assign String Value In C#

Dec 3, 2012

Below assignation? It is a bit confusing.

myString = ""myInteger"is";

View 1 Replies View Related

C++ :: How To Assign A Rectangle To Images

Apr 26, 2012

I am making a game Pong, and have been struggling with the collision aspect between the baal hitting off the paddle. I have created a Class, to draw a rectangle, to work with collision however I dont know how to assign the rectangle to the images of the ball and paddle.

#include "stdafx.h"
#include <iostream>
#include <time.h>
#include <vector>
#include <cmath>
#include "gwin.h"
const int NUMBEROFBALLS = 1;

[Code] .....

View 1 Replies View Related

C++ :: Vector Assign In Two Dimensions

Oct 29, 2013

If I have a one-dimensional array of length 10, vector<int> x, and I want to assign all the elements to value 5, then I can do the following:

Code:
vector<int> x(10);
x.assign(10, 5);

(I can also do this in x's constructor, but in my scenario I want to repeatedly assign x's elements in a loop, without having to construct a new vector in memory each time.)

If I now have a two-dimensional vector, vector<vector<int> > y, and I want to assign the first vector to length 20, the second vector to length 10, and each element in the second vector to value 5, then I can do the following:

Code:
vector<vector<int> > y(20, vector<int> (10));
for (int i = 0; i < 20; i++) {
y[i].assign(10, 5);
}

But is it possible to do this without the loop? Can I make the two-dimensional assignment in just one line, in the same way that the one-dimensional assignment was made?

Perhaps it would like something like the following, which is not correct but illustrates what I mean:

Code:
y.assign(20, assign(10, 5));

Another way of doing this would be the following:

Code:
y.assign(20, vector<int> (10, 5));

But wouldn't this cause the memory in the second array to be dynamically allocated each time? I don't want to do this - I want to keep the same memory, but just assign the elements to 5.

View 1 Replies View Related

C :: Assign Bit Widths Manually To Numbers?

May 13, 2013

I'm trying to learn how to assign bit widths manually to numbers. Here's my code below:

Code:
#include <stdio.h>
struct node {
unsigned long x : 53;

[Code].....

And I get the following complaint from the -Wall compilation flag, " warning: format '%lu' expects argument of type 'long unsigned int', but argument 2 has type 'long unsigned int:53' " which is talking about anna.z, to be specific.

How do I add field width to printf?

View 3 Replies View Related

C :: How To Assign String Hello To Structure Member

Feb 17, 2015

See the simple code below. The compiler gives message:

assigning to type "char[20]" from type "char *".

I've tried everything else that seems reasonable but none works. How can I assign string Hello to the structure member?

Code:
int main() {
struct strc1
{
char msg1[20];
char msg2[5];
}
talk;
talk.msg1 = "Hello";
}

View 5 Replies View Related

C :: Assign Pointer Of A String To Integer

Mar 22, 2014

I have this code:

Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
[code]....

What I want is basically to assign to the *p the pointer of the string so that i could do the following printf(" print string %s",*p); so i dont know how to do that.

View 6 Replies View Related

C :: Assign Strings To Double Pointer

May 2, 2013

When I try to assign strings to a double pointer, it only prints out the last string when I try to print everything out, and then it segfaults.

Code:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <assert.h>
main(){
char **test = calloc(3,sizeof(char));

[Code] .....

Am I assigning something the wrong way? Also, I am trying to avoid using array notation in order to practice, at least for the assigning of the strings.

View 11 Replies View Related

C :: Assign System Call To Variable

Feb 22, 2014

I have to ask system (linux) for a value and then assign it to the variable.

Example:

unsigned char date[] = system("date");

Of course this is wrong, but illustrated what is my goal.

How to achieve this effect ? I've heard about POSIX but how to include and use it.

View 10 Replies View Related

C :: Cannot Assign Struct Member Values

Feb 13, 2015

I'm a C beginner trying to assign struct member values to other struct members to create a list.

I've tried dot notation, pointer notation, strcpy, memcpy, memmove and normal assignment.

Nothing has worked.

cust_list.h

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved