Hi this is more a formatting issue and i was just wondering if anybody could let me know if my problem can be solved.

In my program i am outputting four pieces of information on one line, all of them are numbers and one is an integer and the rest are numbers to 2 decimal places. The problem arises when the integer Value changes from 9 to 10, or 99 to 100 i.e. an extra number is added as the rest of the data is outputted after a certain number of spaces and so it makes my table of data look a bit skewy.

Column A Column B Column C Column D
1 XXX XXX XXX
9 XXX XXX XXX
10 XXX XXX XXX

So i was wondering if there are any solutions to this problem, apart from displaying the numbers in column A with leading zeros, or doing IF statements which register when there is an increase from 9 to 10 etc.

You'll need to adjust your output field width, and possibly your output alignment. Look into the options provided by the <iomanip> header.

Thats great thanks problem fixed!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.