Expression Arithmetic Relational Logical 2 Relational Operators Equal

  • Slides: 23
Download presentation

Expression { { { Arithmetic Relational Logical

Expression { { { Arithmetic Relational Logical

2. Relational Operators § § § == (Equal) != (Not Equal) <= (Less Than

2. Relational Operators § § § == (Equal) != (Not Equal) <= (Less Than or Equal) >= (More Than or Equal) > (More Than) < (Less Than)

3. Logical Operators n && (And) n || n ! (Or) (Not) �������� Arithmetic

3. Logical Operators n && (And) n || n ! (Or) (Not) �������� Arithmetic Relational Logical

2) (2+7)/3!=9%4 && 6 -(12/2)==0

2) (2+7)/3!=9%4 && 6 -(12/2)==0

������� scanf n getchar() n getche() n printf n putchar() n puts() n

������� scanf n getchar() n getche() n printf n putchar() n puts() n

������ if…else if (condition) { statement 1; statement 2; } else { statement 3;

������ if…else if (condition) { statement 1; statement 2; } else { statement 3; statement 4; } if (condition 1) { if (condition 2) statement 1; statement 2; } else { if (condition 3) statement 3; else statement 4; statement 5; }

=====Branch 1==== Amount : 80 Balance > 120 Status > upper limit =====Branch 2====

=====Branch 1==== Amount : 80 Balance > 120 Status > upper limit =====Branch 2==== Amount : 140 Balance > 60 Status > lower limit =====Branch 3==== Amount : 170 Balance > 30 Status > lower limit =====Branch 4==== Amount : 80 Balance > 120 Status > upper limit =====Branch 5==== Amount : 45 Balance > 155 Status > upper limit ======== Minimum Amount = 45 Maximum Amount = 170

Enter food expense : 480 Enter drink expense : 150 Total expense = 630

Enter food expense : 480 Enter drink expense : 150 Total expense = 630 Discount 5% = 31. 50 Net Total expense = 598. 50 ****************** Enter food expense : 850 Enter drink expense : 370 Total expense = 1220 Discount 10% = 122 Net Total expense = 1098. 00 ****************** Enter food expense : 0 ****************** Total table = 2 Total revenue = 1696. 50 ********* Goodbye ********

Text file FILE *pointer-name; pointer-name = fopen(“filename”, “mode”); fclose(Pointer-name);

Text file FILE *pointer-name; pointer-name = fopen(“filename”, “mode”); fclose(Pointer-name);

คำสงอานและเขยนขอมล fscanf(fp, “format”, arg-list); fprintf(fp, “format”, arg-list);

คำสงอานและเขยนขอมล fscanf(fp, “format”, arg-list); fprintf(fp, “format”, arg-list);

ID: 150021234 Name: Sara Age: 15 ********* ID : 150024563 Name: Paul Age: 16

ID: 150021234 Name: Sara Age: 15 ********* ID : 150024563 Name: Paul Age: 16 ********* ID: 150021234 Name: Lily Age: 14 ********* ID : 150024214 Name: Dolly Age: 13 ********* ID : 150024785 Name: Dolly Age: 17 ตวอยางการรบขอม output. txt 150021234 150024563 150021234 150024214 150024785 Sara Paul Lily Dolly 15 16 14 13 17 Average = 15. 00 Completely !!! ******************** ตวอยางผลลพธทจ