do while, while, for, continue, break
#include <cstdlib>
#include <iostream>
#include <conio.h>
using namespace std;
int main(int argc, char *argv[])
{
char Tus;
/*
while(Tus!=27){
Tus=getch();
printf(“%c”, Tus);
}*/
do{
Tus=getch();
printf(“%c”, Tus);
} while(Tus!=27);
system(“PAUSE”);
return EXIT_SUCCESS;
}
For Döngüleri
#include <cstdlib>
#include <iostream>
#include <string.h>
using namespace std;
int main(int argc, char *argv[])
{
char Isim[15];
int Say=0;
printf(“Isminizi giriniz “);
scanf(“%s”, &Isim);
do{
printf(“n%s”, Isim);
Say++;
}
while(Say!=strlen(Isim));
printf(“n”);
system(“PAUSE”);
return EXIT_SUCCESS;
}
For Döngüleri
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
int Sayilar[5];
//int Index=0;
/*
do{
printf(“n%d. Sayiyi giriniz”, Index+1);
scanf(“%d”, Sayilar[Index]);
Index++;
}while(Index>5);
*/
for(int Mindex=0; Mindex<5; Mindex++){
printf(“n%d. Sayiyi giriniz “, Mindex);
scanf(“%d”, &Sayilar[Mindex]);
}
//printf(“%d %d %d %d %d”, Sayilar[0], Sayilar[1], Sayilar[2], Sayilar[3], Sayilar[4]);
for(int Mindex=4; Mindex>=0; Mindex–){
printf(“n %d. deger=%d”, Mindex, Sayilar[Mindex]);
}
printf(“n”);
system(“PAUSE”);
return EXIT_SUCCESS;
}
For Döngüleri
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
for(int TekSayilar=0; TekSayilar<20; TekSayilar++){
/*
if(TekSayilar%2==1) {
cout<<“n”;
cout<<TekSayilar;
}
*/
//continue sadece cift sayilarda devreye giriyor
//continue devreye girince continue altindaki satilara bakilmadan
//dongu devam ediyor
if(TekSayilar%2==0){
continue;
}
cout<<“n”;
cout<<TekSayilar;
}
cout<<“n”;
system(“PAUSE”);
return EXIT_SUCCESS;
}
For Döngüleri