Wednesday 15 February 2012

C++ program to convert the lowercase letter into uppercase and to increment an integer

Program to convert the lowercase letter into uppercase and to increment an integer

# include <iostream.h>
# include <conio.h>
char convert(char ch)
{
return(ch -32);
}
int increment(int n)
{
return(++n);
}
void main()
{
int num;
char ch1;
clrscr();
cout<< "Enter a character in lower case ";
cin >> ch1;
cout << "Enter an integer ";
cin >> num;
cout<< "\nUpper Case Aplhabet is => " <<convert(ch1);
cout<< "\nIncremented Integer is => " <<increment(num);
}

step by step explanation:

1.the header file "iostream.h" is used to include the function cin and cout.
2.the header file"conio.h"is used to include the function like getch and clrscr.
3.the char convert is also a function of char type.
4.void main is also a void type function it is worked under the curley brackets.


No comments:

Post a Comment