This way, you don't have to cut and paste main() from here
to there, there's no chance you'll accidentally submit
a main() with your code, and it's easy to test your
program using someone else's main() simply by
compiling like so:
g++ -Wall -g -o functions functions.cpp othermain.cpp.
////////////////////////////////////////////////////////////////// // // IsPalindrome returns true if the given string s // is a strict, case-insensitive palindrome, and false // otherwise. // // By strict palindrome, I mean a string that reads the // same backwards as forwards, without adjusting // spacing, punctuation, etc. A case-insensitive // palindrome means that, for example, an upper-case // 'R' is to be considered the same as a lower-case 'r'. // // Examples: // // level true // Level true // madam, I'm Adam false // rats live on no evil star true // ////////////////////////////////////////////////////////////////// bool IsPalindrome( const string& s ); ////////////////////////////////////////////////////////////////// // // ReduceFraction // // Preconditions: numerator and denominator contain the // numerator and denominator of a fraction to be reduced. // // Postconditions: // 1. The parameters contain the numerator and denominator // of the reduced fraction. // // 2. If the fraction is positive, both numerator and // denominator of the reduced fraction should be // positive. // // 3. If the fraction is negative, the numerator of the // reduced fraction should be negative, and the // denominator positive. // // 4. If denominator is initially zero, neither numerator // nor denominator should be changed. // // // Examples. Before After // n=6, d=9 n=2, d=3 // n=6, d=-9 n=-2, d=3 // n=-7, d=0 n=-7, d=0 // ////////////////////////////////////////////////////////////////// void ReduceFraction( int& numerator, int& denominator ); ////////////////////////////////////////////////////////////////// // // MakeUpper changes all the letters in the given string s // to upper-case. All other characters in s are unchanged. // // Don't forget the library functions isalpha and toupper. // ////////////////////////////////////////////////////////////////// void MakeUpper( string& s );