mardi 27 mars 2018

uva 10062 Runtime error c++

i'm getting run time error in this problem uva Tell me the frequencies! can someone help me and tell me why Iam getting that?? this is my code

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int dic [96];
int main()
{
char input [101];
int i;
while(gets(input))
{
    int lenght = strlen(input);
    for(i=0;i<lenght;i++)
    {
        dic[input[i]-32]++;
    }
    int j;
    for(i=1;i<96;i++)
    {
        for(j=0;j<96;j++)
        {
            if(dic[j]==i)
                printf("%d %d\n",j+32,dic[j]);
        }
    }
    printf("\n");
    memset(dic, 0, sizeof(dic));
}

return 0;
}

Aucun commentaire:

Enregistrer un commentaire