setw error

Write your question here.
it dose not display the first three digits followed by zero instead show other three digits
1
2
3
4
5
6
7
8
9
10
11
12
#include<iostream>
#include<iomanip>
#include<conio.h>
using namespace std;
int main()

{
	
	cout<<setw(1)<<0331<<setw(5)<<96<<setw(3)<<26<<setw(3)<<46<<setw(3)<<9;
getch();
}
  Put the code you need help with here.
Could you give some more details of what you expect to see.

AFAICT from the code above, you try and print:
217 with a minimum width of 1
96 with a minimum width of 5
26 with a minimum width of 3
46 with a minimum width of 3
9 with a minimum width of 3
0331 - this is interpreted as a value in octal notation, rather than decimal.
thus, 331octal = 3*64 + 3*8 + 1 = 217decimal
Topic archived. No new replies allowed.