Simple Program for Read & Write File Operation (Convert lowercase to uppercase) Using C++ Programming

program to convert lowercase to uppercase.

Simple Program for Reading & Write File Operation (Convert lowercase to uppercase)  Algorithm/Steps:

  • STEP 1:  Start the program.
  • STEP 2:  Declare the variables.
  • STEP 3:  Read the file name.
  • STEP 4:  open the file to write the contents.
  • STEP 5:  writing the file contents up to reach a particular condition.
  • STEP6:   write the file contents as uppercase.
  • STEP7:   open the file to read the contents.
  • STEP 8:  Stop the program.        

 Read & Write File Operation (Convert lowercase to uppercase)  Program


void main() {
    char c, u;
    char fname[10];
    ofstream out;
    cout << "Enter File Name:";
    cout << "Enter the text(Enter # at end)\n"; //write contents to file
    while ((c = getchar()) != '#') {
        u = c - 32;
        out << u;
    ifstream in(fname); //read the contents of file
    cout << "\n\n\t\tThe File contains\n\n";
    while (in.eof() == 0) {
        cout << c;

Sample Output

Enter File Name: two.txt
Enter contents to store in file (enter # at end)
oops programming
The File Contains