0

I'm kind of new to c++ and i wrote a simple program to convert ounces to grmas and when i had finished i was wondering if there was a user interface so i can make it look appealing?

3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Ancient Dragon
0

If you just want your console program to display the data in coluns you can use setw() to set the solumn width and left or right to left or right justify the data inside the column. Example

#include <iostream>
#include <iomanip>
using std::cout;
using std::right;
using std::setw;

int main()
{
   int x = 12;
   int y = 12345;
   cout << setw(10) << right << x << setw(5) << right << y << '\n';
}

IMO I actually prefer the C way to do it because I think its easier, but you may not have this option since you are probably taking a c++ course.

int x = 12;
   int y = 12345;
   printf("%10d5d\n", x,y);

Edited by Ancient Dragon: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.