{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

break-6 - Break Komutu Break komutunu swtich komutundan...

Info icon This preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Break Komutu Break komutunu, swtich komutundan çıkmak için önceki derslerimizde görmüştük. Komutun kendine özgü bir kullanımı daha vardır. Break komutu bir döngünün içinde çalıştırılırsa o an o döngü biter. Bir goto gibi işlem gördüğünü de söyleyebiliriz. Break kullanınca program döngüyü bitirir ve döngünün sonundaki satırdan çalışmaya devam eder. Bir örnek verelim.
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
//break.cpp //break komutunu kullandik. #include <iostream.h> int main() { for (int x = 1; x <= 10; x++) { if (x == 7) { break; } cout<< x << " "; } } İşte örneğimizde gördüğünüz gibi. X 7'ye eşit olunca break; döngüyü bitiriyor ve döngüden sonraki satırı çalıştırmaya başlıyor.
Image of page 2
Örnekler 1) //Derecenin sin,cos,tan değerlerini bulma #include <iostream.h> #include <math.h> int main() { double x; //x i tanımladık x = 45.0; // 45 derece x *= 3.141593 / 180.0; // Dereceyi radyal değere döndürme cout<<"45 derecenin sinusu: "<< sin(x)<<endl; cout<<"45 derecenin kosinusu: "<< cos(x)<<endl; cout<<"45 derecenin tanjantı: "<< tan(x)<<endl;
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern