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


ADVERTISEMENT

C++ :: Multiply Number Of Seat And Ticket - Return Value Not Working

Dec 20, 2013

I have a code in here that u will multiply the number of seat and the number of ticket. I think I got the correct return value but it's still not working when i times it it always = 0 ...

#include<iostream>
#include<iomanip>
#include<string>
#include<stdio.h>
#include<fstream>
int getBill(int seat);
int getPos(char seat);

[Code] ....

View 14 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++ :: 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 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++ :: 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++ :: 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++ :: Coin / Money Change Code Doesn't Give Exact Change

Feb 20, 2013

My coin/money change code works when there can be an exact change each time, i.e. when the 1 cent option is available. However, when the change options are only $10, $5, $1, 25 cents and 10 cents, it does not give me what I want for instance, I wanted to get change for $237.80, I was expecting to get:

23 10's, one 5, two 1's and 8 dimes. However, the code below is giving me 23 10's, one 5, two 1's and 3 quarters (there is no option left for the 5 remaining cents).how to fix it?

Code:
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
void change(double cents, int a[]);
int main() {
double Dollars;
double cents;

[code]...

View 14 Replies View Related

C :: Way To Change Font

Mar 6, 2015

how to use a keyboard. I have the program running now in Dev-C++, but the standard display letters on the monitor are small and sort of boring.Within a C program, is there a way to change the font to something stylish? Enlarge the letters? Change the color from letter to letter?

In the old days, there was graphics.h, but that isn't included now, and I would prefer to use some modern extension. I'd like to write it on Win7, then move it to Linux on Raspberry Pi. It would be nice to avoid a full-scale graphics system like OpenGL.

View 1 Replies View Related

C++ :: How To Change Nth Value In TXT File

Nov 14, 2013

I have a .txt file which contains a large amount of ones and zeros (tile map for a game) and basically I just want to know how to change say just the 12th value in the file from a 1 to 0 .....

View 2 Replies View Related

C++ :: Value In Loop Won't Change?

Sep 3, 2014

I am working on a program that is supposed to do I/O file streaming. I dont know if I can properly explain how its supposed to work but I have found the error on my code, I just dont know WHY the error is happening? If you look in the while loop, count changes values like it should, but MOVE and TIP doesnt. Count starts at value 2. So move is 108. Then count becomes 4, but move stays at 108?

tring rec;
fstream myfile("File.txt", ios::in | ios::out);
myfile.seekg(myfile.tellg(), ios::beg);
myfile.seekp(51, ios::beg);

[Code]....

The lines of code im getting errors on is

int move = count * 54;
int tip = move + 51;

Move wont change its value? It stays 108, causing this infinite while loop. Where is the error in my code to cause move to not change values like count does?

I seem to be struggling with I/O File streaming :(

View 2 Replies View Related

C++ :: How To Change Directory

Apr 24, 2014

How to change directory in c++ ( windows ) I want to go to the folder "example2" and I delete some files and then return to the original folder c++ - windows

View 7 Replies View Related

C++ :: Filename Does Not Change

Sep 26, 2012

this is the code:

Code:
#include <stdio.h>
#include <string>
#include <iostream>
using namespace std;
int main () {
int result,i,j;

[Code] ....

and it doesn't find it. it says the the word:"Users" is incorrectly formed universal character name ....

View 2 Replies View Related

C++ :: Using Pointers To Change Some Value On The Fly?

May 13, 2015

I've got an interface that provides the methods that are to be implemented

Code:
class A {
virtual void A() = 0;
}
class B : public A {
std::string operator<<(const std::string& lhs);

[Code] ....

I don't know why the << operator in B is never called..

View 5 Replies View Related

C++ :: How To Change Font Size

May 19, 2013

how am i supposed to alter font size of text which appear in output screen?

View 1 Replies View Related

C :: Program To Change Name Of A Variable

Jun 15, 2013

if there is a program which i can use to change the name of a variable in a c program for example if i declare a variable like

Code:

int ch;
printf("%d", ch);

Can i later change the name of the ch variable to lets say "number" the code now becomes

Code:

int number;
printf("%d", number);

View 6 Replies View Related

C :: How To Change The Numbers Into Asterisk

Oct 10, 2014

i have my basic C program here (i'm new to C language):

Code:

#include <stdio.h>
int main()
{
int grade;
int A=0;
int B=0;
int C=0;
int D=0;
int E=0;

[Code]....

As you can see, it's only for counting how many students got the grades from A to E, but the problem is that i need to change it from numbers into asterisk

for example: 4 students got the grade A, and 3 students got the grade B

instead of displaying

A=4
B=3

i want it to display

A=****
B=***

View 11 Replies View Related

C# :: Change File Format

Jun 20, 2013

I have installed VS 2010 and VS 2012. VS 2012 uses SqlServer CE 3.5 and VS 2012 uses SqlServer CE 4.0.The problem is that when a project uses a 3.5 file it tries to open it with 4.0 even if the app.config says to use the 3.5 provider. The version of the assembly is pulled right out of the GAC. I uninstalled 4.0 and the reference auto updated its version to 3.5.1. However after installing 4.0 again it changes to 4.0. The error I am getting is that 4.0 cannot open a 3.5 file....they changed the file format from 3.5 to 4.0 and they are not compatible.

View 2 Replies View Related

C++ :: Any Way To Change Font Using Code

Dec 20, 2014

Is there a way to change the Font size using code?

View 5 Replies View Related

C++ :: Getting Optimal Change In Cents

Sep 4, 2014

On one of my assignments I have to find the optimal change. For example, if I were to have 70 cents and had only quarters, dimes and pennies, the best way to receive change using less coins all together would be 2 quarters and 2 dimes (4 coins all together should be displayed).

All in all, I understand my assignment, however there is something I don't know how to do (or can't recall how to) and that is finding the the highest number in an array to use in a function and be able to compare it.

#include<iostream>
using namespace std;
//function in which amount = money, changeArray is the array where money is stored,
//and numCoins the amount of coin types there are available in the array

int optimalChange(int amount, int * changeArray, int numCoins) {

[Code] .....

What I'm stuck with, is that I don't remember how to get the highest number from the array that way I can compare it with the total amount when I'm building my function. Also, the function has to call itself recursively.

View 1 Replies View Related

C++ :: How To Change Array To Dynamic

Sep 13, 2013

So this is the code I have so far, I didn't know it had to be a dynamic array so how would I Utilize dynamic array allocation to size the modal array

#include <iostream>
using namespace std;
int main() {
const int arraySize = 25;
const int patternSize = 10;

[Code] ....

View 1 Replies View Related

C++ :: How To Change Length Of Text

Oct 5, 2014

im new to c++ ,so my question is how do i change a length of a text. for example hi my name is blah blah blah. nice to meet you. (n i want every lines to have 8 chars how do i do that)

(hi__my__
name_is_
balh____
blah____
blah____
._nice__
to_meet_
you.) (_ equal space)

View 3 Replies View Related

C++ :: SFML 2.0 - Change Cursor

Sep 4, 2013

How to change what the cursor is in sfml 2.0?

View 1 Replies View Related

C++ :: Change Length Of Array Using GDB

Jun 16, 2014

I have a program with the following code, and I need to be able to either change the value of any or all of the strlen or to replace one or all with a temp array value. All values of the expression are arrays.

if (::strlen(tc_buf) + ::strlen(maxtime_buf) + ::strlen(" ") < sizeof(localBuf))

View 1 Replies View Related

C++ :: How To Change Values Of Array

Feb 1, 2015

how can i change the array value and display the updated value. for example this is the output beginning of the program

-----------------------------------------------------
Part Description Number of parts in the bin
----------------------------------------------------

valve 10
Bearing 5
Bushing 21
Coupling 7

[Code].....

View 1 Replies View Related

C++ :: How To Change Input File Name

Mar 23, 2013

For particular assignment, I am asked to evaluate data from an inputfile, let it be named "infile.dat". Next, it is required to output to this same file, but with the name of this file altered to reflect the changes of data. For example, if I want to change the original file name to "changed_infile.dat.altered" by adding the "changed_" prefix and ".altered" suffix, how could this be done?

From my understanding, there are no functions in <fstream> that could change the file name. However, there is a rename function in <stdio>, but it's not exactly what I am looking for because I want to append a prefix and suffix to this existing inputfile name. Although I could apply a brute force method by simply doing rename("infile.dat", "changed_infile.dat.altered"), I want to have my program to work with various input files of different names.

View 1 Replies View Related







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