C++ For Döngüleri
İçindekiler
- #include-
#include- 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;} #include- #include- 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;} #include- #include- using namespace std;int main(int argc, char *argv[]){ - - - for(int teksayilar=0; teksayilar<20; teksayilar++){ - - - - - - - - - - /* - - - - - -if(teksayilar%2==1)-{ - - - - - - - -cout<<"n"; - - - - - - - -cout< For Döngüleri do while, while, for, continue, break #include #include #include 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;} #include #include #include 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;} #include #include 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;} #include #include using namespace std;int main(int argc, char *argv[]){ for(int TekSayilar=0; TekSayilar<20; TekSayilar++){ /* if(TekSayilar%2==1) { cout<<"n"; cout< - do while, while, for, continue, break
For Döngüleri
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;
}
#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;
}
#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;
}
#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;
}
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;
}
#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;
}
#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;
}
#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;
}
#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;
}
#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;
}
#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;
}
#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;
}