View Single Post
Old Mar 31st, 2005, 10:09 AM   #6
mackenga
Professional Programmer
 
Join Date: Mar 2005
Location: Glasgow, Scotland
Posts: 317
Rep Power: 4 mackenga is on a distinguished road
No offence, but that's some pretty twisted code. In your printf() format strings, you have multiple %c (character) parts, followed by the constant 32. This is exactly the same as just including a space in the format string. I can't see any reason for doing it this way.

The problems with the layout will be because you output the same number of spaces to pad out columns no matter what the length of the actual content is. I haven't actually tried the program (I can only get online at the library at the moment and their machine doesn't even have a C compiler...I feel claustrophobic!) or looked at it in great detail (running it would help with that) but I notice that nowhere in your program does it seem to measure strings and calculate the amount of padding required.

Not sure about this, but you always, in your program, count co-ords on the screen from 1 up to for example 80, not 0 to 79, which looks a little strange to me. Are you sure you shouldn't be counting from zero? Like I say I'm not sure if this is right. You might well know better than I do in this regard.

Ah, I see you don't actually need to calculate padding because you're always using gotoxy() to go to where the fields ought to start; so probably disregard at least some of what I've said here. The only other thing that springs to mind that could be giving you layout issues is the fact that each time input is read, it's echoed, which will move the cursor. Are you accounting for that?

Just one last thing; your choice of variable names is a bit bizarre. This makes it much harder to skim your program and see what's going on. It took me about five minutes of frowning to realise that ColumnHandler is just an int, and with that long name and those CapitalLetters in it, I couldn't help thinking of it as a class

Hope I've said something helpful in this rambling post.
mackenga is offline   Reply With Quote