Advertisement
axyd

C++ printf - Fixed Width

Oct 10th, 2016
396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. /*  http://www.cplusplus.com/reference/cstdio/printf    */
  2. /*  %[flags][width][.precision][length]specifier    */
  3.  
  4. #include <iostream>
  5. #include <cstdio>
  6. using namespace std;
  7.  
  8. int main(){
  9.     unsigned long long index = 1;
  10.     unsigned long rr[1000000] {0};
  11.     unsigned long cc[1000000] {0};
  12.     unsigned long long sum;
  13.     while ( index != 10000000000000) {
  14.         rr[index]= index+100;
  15.         cc[index]= index+200;
  16.         sum += (rr[index] * cc[index]);
  17.        
  18.         printf ("%-*lu %-*lu %-*llu\n", 10, rr[index],10, cc[index],30, sum);
  19.         ++index;
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement