iomanip (setprecision, setw)
Në shqip përdoret i njëjti emër.
ShpjegimiSQ
Libraria <iomanip> e formaton daljen në cout: std::fixed dhe std::setprecision(2) shfaqin numrat me dy shifra pas presjes, dhe std::setw(10) rezervon 10 karaktere gjerësi — për tabela të rregullta.
EnglishEN
The <iomanip> library formats cout output: std::fixed and std::setprecision(2) show numbers with two decimal places, and std::setw(10) reserves 10 characters of width — for tidy tables.
Si ta mendosh
Si linjat në fletoren e matematikës që i mbajnë numrat në kolona të drejta.
Lexoje në anglisht
Like the grid in a maths notebook that keeps numbers in straight columns.
Shembull kodicpp
#include <iomanip>
double mesatarja = 4.3333;
std::cout << std::fixed << std::setprecision(2) << mesatarja; // 4.33
std::cout << std::setw(8) << "Arta";