1 / 12

Döngü ve Koşul Komutları

Döngü ve Koşul Komutları. Yard . Doç.Dr . Cihad DEMİRLİ. Operatörler. Döngü Komutları. Tekrarlı ya da ardışıl işlemlerin yapılmasını sağlarlar. Üç grupta değerlendirilebilirler; Sayıcılı döngü: Döngü işlemi bir sayaca bağlı

oriole
Download Presentation

Döngü ve Koşul Komutları

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Döngü ve Koşul Komutları Yard.Doç.Dr. Cihad DEMİRLİ

  2. Operatörler

  3. Döngü Komutları • Tekrarlı ya da ardışıl işlemlerin yapılmasını sağlarlar. • Üç grupta değerlendirilebilirler; • Sayıcılı döngü: Döngü işlemi bir sayaca bağlı • Ön koşullu döngü: Döngü işlemi koşullara bağlı (öncesinde kontrol) • Son koşullu döngü: Döngü işlemi koşullara bağlı (sonunda kontrol)

  4. Döngü Komutlarıfor for ( tip baslangic_degeri; kosul;artim) { ………………… ………………… } Tek komut satırı için {…} açmaya gerek yoktur Koşul sağlandığı sürece döngü

  5. Döngü Komutlarıwhile while (kosul) { ………………… ………………… } Tek komut satırı için {…} açmaya gerek yoktur Koşul sağlandığı sürece döngü

  6. Döngü Komutlarıdo - while do { ………………… ………………… } while (kosul); Tek komut satırı için {…} açmaya gerek yoktur Koşul sağlandığı sürece döngü işlemler en az bir kere gerçekleşir…

  7. Koşul Komutlarıif if (koşul) { komut(lar) ………………… ………………… }

  8. Koşul Komutlarıif-else if( koşul) { komut(lar) ………………… ………………… } else { komut(lar) ………………… ………………… }

  9. Koşul Komutları? Koşul ?if_komut(lar) : else_komutlar;

  10. Koşul Komutlarıif-else if • if( koşul 1) { • komut(lar) 1 • } else if( koşul 2) • {komut(lar) 2 • } • . . . • else if( koşul n) { • komut(lar) n • } • else { komut(lar) n • }

  11. Koşul Komutları swicth- case switch( degisken) { casesabit1: komut(lar); break; casesabit2: komut(lar);break; . . . casesabitN: komut(lar); break; default: komut(lar); }

  12. devam edecek…

More Related