Sunday, January 29, 2012

C/C++ Exercise: cout number in dec, hex, oct format using std::

C/C++ Exercise: cout number in dec, hex, oct format using std::
#include <iostream>
#include <conio.h>

using std::cin;
using std::cout;
using std::endl;

int main(){
 cout << "http://dev-microsoft.blogspot.com/" << endl;
 cout << "C/C++ Exercise: cout number in dec, hex, oct format using std::" << endl << endl;

 int number = 1024;
 cout << "dec: " << std::dec << number << endl;
 cout << "hex: " << std::hex << number << endl;
 cout << "oct: " << std::oct << number << endl;

 cout << endl;
 system("PAUSE");
 return 0;

}

No comments:

Post a Comment