convert - } infile.unsetf(ios::skipws); // prevents spaces...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include<fstream.h> // necessary for file I/O #include<iostream.h> # int main() { char ch; // Declare character variable used for input. ifstream infile; // Declare file pointer for input file. ofstream outfile; // Declare file pointer for output file. infile.open("LOWER.TXT",ios::in); // Open file for input. outfile.open("UPPER.TXT",ios::out); // Open file for output. if ((!infile) || (!outfile)) // If file error on either file, { // print message and stop program. cout << "Error opening file.\n"; return 0;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } infile.unsetf(ios::skipws); // prevents spaces from being skipped while (!infile.eof()) // Loop while not the end of the file. { infile >> ch; // Get character from file. if (!infile.eof()) { if ((ch > 96) && (ch < 123)) // if character is lowercase a-z, { // subtract 32 to make uppercase. ch = ch - 32; } outfile << ch; // Write character to output file. } } // end of while loop infile.close(); // Close the input file. outfile.close(); // Close the output file. return 0; }...
View Full Document

This note was uploaded on 06/20/2011 for the course COMPUTER 12 taught by Professor Aymanboghdady during the Spring '11 term at American College of Computer & Information Sciences.

Ask a homework question - tutors are online