// Demonstrate the use of set width manipulator.
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
cout << "results \n";
//variables
int num1 = 321;
int num2 = 231;
// setw examples
cout << num1 << num2 << "\t | no setw \n";
cout << setw(1) << num1 << setw(1)<< num2 << "\t | 1 setw \n";
cout << setw(5) << num1 << setw(5) << num2 << "\t | 5 setw \n";
cout << setw(10) << "hallo" << "\t | string setw 10 \n";
cout << setw(3) << "hallo" << "\t | string setw 3 \n";
cin.ignore(numeric_limits<streamsize>::max(), '\n');
cin.get();
return 0;
}
Thursday, 24 January 2013
program 2-5(51) Demonstrate set width manipulatore
08:04
ATEEK
No comments
0 comments:
Post a Comment