Advertisement
RieqyNS13

konversi char ke int

Dec 2nd, 2013
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.25 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. using namespace std;
  5. int main(){
  6.     char b[13];
  7.     int a[13];
  8.     strcpy(b, "6661311");
  9.     for(int z=0; z<7; z++){
  10.         a[z] = (int) b[z]-'0'; //konversi char ke int
  11.         cout<<a[z];
  12.     }
  13.     return 0;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement