Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <stdlib.h>
- #include <time.h>
- using namespace std;
- void GeneruojaIrSpausdina(int kiek);
- int main() {
- setlocale(LC_ALL, "Lithuanian");
- int kiek;
- cout << "Kiek eilučių reikia? ";
- cin >> kiek;
- cout << endl;
- GeneruojaIrSpausdina(kiek);
- system("pause");
- return 0;
- }
- void GeneruojaIrSpausdina(int kiek) {
- ofstream fout("Skaiciai.txt");
- int a;
- srand(time(NULL));
- for (int i = 0; i < kiek; i++)
- {
- for (int i = 0; i < 8; i++)
- {
- a = rand() % 10;
- fout << a;
- }
- fout << endl;
- }
- cout << "Skaičiai išvesti į failą Skaiciai.txt\n\n\n";
- fout.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement