13 Kasım 2015 Cuma

While Döngüsü-1

While Döngüsü-1

C Döngüler ve while döngüsü incelenedi. break ve continue deyimi nasıl çalışır. while kullanılarak asci tablosu uygulaması gerçeklenmesi.

/* Açıklama: While döngüsünün iskelet yapısı ve çalışması.
 * while döngüsünde break ve continue kullanımı.
 */

#include <stdio.h>
#include <stdlib.h>

int main(void) {
//while döngüsünün iskelet yapısı ve calismasi
{
//dongu deyimleri : while, do-while, for
//while(ifade) { //control expression
// deyim1; //loop body
// deyim2;
//}
//kod1
}
//while döngüsüne ornek
{
int counter = 0;
while(counter < 100) {
printf("%d\n", counter);
++counter;
}
printf("Bitti\n");
}

//while döngüsü ile asci tablosunun ekrana yazdırılması
{
int ch = 0;
while( ch < 126 ) {
printf("%c\t%d\n", ch, ch);
++ch;
}
}
// while döngüsü içine sabit bir ifade yazılması
{
int cond  = 10;
while(cond) {
printf("%d\n", cond);
--cond;
}
printf("bitti");
}

//while ile sonsuz dongu
{
while(1)
{
printf("deyim%d", );
}
}

//break : while döngüsünden  cikarir
/*while(ifade) {
deyim1;
if(ifade1)
break;
deyim2;
}*/
//kod1

//break-while örnek
{
int counter = 0;

while( counter < 100 ) {
printf("%d\t", counter);
if( counter == 50 )
break;
printf("%d\n",counter);
++counter;
}
printf("bitti");
}

//while döngüsünde continue kullanılması
/*while(ifade) {
deyim1;
if(ifade1)
continue;
deyim2;
}*/
//kod1

//while ile continue basit bir örnek
{
int counter = 0;

while( counter < 100 ) {
printf("%d\t", counter);
if( counter == 50 ){
++counter;
printf("\n");
continue;
}

printf("%d\n",counter);
++counter;
}


}
return EXIT_SUCCESS;
}

Konu ile ilgili daha detaylı bilgi için video izleyiniz.


Hiç yorum yok:

Yorum Gönder