444 why RE??

All about problems in Volume IV. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

444 why RE??

Postby cse.mehedi » Thu Apr 12, 2012 9:55 am

Hele me any one!!! :(
it shows "This means that the execution of your program didn't finish properly. Remember to always terminate your code with the exit code 0."
Code: Select all
#include<stdio.h>
#include<string.h>

int rev(int n)
{
    int x=0,q=0,s=0,t=0;
    s=n;
    if(s>99)
    {
        x=100;
        while(s!=0)
        {
            q=s%10;
            s/=10;
            t=t+(q*x);
            x/=10;
        }
    }
    else
    {
        x=10;
        while(s!=0)
        {
            q=s%10;
            s/=10;
            t=t+(q*x);
            x/=10;
        }
    }
    return t;
}

void disOutput(char str[81])
{
    int n=1,i,s=0;
    for(i=strlen(str)-1;i>=0;i--)
    {
        if((int)str[i]>=48 && (int)str[i]<=57)
        {
            s+=((int)str[i]-48)*n;
            n*=10;
            if(s>=32)
            {
               printf("%c",(char)rev(s));
               s=0,n=1;
            }
        }
        else
        {
            printf("%d",rev((int)str[i]));
        }
    }
    printf("\n");
    return 0;
}

void main()
{
    char str[81];
    while(gets(str))
    disOutput(str);
    return 0;
}

cse.mehedi
New poster
 
Posts: 36
Joined: Sun Mar 18, 2012 8:18 am

Re: 444 why RE??

Postby brianfry713 » Fri Apr 13, 2012 12:26 am

main should return int.
brianfry713
Guru
 
Posts: 1742
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 444 why RE??

Postby cse.mehedi » Fri Apr 13, 2012 12:30 am

brianfry713 wrote:main should return int.

I used return 1; but again RE!! :(
cse.mehedi
New poster
 
Posts: 36
Joined: Sun Mar 18, 2012 8:18 am

Re: 444 why RE??

Postby brianfry713 » Mon Apr 16, 2012 10:05 pm

change:
void main()
to:
int main()

return 0 not 1.
brianfry713
Guru
 
Posts: 1742
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA


Return to Volume IV

Who is online

Users browsing this forum: No registered users and 0 guests