Thursday, 18 July 2013



#include "stdafx.h"
#include "conio.h"
#include "stdio.h"
#include "iostream"

using namespace std;

void AsciiValue();
void Character();
void LowerToUpper();
void UpperToLower();

int _tmain(int argc, _TCHAR* argv[])
{
       int choice;
       char option;
       do
       {
              cout<<"press 1 to convert ascii value to character"<<endl;
              cout<<"press 2 to convert character to ascii value"<<endl;
              cout<<"press 3 to conver alphabet from lower to upper case"<<endl;
              cout<<"press 4 to conver alphabet from upper to lower case"<<endl;
              cout<<"press 5 for exit"<<endl;
              cout<<"enter your choice"<<endl;
              cin>>choice;
              switch(choice)
              {
              case 1:
                     AsciiValue();
                     break;
              case 2:
                     Character();
                     break;
              case 3:
                     LowerToUpper();
                     break;
              case 4:
                     UpperToLower();
                     break;
              case 5:
                     exit(0);
              default:
                     cout<<"nothing match";
              }
              cout<<"would u like to continue?";
              cin>>option;
       }while(option=='y'||option=='Y');
              getch();
}
void AsciiValue()
{
       char ch;
       int a;
       cout<<"enter a character"<<endl;
       cin>>ch;
       a=ch;
       cout<<a<<endl;
}
void Character()
{
       int a;
       cout<<"enter a number"<<endl;
       cin>>a;
       cout<<(char)a<<endl;
}
void LowerToUpper()
{
       char ch;
       int a;
       cout<<"enter a character in lower case";
       cin>>ch;
       a=ch-32;
       cout<<(char)a;
       getch();
}
void UpperToLower()
{
       char ch;
       int a;
       cout<<"enter a character in upper case";
       cin>>ch;
       a=ch+32;
       cout<<(char)a;

       getch();}
Reactions:

0 comments :

Post a Comment