.


:




:

































 

 

 

 


4. .




/*iftax.c*/main() { int taxable; float cost, tax; tax = 0.0; printf(": "); scanf("%f", &cost); printf(" Y, , N, : "); taxable = getchar(); if (taxable == 'Y') tax = cost * 0.06; printf("\n %f", cost + tax); }

, . , Y, . y, , , if .

 

 

getchar()
, getchar(), . , , Enter. , , getch() getche(). , , , Enter. , getchar() scanf() . , ( ), scanf() , . getchar() , . , scanf() gets() , , , getch() getche(). getchar(). #include, fflush(stdin) getchar(). fflush() , .

 

, Y. if. , :

if (taxable == 'Y' || taxable == 'y')

: taxable Y y, ... , , , . , , . , taxable . (taxable == 'Y' || 'y') .

: (||), (&&) (!). , if ( ) . , . , if , .

( ), . , , ( 5).





:


: 2017-03-12; !; : 236 |


:

:

.
==> ...

1783 - | 1641 -


© 2015-2024 lektsii.org - -

: 0.008 .