fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <iomanip>
  4. using namespace std;
  5.  
  6. int main () {
  7.  
  8. // Setw() - This advanced the coursor a number of spaces.
  9. cout<<"I use setw(15) so next line has to be 15 total chars"<<endl;
  10. cout << setw (15);
  11. cout <<"Fifteen"<<endl;
  12. cout<<"12345678"<<endl<<endl;
  13. cout<<"Fifteen==7, 15-7=8... so the count is 8 chars indented"<<endl;
  14.  
  15.  
  16.  
  17. //-------------Pause
  18. cout<<endl<<endl<<endl<<"Please Close Console Window"<<endl;
  19. cin.ignore('\n', 1024);
  20. return(0);
  21. }
Success #stdin #stdout 0.02s 2732KB
stdin
Standard input is empty
stdout
I use setw(15) so next line has to be 15 total chars
        Fifteen
12345678

Fifteen==7, 15-7=8... so the count is 8 chars indented



Please Close Console Window