Hi, I am trying to figure out why I cannot get my script to compile. My compiler says I have an undefined reference to my functions. Could someone tell me what it is I am missing?
Code:
#include <iostream>
#include <conio.h>
#include <fstream.h>
#include <stdlib.h>
#include <iomanip.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
char removePunct(char);
char removeSpace(char);
int main()
{
const int MAXLENGTH = 25;
const int MAXCHARS = 71;
const int MAXLINES = 7;
char record[MAXLENGTH] = "record.txt";
char line[MAXCHARS];
int ch, i;
char entry;
ifstream in_file;
in_file.open(record);
cout << " Simple Character Processor " << endl;
cout << endl;
cout << "(R) . Read a new line from the file. " << endl;
cout << "(P) . Print the current state of the line. " << endl;
cout << "(M) . Remove all punctuation marks from the line. " << endl;
cout << "(S) . Remove all spaces from the line. " << endl;
cout << "(D) . Determine if the line is a palindrome. " << endl;
cout << "(W) . Determine and output all starting positions of a given word in a line. " << endl;
cout << "(Q) . Quit the program. " << endl;
cout << endl;
cout << "Enter Option > ";
cin >> entry;
cout << endl;
while (entry != 'q' || entry != 'Q')
{
if (entry == 'r'|| entry == 'R')
{
while((ch = in_file.peek()) != EOF )
{
in_file.getline(line, MAXCHARS, '\n');
break;
} //end while loop
getch();
}
else if (entry == 'p' || entry == 'P')
{
cout << "The current state of the line is: " << endl;
cout << endl;
cout << line << endl;
}
else if (entry == 'm' || entry == 'M')
{
line[MAXCHARS] = removePunct(line[MAXCHARS]);
}
else if (entry == 's' || entry == 'S')
line[MAXCHARS] = removeSpace(line[MAXCHARS]);
else if (entry == 'd' || entry == 'D')
cout << "D works. " << endl;
else if (entry == 'w' || entry == 'W')
cout << "W works. " << endl;
else if (entry == 'q' || entry == 'Q')
break;
getch();
}
in_file.close();
getch();
return 0;
} // end main
char removePunc(char words)
{
const int MAXCHARS = 71;
char i;
for(i=0; i < MAXCHARS; i++)
{
if ((words < 32) || ((words > 33) && (words < 65)) || ((words > 90) && (words < 97)) || (words >122))
{
words = 32;
}
}// end i loop
return(words);
}// end removepunc function
char removePunc(char words[])
{
const int MAXCHARS = 71;
int i, j;
j=0;
for(i=0; i < MAXCHARS; i++)
{
if (words[i] != ' ')
words[j++] = words[i] ;
}//end i loop
return(words[i]);
} //end removeSpace function