Generation

generate functionMon, 24 Apr 2023

Crear una estructura para almacenar información sobre una canción, incluyendo su título, artista, género, duración y año de lanzamiento. Luego, crear un programa que permita ingresar la información de varias canciones y mostrarlas en pantalla ordenadas por género y título

// creando una estructura: typedef struct { string title; string artist; string genre; float duration; int year; } song; // Declarando una variable de tipo song song a_song; // Declarando un arreglo de tipo song song my_song_list[10]; my_song_list[0] = song("title", "artist", "genre", 3.21, 2018); my_song_list[1] = song("title2", "artist2", "genre2", 4.20, 2019); // accediendo a los datos que contiene una variable del tipo song cout << my_song_list[0].title; cout << my_song_list[0].duration; // ordenando de menor a mayor for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { if (my_song_list[i].duration <

Questions about programming?Chat with your personal AI assistant