RieqyNS13 icon

konversi char ke int

RieqyNS13 | PRO | 12/02/13 08:27:15 AM UTC | 0 ⭐ | 332 👁️ | Never ⏰ | []
C++ |

250 B

|

None

|

0 👍

/

0 👎

#include <iostream>
#include <stdlib.h>
#include <string.h>
using namespace std;
int main(){
    char b[13];
    int a[13];
    strcpy(b, "6661311");
    for(int z=0; z<7; z++){
        a[z] = (int) b[z]-'0'; //konversi char ke int
        cout<<a[z];
    }
    return 0;
}

Comments