NOT SO COMMON C++
Hello Techiez, today in this post i'll be discussing about some shortcuts and some methods in C++ which are we generally miss while studying C++. This post will be useful for both C++ beginners as well for experienced programmers. So lets explore. 1. Convert a decimal value to hexadecimal/octal. Program: #include<iostream> using namespace std; int main() { int num1=300; cout<<hex<<num1; //hex is an manipulator used to convert num1 into hexadecimal value } Output: 12c Same program can be used to convert : (a)decimal to octal, just change "hex" to "oct" and (b)for octal/hexadecimal to decimal, just change "hex"/"oct" to "dec" (before a hex/oct number). lets see an example for part '(b)' Program: #include<iostream> using namespace std; int main() { int num1=01067; ...