i am doing a decimal to binary conversion and i have figure out how to do the conversion i just don't know how to make it cout so that it is in reverse.... i was also told that it could done in a while loop
here is the code
1. #include<iostream>
2. using namespace std;
3. int main(){
4.
5. int dec,olddec,remain;
6.
7. cout<<"please input a decimal to be converted to binary:"<<endl;
8. cin>>dec;
9. cout<<endl;
10.
11. while(dec>0){
12.
13. olddec=dec;
14.
15. remain = dec % 2;
16.
17. dec /=2;
18.
19. cout<<olddec<<"/2 = "<<dec<<" "<<"remainder = "<<remain<<endl;
20. }
21.
22. return 0;
23. }