DEV Community

Sanjar Rashidov
Sanjar Rashidov

Posted on

2 2 2 2 2

setw() va setfill()

Birinchi o'rinda bu funksiyalarni ishlashi uchun "iomanip" kutubxonasi kerak bo'ladi.

iomanip - bu formatlarni va stillarni boshqaradigan kutubxona.

setw(x) - bu funksiya chop etilayotgan obeyktlar uchun consoledan x ta joy ajratadi. Agar joylar soni obyekt hajmidan katta bo'lsa qolgan joylar no'sh qoladi.

setfill() - bu funksiya setw() bilan birga ishlatiladi. Bu funksiya bo'sh qolib ketgan joylarni nima bilan to'ldirishni aytadi.

#include <iostream>
#include <iomanip>

using namespace std;

int main()
{

    cout << setw(3) << setfill('#') << endl;

    return 0;
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

The Most Contextual AI Development Assistant

Pieces.app image

Our centralized storage agent works on-device, unifying various developer tools to proactively capture and enrich useful materials, streamline collaboration, and solve complex problems through a contextual understanding of your unique workflow.

👥 Ideal for solo developers, teams, and cross-company projects

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay