//read from one file, write to another
//9-12-02
//Barb Sanchez
//Will take a letter that is input in lower case from one file 
//and output to another file in upper case
//need to have a file lower.txt with lower case char's in dir

#include <iostream>
#include <fstream.h>
#include <iomanip>

int main()
{
    char letter; //for input from file
    ifstream data_in; //for input from file to program
    ofstream data_out; //for writing to a file

    data_in.open ("lower.txt"); //open for input
    data_out.open ("upper.txt"); //open for output

    if ((!data_in)||(!data_out)) //if either file not working
    {
        cout << "Error opening file"<<endl;
    
    } //if

    data_in.unsetf(ios::skipws); //don't skip spaces


    while (!data_in.eof())
    {
        data_in >> letter;  // get char from file
        if (!data_in.eof())
        {
            if ((letter > 96) && (letter< 123)) // check ASCII range
            {                                   // if lower, convert 
                letter = letter - 32;           // to upper
            }

            data_out << letter;
        }

    } //while


    data_in.close();
    data_out.close();

    cout << "See the file \"upper.txt\" to see your work\n";

    return 0;

} //end of main