setw() & setfill() | C++ boshlang'ich

islomali99

islomAli99

Posted on May 7, 2024

setw() & setfill() | C++ boshlang'ich

setw(n)

  • Ushbu funksiya chop etish uchun ma'lum uzunlik ya'ni ustunlar so'raydi. Masalan:
    setw(5) - chop etish uchun 5 ta ustun so'raydi.

  • agar chop etilayotgan belgilar uzunligi so'ralgan ustunlar sonidan ko'p bo'lsa, hamma belgilar muammosiz chop etiladi. Masalan: cout << setw(1) << "Salom"; kodi garchi bitta ustun so'ralganda hamma Salom so'zini hammasini chop etadi.

cout << setw(10) << 123 << endl;
Enter fullscreen mode Exit fullscreen mode

setfill('')

  • Ushbu funksiya setw() funksiya bilan doimo birgalikda ishlatiladi.

  • setfill('') funksiyasi setw ishlatilganda hosil bo'lgan bo'sh kataklarni berilgan belgi bilan to'ldiradi. Masalan: cout << setw(5) << setfill('.') << 7 << endl; kodi ....7 chop etadi.

💖 💪 🙅 🚩
islomali99
islomAli99

Posted on May 7, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

If else statement in C++
beginners If else statement in C++

March 7, 2024

Variables in C++
beginners Variables in C++

March 4, 2024

C++ Ozgaruvchilar
beginners C++ Ozgaruvchilar

March 24, 2023

c ++ kirish
beginners c ++ kirish

March 10, 2023