Advertisement
Bagosep

Secuil Konversi int to string to char

Dec 26th, 2016
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <iomanip>
  2. #include <locale>
  3. #include <sstream>
  4. #include <string.h>  
  5.  
  6. void rupiah(){
  7. ostringstream convert;
  8. convert<<totalHarga;
  9. hargaTotal=convert.str();
  10. const char* hargatotal=hargaTotal.c_str();
  11.     for(int kounter=0;kounter<strlen(hargatotal);kounter++){
  12.     konversi[strlen(hargatotal)-kounter-1]=hargatotal[kounter];
  13.     }
  14.         for(int kounter=strlen(hargatotal)-1;kounter>=0;kounter--){
  15.         cout<<konversi[kounter];
  16.         if(kounter%3==0){
  17.             if(kounter!=0){
  18.             cout<<".";
  19.             }
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement