After some fixing..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211
|
#include <iostream>
using namespace std;
const MAX = 4;
// STRUCT DECLARATION
struct Airplanes
{
string airline[MAX];
string arrivingFrom[MAX];
};
// END STRUCT DECLARATION
//FUNCTIONS
string addNewArrival(string); //Organizes new plane to last place in array
bool newArrival(int totalArrivals[]);
bool fullTerminal(int totalArrivals[]); //Test if there are new arrivles or if full
//MAIN BEGINS
int main()
{
Airplanes air;
int totalArrivals[MAX];
int addingNewArrival;
int x;
bool newArrivals = false;
bool full = false;
int i;
//START SETTING DEFAULTS
for(i = 0; i < MAX; i++)
{
totalArrivals[i] = 0;
}
for(i = 0; i < MAX; i++)
{
air.airline[i] = "";
air.arrivingFrom[i] = "";
}
//END SETTING DEFAULT
newArrivals = newArrival(totalArrivals[]);
if(newArrivals == true)
{
cout << "There are no new Arrivals" << endl;
}
else
{
cout << "There are new arrivals" << endl;
}
addingNewArrival = addNewArrival();
newArrivals = newArrival(totalArrivals[]);
cout << "newArrivals" << endl;
full = fullTerminal(totalArrivals[]);
if(full == true)
{
cout << "The terminal is full" << endl;
}
else
{
cout << "The terminal is not full" << endl;
}
cout << "Searching for Air Canada plane from Toronto " << endl;
for(i = 0; i < MAX; i++)
{
if(air.arrivingFrom[i] == "Toronto")
{
cout << "There is a plane from toronto in" << endl;
}
if(air.airline[i] == "Air Canada")
{
cout << "It is from Air Canada" << endl;
}
else
{
cout << "It is not from Air Canada" << endl;
}
}
air.airline[2] = "Air Canada";
air.airline[3] = "Delta";
air.arrivingFrom[2] = "Toronto";
air.arrivingFrom[3] = "Minneapolis";
addingNewArrival = addNewArrival(int totalArrivals[MAX]);
newArrival = newArrivals(totalArrival[]);
if(newArrival == true)
{
cout << "There are new arrivals" << endl;
}
else
{
cout << "There are no new arrivals" << endl;
}
full = fullTerminal(totalArrivals[MAX]);
if(full == true)
{
cout << "The terminal is full" << endl;
}
else
{
cout << "The terminal is not full" << endl;
}
cout << "Searching for Air Canada plane from Toronto " << endl;
for(i = 0; i < MAX; i++)
{
if(air.arrivingFrom[i] == "Toronto")
{
cout << "There is a plane from toronto in" << endl;
}
if(air.airline[i] == "Air Canada")
{
cout << "It is from Air Canada" << endl;
}
else
{
cout << "It is not from Air Canada" << endl;
}
}
}
//MAIN ENDS
string addNewArrival(int totalArrivals[])
{
int i;
int count =0;
air.airline[0] = "WestJet";
air.arrivingFrom[0] = "Calgary";
air.airline[1] = "United";
air.arrivingFrom[1] = "Chicago";
for(i = 0; i < MAX; i++)
{
if(air.airline[i] != "")
{
count ++;
}
}
while(i <= count)
{
if(totalArrivals[i] ==0)
{
totalArrivals[i] = totalArrivals[i] + 1;
}
}
}
bool newArrival(int totalArrivals[])
{
int count;
int i
for(i = 0; i < MAX; i++)
{
if(totalArrivals[i] ==0)
{
count ++
}
}
if(count == 4)
{
return true;
}
else
{
return false;
}
}
bool fullTerminal(int totalArrivals[])
{
int count;
for(i = 0; i < MAX; i ++)
{
if(totalArrivals[i] >0)
{
count ++;
}
}
if(count == 4)
{
return true;
}
else
{
return false;
}
}
|
ERRORS:
"A2BJ.cpp", line 55: Error: Operand expected instead of "]".
"A2BJ.cpp", line 55: Error: Formal argument totalArrivals of type int* in call to newArrival(int*) is being passed int.
"A2BJ.cpp", line 65: Error: Too few arguments in call to "addNewArrival(std::basic_string<char, std::char_traits<char>, std::allocator<char>>)".
"A2BJ.cpp", line 66: Error: Operand expected instead of "]".
"A2BJ.cpp", line 66: Error: Formal argument totalArrivals of type int* in call to newArrival(int*) is being passed int.
"A2BJ.cpp", line 69: Error: Operand expected instead of "]".
"A2BJ.cpp", line 69: Error: Formal argument totalArrivals of type int* in call to fullTerminal(int*) is being passed int.
"A2BJ.cpp", line 102: Error: Badly formed expression.
"A2BJ.cpp", line 103: Error: totalArrival is not defined.
"A2BJ.cpp", line 103: Error: Operand expected instead of "]".
"A2BJ.cpp", line 103: Error: Only a function may be called.
"A2BJ.cpp", line 104: Error: The operation "bool(*)(int*) == bool" is illegal.
"A2BJ.cpp", line 113: Error: Formal argument totalArrivals of type int* in call to fullTerminal(int*) is being passed int.
"A2BJ.cpp", line 152: Error: air is not defined.
"A2BJ.cpp", line 152: Error: Badly formed expression.
"A2BJ.cpp", line 153: Error: air is not defined.
"A2BJ.cpp", line 153: Error: Badly formed expression.
"A2BJ.cpp", line 154: Error: air is not defined.
"A2BJ.cpp", line 154: Error: Badly formed expression.
"A2BJ.cpp", line 155: Error: air is not defined.
"A2BJ.cpp", line 155: Error: Badly formed expression.
"A2BJ.cpp", line 159: Error: air is not defined.
"A2BJ.cpp", line 159: Error: Badly formed expression.
"A2BJ.cpp", line 172: Error: "addNewArrival(int*)" is expected to return a value.
"A2BJ.cpp", line 181: Error: Use ";" to terminate declarations.
Compilation aborted, too many Error messages.