"cr88192" <cr88192@[EMAIL PROTECTED]
> ha scritto nel messaggio
news:876ae$4823f988$ca83b482$8265@[EMAIL PROTECTED]
> "rio" <a@[EMAIL PROTECTED]
> wrote in message
> news:4822d8eb$0$41661$4fafbaef@[EMAIL PROTECTED]
> ICK...
>
> these are not exactly the way I would personally use the trinary and
comma
> operators...
> of course, I do have something vaguely similar, but it is more of a
> "compact" style:
>
> #include <stdio.h>
> #include <stdlib.h>
>
> int main(int argc, char **argv) {
> double x, y;
> if (argc!=3) { fprintf(stderr,"usage error\n"); return(-1); }
> x=strtod(argv[1], 0); y=strtod(argv[2], 0);
> if(x==0.0) { printf("Error: x==0\n"); return(-1); }
> printf("%.2f\n", y/x), 0); return(0); }
i like it; it seems i have understood
i try something like this:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv)
{double x, y;
/**********************/
if (argc!=3) { fprintf(stderr,"usage error\n");
return -1;}
x=strtod(argv[1], 0);
y=strtod(argv[2], 0);
return (x!=0.0) ? (printf("%.2f\n", y/x), 0):
(printf("Error: x==0\n"), -1);
}
> usually, this is done for code that:
> I usually wont really be reading or editing much;
> my compulsion for reducing vertical space exceeded my need for clarity.
>
> some elements of this style may sometimes be used in ordinary code
though.
yes what you say is ok for me.
Thank you


|