Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1
#include <iostream> # include <iomanip> using namespace std; int main() { int num; cin>>num; cout<<"your number: "<<num<<endl; cout<<"hex = "<<hex<<num<<endl; cout<<"oct = "<<oct<<num<<endl; return 0; } /* use these headers: #include <iostream> # include <iomanip> using namespace std; then, in a cout statement, write hex or oct, the next number after that will be written in hex or oct. example cout<<oct<<9; (writes 11, octal for nine) int test = 15; cout<<hex<<test; (writes f, hexa for 15) */
26th Sep 2016, 6:15 PM
Andres Mar