Difference between revisions of "CPP/IO/Setw"

From ProgrammingExamples
< CPP
Jump to: navigation, search
(Created page with '==Setw.cpp== <source lang="cpp"> #include <iostream> #include <iomanip> using namespace std; int main(int argc, char* argv[]) { cout << "d: " << setw(15) << 5.42 << endl; c…')
 
(No difference)

Latest revision as of 09:09, 23 June 2010

Setw.cpp

#include <iostream>
#include <iomanip>
 
using namespace std;
 
int main(int argc, char* argv[])
{
  cout << "d: " << setw(15) << 5.42 << endl;
  cout << setw(4) << "d: " << setw(15) << 5.1 << endl;
 
  return 0;
}