Advertisement
kaunas163

Skaičiai iš eilės

Feb 18th, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <stdlib.h>
  4. #include <time.h>
  5. using namespace std;
  6.  
  7. void GeneruojaIrSpausdina(int kiek);
  8.  
  9. int main() {
  10.     setlocale(LC_ALL, "Lithuanian");
  11.  
  12.     int kiek;
  13.     cout << "Kiek eilučių generuoti? ";
  14.     cin >> kiek;
  15.     cout << endl;
  16.  
  17.     GeneruojaIrSpausdina(kiek);
  18.     system("pause");
  19.     return 0;
  20. }
  21.  
  22. void GeneruojaIrSpausdina(int kiek) {
  23.     ofstream fout("Skaiciai.txt");
  24.     int a = 11111;
  25.  
  26.     for (int i = 0; i < kiek && a < 100000; i++)
  27.     {
  28.         fout << a << endl;
  29.         a++;
  30.     }
  31.     cout << "Skaičiai išvesti į failą Skaiciai.txt\n\n\n";
  32.     fout.close();
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement