Need to write function correctly

#include <iostream>
#include <iomanip>
#include <fstream>

using namespace std;

char convUpper( char ch );

int main()
{
ifstream inFile;

char ch;

inFile.open("encoded_beer.txt");
if( inFile.fail() )
{
cout << "Input file failed to open";
exit(-1);
}


inFile >> ch;

while( inFile )
{
//Process the 1 character by decoding it. A cascading if statement should
//be used to test the "type" of character (alphabetic, digit, punctuation,
//etc...) and call the appropriate decoding function and increment the
//appropriate counter

//Display the decoded character

inFile >> ch;
}

inFile.close();
}


/**************************************************************************
**************************************************************************/
char convUpper( char ch )
{
ch += 32;
ch -= 1;
if(





}
cout << endl;
system("pause");
return 0;
}



For function *char convUpper( char ch )* it suppose to called for any character that is an uppercase character. It takes a single character as its argument: the character to be decoded. It returns the decoded character. The function should reverse the process that was detailed in #2 of the Encoding Process above by converting the passed in character to lowercase and subtracting 1, so that, for example, 'C' becomes 'b'. However, there is a special case: 'A' should become 'z'.

Now I am reading and reading, but I cannot figure out how to do this correctly. If someone can help me with this it will great and be able to move on.
You can always use the toupper() function;

http://www.cplusplus.com/reference/clibrary/cctype/toupper/

this is probably for class though, i'm guessing. if so you are on the right track, just search google for an ascii chart and you can do what you are suggesting above.
Topic archived. No new replies allowed.