Mail Archives: djgpp/1998/04/29/01:58:40
At 09:00 4/27/1998 +0100, Arthur wrote:
>Surely in C++, it is better to forget the if/then/else construct altogether:
>
>void main(void)
>{
> int int1,int2,answer;
>
> printf("Please enter 2 integers.\n");
> scanf("%i %i",&int1 ,&int2);
>
> answer = ( (int1 > int2) ? int1 : int2 );
>
> printf(" The larger integer is %d\n",answer);
>
>}
Additional trivia: If using GNU C++, you can say:
answer = int1 >? int2;
Nate Eldredge
nate AT cartsys DOT com
- Raw text -