Thursday, November 27, 2014

4. Write a program that takes a character from A to Z and convert it into lower-case character. (use type casting)


  1. Write a program that takes a character from A to Z and convert it into lower-case character. (use type casting)

#include <iostream>

using namespace std;

int main()



{




char x; //introducing variable

int value;
cout<<"Enter x = "; //asking for input

cin>>x; //giving input

value=static_cast<int>(x); //typecast char int int datatype

x=value+32; //addind 32 in upper case to get lowercase

value=static_cast<char>(x); //typecast int into char datatype

cout<<"The lower case of upper case = "<<x<<endl; //getting lower case in output

return 0;



}

No comments:

Post a Comment