samedi 27 juin 2015

Programming without semicolon in C or Java or C++ [on hold]

I was trying to solve easy arithmetic problems with expression...

<expre>::=<num><opt><num>
<num>::=0|1|2|...|99
<opt>::=+|-|*

But the constraint is I can not use semicolons in my program.

I was able to print strings without semicolons but found no luck with taking input from user or printing calculated value.

#include <stdio.h>
main()
{
    if((printf("cspractical")))
    {
        if(int n=0 && scanf("%d",&n) && printf("%d",n))
        {}
    }
}

This is what I was trying. It is printing cspractical but nothing else.

Any help would be appreciated.

Aucun commentaire:

Enregistrer un commentaire