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

wahidustoz

Wahid Abduhakimov

Posted on March 12, 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 beliglar uzunligi so'ralgan ustunlar sonidan ko'p bo'lsa, hamma belgilar muammosiz chop etiladi. Masalan: cout << setw(1) << "Salom"; kodi garchi bitta ustun so'ralgan bo'lsa ham Salom so'zini hammasini chop etadi.
cout << setw(10) << 123 << endl; 
Enter fullscreen mode Exit fullscreen mode

setfill('')

  • Ushbu fuknsiya 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.`
💖 💪 🙅 🚩
wahidustoz
Wahid Abduhakimov

Posted on March 12, 2024

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

Sign up to receive the latest update from our blog.

Related

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

March 12, 2024

Maxsus belgilar | C++ boshlang'ich
beginners Maxsus belgilar | C++ boshlang'ich

March 18, 2022