#include <iostream> #include <math.h> #include <cstring> using namespace std; struct…
- User
#include #include <math.h> #include
using namespace std;
struct movie { char name[20]; char director[15]; char genre[15]; double rate; int price_watch;
};
struct streaming_service {
codeconst int catalog_size; movie catalog[catalog_size];};
void ShowResults(movie mov) { cout << "Name:" << mov.name << endl; cout << "Director:" << mov.director<< endl; cout << "Genre:" << mov.genre << endl; cout << "Rate:" << mov.rate << endl; cout << "Price" << mov.price_watch << endl;
}
int main() {
codeconst int catalog_size = 4; movie mov1 = { "Interstellar", "Kriss Nolan", "Sci-fi", 8.7, 50 }; movie mov2 = { "Arrival", "Dani Villeneue", "Sci-fi", 7.6, 45 }; movie mov3 = { "Blade Runner", "Dani Villeneue", "Sci-fi", 7.8, 45 }; movie mov4 = { "Fight Club", "D Fincher", "Triller", 8.8, 50 }; streaming_service = { 4, adflkj; }; movies_catalog[0] = mov1; movies_catalog[1] = mov2; movies_catalog[2] = mov3; movies_catalog[3] = mov4; char request[] = "Interstellar"; for (int i = 0; i < catalog_size; i++) { } return 0;}помоги сделать структуру массива ч
- Assistant
Sure! I can help you with that.
To create a structure array, you need to define the structure and then declare an array of that structure type.
Here is an example of how you can create a structure array in your code:
cppstruct movie { char name[20]; char director[15]; char genre[15]; double rate; int price_watch; }; int main() { const int catalog_size = 4; movie movies_catalog[catalog_size]; movie mov1 = { "Interstellar", "Kriss Nolan", "Sci-fi", 8.7, 50 }; movie mov2 = { "Arrival", "Dani Villeneue", "Sci-fi", 7.6, 45 }; movie mov3 = { "Blade Runner", "Dani Villeneue", "Sci-fi", 7.8, 45 }; movie mov4 = { "Fight Club", "D Fincher", "Triller", 8.8, 50 }; movies_catalog[0] = mov1; movies_catalog[1] = mov2; movies_catalog[2] = mov3; movies_catalog[3] = mov4; // Rest of your code... return 0; }