In this programming, we will cover everything we have cover in our c++ programming including switch case, if/else, gotoxy coordination, do/while and system clear
First, code for the header file stdafx.h:
Name the main file anyhow you like.
Programming codes for the main file below:
Check the video on how this works on YouTube here:
http://youtu.be/8oXLDWZAd-g
First, code for the header file stdafx.h:
// stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #pragma once #include#include #include #include #include #include using namespace std; // TODO: reference additional headers your program requires here
Name the main file anyhow you like.
Programming codes for the main file below:
// IntAirways.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
void menu();
void main();
void load_flight1();
void load_flight2();
void load_flight3();
void generate_report();
void exit();
int i=0, y=0, x=0; //setup lools for element of parcels.
int space1=0, space2=0, space3=0; // for calculating space left over
// after entering parcels.
int load_limit1; // load_limit for flight no.1.
int weight1=0; //reading of parcels for flight no.1.
int totweight1=0; // totalweight for flight no.1 initailised
int total=0;
float average_utilisation; // average for all the flights.
float total_Revenue; // revenue for all the flighs.
int choice; // reading for entering choice enter meun.
//utilisations for the flights
float flight_utilisation1,flight_utilisation2, flight_utilisation3;
//revenue for the flights.
float flight_revenue1, flight_revenue2, flight_revenue3;
int load_limit2; //load_limit for flight no.2.
int weight2=0; // reading of parcels for flight no.2.
int totweight2=0; // totalweight for flight no.2 initailised.
int load_limit3; // load limit for flight no.3.
int weight3=0; // reading of parcels for flight no.3.
int totweight3=0; //total weight for flight no.2 initailised.
//to resolve the coordination errors-identifer not found
void gotoxy(int x, int y)
{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
void menu()
{
//clrscr();
system("cls");
gotoxy(15,5);
cout<<"========================================= ";
gotoxy(15,6);
cout<<"Y Y";
gotoxy(15,7);
cout<<"Y INTERSCORT AIRWAYS LTD Y";
gotoxy(15,8);
cout<<"Y Y";
gotoxy(15,9);
cout<<"========================================= ";
gotoxy(15,10);
cout<<"Y Y";
gotoxy(15,11);
cout<<"Y 1. Load_flight1 to Aircraft Y";
gotoxy(15,12);
cout<<"Y Y";
gotoxy(15,13);
cout<<"Y 2. load_flight2 to Aircraft Y";
gotoxy(15,14);
cout<<"Y Y";
gotoxy(15,15);
cout<<"Y 3. load_flight3 to Aircraft Y";
gotoxy(15,16);
cout<<"Y Y";
gotoxy(15,17);
cout<<"Y 4. Generate_report Y";
gotoxy(15,18);
cout<<"Y Y";
gotoxy(15,19);
cout<<"Y 5. Exit Y";
gotoxy(15,20);
cout<<"Y Y";
gotoxy(15,21);
cout<<"=========================================Y";
}
//main function
void main()
{
//clrscr();
system("cls");
do
{
menu();
gotoxy(15,22);
cout<<"Enter your choice:";
cin>>choice;
switch(choice)
{
case 1: load_flight1();
break;
case 2: load_flight2();
break;
case 3: load_flight3();
break;
case 4: generate_report();
break;
case 5: exit();
break;
default: cout<<"Invalid menu choice"<>load_limit1;
do
{
cout<<"\nEnter the weight of parcel no."<>weight1;
i=i++;
totweight1=weight1+totweight1; // calculations for total weight.
// calculations for space left over after entering parcels.
space1=load_limit1-totweight1;
space1+1; // increment space left over.
if (load_limit1-totweight1<0)
{
}
cout<<"\nspace left is:"<load_limit1)
{
cout<<"\n********Parcel rejected - refer to next flight.******";
totweight1=totweight1-weight1; //weight is substruct from total weight.
i=i-1; // array of parcels is decrement from loop.
if (weight1==0)
weight1=weight1-1; //decrement parcel.
}
}
while (weight1!=0);
//clrscr();
system("cls");
do
{
menu();
gotoxy(15,22);
cout<<"Enter your choice:";
cin>>choice;
switch(choice)
{
case 1: load_flight1();
break;
case 2: load_flight2();
break;
case 3: load_flight3();
break;
case 4: generate_report();
break;
case 5: exit();
break;
default: cout<<"Invalid menu choice"<>load_limit2;
do
{
cout<<"\nEnter the weight of parcel no."<>weight2;
y=y++;
totweight2=weight2+totweight2; // calculation for total weight.
// calculations for space left over after enter parcels.
space2=load_limit2-totweight2;
space2+1; //increment loop for space left.
if (load_limit2-totweight2<0)
{
}
cout<<"\nspace left is:"<load_limit2)
{
cout<<"\n********Parcel rejected - refer to next flight.******";
totweight2=totweight2-weight2; //weight is substruct from total weight.
y=y-1; // array of parcels is decrement from loop.
if (weight2==0)
weight2=weight2-1; //decrement reading parcel.
}
}
while (weight2!=0);
{
//clrscr();
system("cls");
do
{
menu();
gotoxy(15,22);
cout<<"Enter your choice:";
cin>>choice;
switch(choice)
{
case 1: load_flight1();
break;
case 2: load_flight2();
break;
case 3: load_flight3();
break;
case 4: generate_report();
break;
case 5: exit();
break;
default: cout<<"Invalid menu choice"<>load_limit3;
do
{
cout<<"\nEnter the weight of parcel no."<>weight3;
x=x++;
totweight3=weight3+totweight3; // calculations for total weight.
// calculations for space left over after enter parcels.
space3=load_limit3-totweight3;
space3+1; //increment loop for space left.
if (load_limit3-totweight3<0)
{
}
cout<<"\nspace left is:"<load_limit3)
{
total=weight3;
cout<<"\n********Parcel not accepted.******";
totweight3=totweight3-total; //weight is substruct from total weight.
x=x-1; // array of parcels is decrement from loop.
if (weight3==0)
weight3=weight3-1; //decrement reading parcel.
}
}
while (weight3!=0);
//clrscr();
system("cls");
do
{
menu();
gotoxy(15,22);
cout<<"Enter your choice:";
cin>>choice;
switch(choice)
{
case 1: load_flight1();
break;
case 2: load_flight2();
break;
case 3: load_flight3();
break;
case 4: generate_report();
break;
case 5: exit();
break;
default: cout<<"Invalid menu choice"< Check the video on how this works on YouTube here:
http://youtu.be/8oXLDWZAd-g
Comments
Post a Comment