Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int n;
  6. cout<<"請輸入數字:";
  7. cin>>n;
  8. while(n>0)
  9. {
  10. int A[50]={0},c=0;
  11. while(n)
  12. {
  13. A[c++]=n%7;
  14. n/=7;
  15. }
  16. cout<<"7進位是:";
  17. for(int i=c-1;i>-1;i--)
  18. {
  19. cout<<A[i];
  20. }
  21. cout<<endl;
  22. cout<<"請輸入數字:";
  23. cin>>n;
  24. }
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement