noone wrote:
On Sat, 28 Oct 2006 15:49:16 -0700, 2005 wrote:
Hi
I know
2000%1000 = 0
What can I do it to print "0" 3 times
000
The above is an exceptional case and simple cases are (this no problem)
2123%1000 = 123
Thanks
using namespace std;
cout << fixed << setw(3) << setfill('0') << (2000%1000);
// define fixed field width output
// set the field width
// define a fill character
Thank you but surprisingly I am getting a strange behaviour - it is
also putting "0" everywhere where there was setw() ???
Could you tell me as to what is that I am not getting it right? Below
is the code (it made no difference even if I put in "fixed" so I took
it off)
while(pCurNode)
{
cout<< setw(1) << setiosflags(ios::left) << ++nCount << ". " << " "
<< setw(30) << setiosflags(ios::left) << pCurNode->m_aName
<< setw(10) << setiosflags(ios::left) << pCurNode->m_nAge
<< setiosflags(ios::left) << pCurNode->m_nSalary/m << ","
<< setw(3) << setfill('0') << pCurNode->m_nSalary%m << endl;
// << setiosflags(ios::left) << (pCurNode->m_nSalary)/m << endl;
pCurNode = pCurNode->m_pLink;
}