Wednesday 23 January 2013

conversion of string to integer and integer into string


   #include <iostream>
   #include <stdio>
   #include <stdlib>
   #include <math>
   #include <conio>
   #include <ctype>

       int a,opt,n;
   char str[4443],c;
    void main ()
{



  while(1)

  {

  clrscr();
   cout<<"\t\tPress 1 for convert string into int\n\t\tPress 2 for convert int to string\n\t\tPress 3 for convert char into int\n\t\tPress 4 for convert int into char\n\t\tpress 5 for adding of two interger\n";
   cin>>opt;
   switch(opt)

   {

   case 1:

   cout<<"Enter any string\t";gets(str);
   a=atoi(str);
   cout<<"String convert into interget is\t"<<a<<endl;

     break;
     case 3:
       cout<<"Enter any charater\t";
       cin>>c;
       n=toascii(c);
       cout<<"The value in interger is\t"<<n<<endl;
       break;
       case 4:
       cout<<"Enter any integer\t";cin>>n;

       case 5:

       int d,f,g;
       cout<<"Enter any two number which do you want to Add\n";
       cin>>d>>f;

             g=d+f;
         cout<<"Sum of two interger\t"<<g<<endl;


         break;

   }



    system("pause");


}  }

0 comments:

Post a Comment