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?

Recommended Answers

All 2 Replies

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);
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.