Advertisement
EternalMugen

Untitled

Mar 25th, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. #include <fstream>
  2. #include <iostream>
  3.  
  4.  
  5. int main ()
  6. {
  7.     int n, i = 1;
  8.  
  9.     std::cout <<"Enter number: "<<std::flush;
  10.     std::cin >> n;
  11.  
  12.     std::ofstream f("filename.txt");
  13.  
  14.     while (i != n)
  15.     {
  16.         f << i <<std::endl;
  17.         i++;    
  18.     }
  19.    
  20.     f.close();
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement