Presentation is loading. Please wait.

Presentation is loading. Please wait.

PERSON 15 YULIANY JANIS. 6.15 Pintu keluar () Fungsi 2  Pintu keluar () fungsi menyebabkan program untuk mengakhiri, terlepas dari mekanisme fungsi atau.

Similar presentations


Presentation on theme: "PERSON 15 YULIANY JANIS. 6.15 Pintu keluar () Fungsi 2  Pintu keluar () fungsi menyebabkan program untuk mengakhiri, terlepas dari mekanisme fungsi atau."— Presentation transcript:

1 PERSON 15 YULIANY JANIS

2 6.15 Pintu keluar () Fungsi 2  Pintu keluar () fungsi menyebabkan program untuk mengakhiri, terlepas dari mekanisme fungsi atau kontrol mengeksekusi.

3 Program 6-30 3 / / Program ini menunjukkan bagaimana fungsi keluar menyebabkan program / / Untuk menghentikan eksekusi. #include #include // keluar void function(void); // Fungsi Prototipe void main(void) { function(); }

4 Program continues 4 //*********************************************************** // This function simply demonstrates that exit can be used * // to terminate a program from a function other than main. * //*********************************************************** void function(void) { cout << "This program terminates with the exit function.\n"; cout << "Bye!\n"; exit(0); cout << "This message will never be displayed\n"; cout << "because the program has already terminated.\n"; }

5 Program Keluaran 5 Program ini berakhir dengan fungsi keluar. Bye!

6 Program 6-31 6 / / Program ini menunjukkan fungsi keluar. #include #include // For exit void main(void) { char response; cout << "This program terminates with the exit function.\n"; cout << "Enter S to terminate with the EXIT_SUCCESS code\n"; cout << "or f to terminate with the EXIT_FAILURE code: "; cin >> response;

7 Program continues 7 if (response == 'S') { cout << "Exiting with EXIT_SUCCESS.\n"; exit(EXIT_SUCCESS); } else { cout << "Exiting with EXIT_FAILURE.\n"; exit(EXIT_FAILURE); }

8 Output program dengan Contoh input 8 Program ini berakhir dengan fungsi keluar. Masukkan S untuk mengakhiri dengan kode EXIT_SUCCESS atau f untuk mengakhiri dengan kode EXIT_FAILURE: s [Enter] Keluar dengan EXIT_SUCCESS. Keluaran Program Dengan Lain Contoh input Program ini berakhir dengan fungsi keluar. Masukkan S untuk mengakhiri dengan kode EXIT_SUCCESS atau f untuk mengakhiri dengan kode EXIT_FAILURE: f [Enter] Keluar dengan EXIT_FAILURE.


Download ppt "PERSON 15 YULIANY JANIS. 6.15 Pintu keluar () Fungsi 2  Pintu keluar () fungsi menyebabkan program untuk mengakhiri, terlepas dari mekanisme fungsi atau."

Similar presentations


Ads by Google