Matrix_code

zzz - String-Capacity-Check.cpp

Jan 2nd, 2019 (edited)
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.31 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5. int main() {
  6.     string s;
  7.     int pre = 0;
  8.     for(int i = 0; i < 100000000; i ++) {
  9.         s.push_back('a');
  10.         if(s.capacity() != pre) {
  11.             if(pre != 0) cout << 1. * s.capacity() / pre << endl;
  12.             pre = s.capacity();
  13.         }
  14.     }
  15. }
Add Comment
Please, Sign In to add comment