fork download
#include <iostream>

using namespace std;

const int c = 2;
const int d = 3;

int main()
{
    char s[5] = {'c', 'c', 'd', 'c', 'd'};

    int j = sizeof(s) / sizeof(s[0]);
    int k = 0;
    for (int i = 0; i < j; i++){
        if(s[i]== 'c'){
            k += 2 ;                 // end result should be 12
        }
        if(s[i]== 'd'){
            k += 3 ;                 // end result should be 12
        }
    }
    cout << k;
}
Success #stdin #stdout 0s 2852KB
stdin
Standard input is empty
stdout
12