hey guys...
I am doing an assignment for my c++ class and I am running into trouble with a Void Function. The teacher says this:
"Set up this as a void function and pass letter by value to the function. The purpose of the function is to display the ICAO alphabetic character that corresponds to letter. No value is returned."
I am getting this when I try to compile:
1>------ Build started: Project: ch7ex1, Configuration: Debug Win32 ------
1> ch7ex1.cpp
1>ch7ex1.obj : error LNK2019: unresolved external symbol "void __cdecl displayChar(char)" (?displayChar@@YAXD@Z) referenced in function _main
1>c:\users\sean\documents\visual studio 2010\Projects\ch7ex1\Debug\ch7ex1.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Here is my code I have so far (won't compile):
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
|
//Input String, output series of strings
//This program allows the user to input a word and it will ouput a series of ICAO words
//using the corresponding International Civil Aviation Organization alphabet words
// Example : hello = Hotel Echo Lime Lima Oscar
#include <iostream>
#include <iomanip>
#include <string>
#include <cctype>
using namespace std;
//Function prototype
void displayChar(char);
int main()
{
string instring, sub;
char letter;
int len, ipos;
instring = (" cin >>instring; ");
cout << "The phonetic version for" << instring << " is: ";
len = instring.length() ;
ipos = 0;
while (ipos <= len-1)
{
sub = instring.substr(ipos, 1);
letter = sub[0];
if (isalpha(letter) == 0)
cout << "Will skip character " << letter << endl;
else
displayChar(letter) ;
ipos = ipos + 1;
}
switch (letter)
{
case 'A': case 'a': cout << "Alpha";
break;
case 'B': case 'b': cout << "Bravo";
break;
case 'C': case 'c': cout << "Charlie";
break;
case 'D': case 'd': cout << "Delta";
break;
case 'E': case 'e': cout << "Echo";
break;
case 'F': case 'f': cout << "Foxtrot";
break;
case 'G': case 'g': cout << "Golf";
break;
case 'H': case 'h': cout << "Hotel";
break;
case 'I': case 'i': cout << "India";
break;
case 'J': case 'j': cout << "Juliet";
break;
case 'K': case 'k': cout << "Kilo";
break;
case 'L': case 'l': cout << "Lima";
break;
case 'M': case 'm': cout << "Mike";
break;
case 'N': case 'n': cout << "November";
break;
case 'O': case 'o': cout << "Oscar";
break;
case 'P': case 'p': cout << "Papa";
break;
case 'Q': case 'q': cout << "Quebec";
break;
case 'R': case 'r': cout << "Romeo";
break;
case 'S': case 's': cout << "Sierra";
break;
case 'T': case 't': cout << "Tango";
break;
case 'U': case 'u': cout << "Uniform";
break;
case 'V': case 'v': cout << "Victor";
break;
case 'W': case 'w': cout << "Whiskey";
break;
case 'X': case 'x': cout << "X-Ray";
break;
case 'Y': case 'y': cout << "Yankee";
break;
case 'Z': case 'z': cout << "Zulu";
break;
default : cout << "You entered an invalid letter";
}
//Hit any key to close
system("Pause");
return 0;
}
|
any help would be very appreciated! Thanks!