Friday, August 5, 2016

Lower Case To Upper Case Converter in C++

A simple program that I wrote in C++ to covert lowercase to uppercase of string in C++.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.


Program Listing

#include <iostream>
#include <cctype>
#include <string>


int main()
{
    using namespace std;
    string str;

   cout << " Lower Case To Upper Case String Conversion 1.0";
   cout << "\n\n";
   cout << "Enter a String : ";
   getline(cin,str);
    for (size_t i = 0; i < str.length(); ++i)
    {
        str[i]=toupper(str[i]);
    }

    cout << "\n";
    cout<<"\n Converted Results in Upper Case : "  <<str << ".";
    for (size_t i = 0; i < str.length(); ++i)
    {
        str[i]=tolower(str[i]);
    }

    cout<<"\n Converted Results in Lower Case : "  <<str << ".";
    cout << "\n\n";
    system("PAUSE");

}

No comments:

Post a Comment