Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #pragma warning(disable : 4996)
- using namespace std;
- struct series
- {
- char name[100];
- int age;
- int year;
- double rating;
- double veiws;
- bool ongoing;
- bool original;
- int season;
- int episodes;
- double minutes;
- int best_episodes[15];
- };
- int main() {
- typedef struct series s;
- const int n = 5;
- s st[n]{};
- strcpy(st[0].name, "game of thrones"); //кстати не важно какое имя введешь, всё равно генерирует по структуре
- strcpy(st[1].name, "doctor who");
- strcpy(st[2].name, "house of the dragon");
- strcpy(st[3].name, "elementary");
- strcpy(st[4].name, "misfits");
- for (int i = 0; i < n; i++)
- {
- cout << "\n" << "enter the name of series: ";
- cin >> st[i].name;
- st[i].age = rand() % 3 + 16; //возрастное ограничение - примерно работает
- cout << "\n" << "age " << st[i].age;
- st[i].year = rand() % 10 + 2000;
- cout << "\n" << "year " << st[i].year;
- st[i].rating = rand() % 10;
- cout << "\n" << "rating " << st[i].rating;
- st[i].veiws = rand();
- cout << "\n" << "veiws " << st[i].veiws;
- st[i].ongoing = rand() % 2;
- cout << "\n" << "ongoing " << st[i].ongoing;
- st[i].original = rand() % 2;
- cout << "\n" << "original " << st[i].original;
- st[i].season = rand() % 10;
- cout << "\n" << "season " << st[i].season;
- st[i].episodes = rand() % 10 + 10;
- cout << "\n" << "episodes " << st[i].episodes;
- st[i].minutes = rand() % 40 + 10;
- cout << "\n" << "minutes " << st[i].minutes;
- cout << "\n" << "best_episodes ";
- for (int k = 0; k < 15; k++) //сделать так, чтобы числа не повторялись!!!
- {
- st[i].best_episodes[k] = rand() % 10 + 5;
- cout << " " << st[i].best_episodes[k];
- }
- cout << "\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement