I have been working on this project for my C++ class that I am taking and Ive gotten an error message I have never seen before. When I am attempting to execute it i get the flowing error:
error LNK2001: unresolved external symbol "int __cdecl s(void)" (?s@@YAHXZ)
I have also posted my code following this. I would appreicate any help that is offered because I have no clue what is going on.
// Chapter 4 Project 20
// By William Creech
#include <iostream>
using namespace std;
int s (void);
int economy (void);
const int a = 10;
int aray [a] = {0};
int main ()
{
int cont = 0;
int c = 0;
while (cont =! -1)
cout << "Welcome to Creech Airlines. Please enter \n 1 for 1st class \n 2 for Economy" << endl;
cin >> c;
switch (c)
{
case 1:
s ();
break;
case 2:
economy ();
break;
default:
cout << "Incorrect selection please enter the number again." << endl;
cin >> c;
break;
}
cout << "Are their more people in line?(enter -1 to end)" << endl;
cin >> cont;
return 0;
}
int s (int)
{
int x = 0;
if ( aray [0] == 0)
{
aray [ 0 ] = 1;
cout << "You are sitting in 1st class seat one. Thank you, your flight will be leaving shortly." << endl;
}
else if ( aray [0] != 0)
{
aray [1] = 1;
cout<< "You are sitting in 1st class seat two. Thank you, your flight will be leaving shortly." << endl;
}
else if (aray [1] != 0)
{
aray [2] = 1;
cout << "You are sitting in 1st class seat three. Thank you, your flight will be leaving shortly." << endl;
}
else if (aray [2] != 0)
{
aray[3] = 1;
cout << "You are sitting in 1st class seat four. Thank you, your flight will be leaving shortly." << endl;
}
else if (aray [3] != 0)
{
aray [4] = 1;
cout << "You are sitting in 1st class seat five. Thank you, your flight will be leaving shortly." << endl;
}
else
{
cout << "There are no more 1st class seats available. Is it ok to put you in economy class? (Press 1 for ok 2 for no)" << endl;
cin >> x;
}
if ( x == 1)
economy();
else
cout<< "The next flight will leave in three hours." << endl;
return 0;
}
int economy ()
{
int y = 0;
if ( aray [5] == 0 )
{
aray [ 5 ] = 1;
cout << "You are sitting in Economy class class seat one. Thank you, your flight will be leaving shortly." << endl;
}
else if ( aray [5] != 0)
{
aray [6] = 1;
cout<< "You are sitting in Economy class seat two. Thank you, your flight will be leaving shortly." << endl;
}
else if (aray [6] != 0)
{
aray [7] = 1;
cout << "You are sitting in Economy class seat three. Thank you, your flight will be leaving shortly." << endl;
}
else if (aray [7] != 0)
{
aray[8] = 1;
cout << "You are sitting in Economy class seat four. Thank you, your flight will be leaving shortly." << endl;
}
else if (aray [8] != 0)
{
aray [9] = 1;
cout << "You are sitting in 1st class seat five. Thank you, your flight will be leaving shortly." << endl;
}
else
{
cout << "There are no more Economy class seats available. Is it ok to put you in 1st class class? (Press 1 for ok 2 for no)" << endl;
cin >> y;
}
if ( y == 1)
s();
else
cout<< "The next flight will leave in three hours." << endl;
return 0;
}
<< moderator edit: added [code][/code] tags >>