+ 2
C++ output reversing
#include<iostream> using namespace std; int main() { int d, bin; cout<<"Enter decimal value"<<endl; cin>>d; do { bin = d%2; d = d/2; // binary cout<<bin; } while(d>=1); } // this is the code, here binary result for decimal value to be reversed because if i entered 8 in decimal it gives me 0001 in binary instead of 1000... so i want just to reverse the output of binary. please help me
3 Respostas
+ 4
G'day Yousafse have you done arrays yet? What about pre/post-increment/decrement?
https://code.sololearn.com/c5b6MHlNXkpv/?ref=app
+ 5
Do you have to do this manually? you can if you want, use std::bitset which is available in <bitset> header.
http://www.cplusplus.com/reference/bitset/bitset/
+ 2
HungryTradie it's totally fine, very thanks!