Code Competitions

Coding competition
Showing posts with label conversion of number system using IOS. Show all posts
Showing posts with label conversion of number system using IOS. Show all posts

Monday, 3 June 2013

program to convert number system.

#include<stdio.h>
#include<iomanip.h>
#include<conio.h>
void main()
{
    int a;
    clrscr();
    cout<<"\nenter the value of a";
    cin>>a;
    cout.setf(ios::showbase);
    cout<<"\n decimal value of a "<<a;
    cout.setf(ios::hex,ios::basefield);
    cout<<"\n hexadecimal value of a "<<a;
    cout.unsetf(ios::hex);
    cout.setf(ios::oct,ios::basefield);
    cout<<"\n octal number "<<a;
    cout.unsetf(ios::oct);
    cout.setf(ios::showpos);
    cout<<"\n the value of a "<<a;
    getch();
}