Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- #include <math.h>
- #include <fstream>
- #include <cstdlib>
- #include <time.h>
- using namespace std;
- int readyForPause = 0;
- int randTimeForOperation() {
- return (int)(rand() % 50) + 1;
- }
- int randWhichMachine() {
- return (int)(rand()%2) + 1;
- }
- int randTimeForPause() {
- return (int)(rand()%30) + 1;
- }
- int randWhenPauseStart() {
- readyForPause = (int) (rand() %20) + 10 + readyForPause;
- return readyForPause;
- }
- int main() {
- fstream plik;
- int LICZBA_ZADAN = 100;
- int LICZBA_PRZERW = (int)(0.147 * LICZBA_ZADAN);
- srand(time(NULL));
- plik.open("file.txt", ios::out);
- plik << LICZBA_ZADAN << "\n";
- for(int i = 0; i < LICZBA_ZADAN; i++) {
- plik << randTimeForOperation() << ";" << randTimeForOperation() << ";1;2\n";
- }
- for(int i = 0; i < LICZBA_PRZERW; i++) {
- plik << i << ";" << randWhichMachine() << ";" << randTimeForPause() << ";" << randWhenPauseStart() << "\n";
- }
- plik.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement