C
curiousEngine
Write a program to print out the integers from 40 to 127 in decimal,
octal,
hexadecimal and also print out the equivalent character.
************************************/
#include<iostream>
using namespace std;
void main(){
for (int i(40); i <= 127; i++){
cout<<"Decimal Value:"<<i;
cout<<"Octal Value:"<<oct<<i<<endl;
cout<<"Hexadecimal Value:"<<hex<<i;
cout<<"Character:"<<char(i);
}
}
how to refactor the above code?
octal,
hexadecimal and also print out the equivalent character.
************************************/
#include<iostream>
using namespace std;
void main(){
for (int i(40); i <= 127; i++){
cout<<"Decimal Value:"<<i;
cout<<"Octal Value:"<<oct<<i<<endl;
cout<<"Hexadecimal Value:"<<hex<<i;
cout<<"Character:"<<char(i);
}
}
how to refactor the above code?