I am at the end of my first semester of C++, and I'm not sure what I should do to make this program meet the requested specifications. The assignment is as follows:
Write a function called ignoreCaseCompa re() that has two character (char) parameters. The function should return true if the two characters received represent the same letter, even if the case does not agree. Otherwise, the function should return false. Then, write a simple main() function that uses your ignoreCaseCompa re().
Additional instructions:
Here is the function heading:
bool ignoreCaseCompa re(char c1, char c2)
{
//Write the code to compare c1 with c2 and return true/false
}
Here is what I have:
This programs is much easier without the value-return function. Can anyone offer any advice or direction?
Write a function called ignoreCaseCompa re() that has two character (char) parameters. The function should return true if the two characters received represent the same letter, even if the case does not agree. Otherwise, the function should return false. Then, write a simple main() function that uses your ignoreCaseCompa re().
Additional instructions:
Here is the function heading:
bool ignoreCaseCompa re(char c1, char c2)
{
//Write the code to compare c1 with c2 and return true/false
}
Here is what I have:
Code:
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
//function prototype
bool ignoreCaseCompare (char first, char second);
int main ()
{
char first = ' ';
char second = ' ';
cout << "Enter a letter: ";
cin >> first;
cout << "Enter another letter: ";
cin >> second;
first = toupper(first);
second = toupper(second);
cout << "Are the letters the same? " <<
return 0;
}
//******function defintions*****
bool ignoreCaseCompare (char one, char two)
{if (one == two)
return true;
else
return false;
}
//end main function
This programs is much easier without the value-return function. Can anyone offer any advice or direction?
Comment