Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
SEGUNDO AVANCE DE NETFLIX
#include <stdio.h> #include <stdbool.h> #include <string.h> #include <ctype.h> typedef struct { char nombre[26]; char codigo[4]; float rating; unsigned short cantidad; char cantGeneros[5][11]; }datosDeSeries; // ---------------Prototipos------------------ void input(datosDeSeries *, unsigned short); void mostrar(datosDeSeries *, unsigned short); void strUpper(char *); //void mostrarPorPais(datosDeSeries *, unsigned short); // -------------------------Main Program------------------------------ int main(void) { unsigned short total; char comando[18]; datosDeSeries series[1000]; scanf("%hu", &total); getchar(); input(series, total); while (true) { scanf("%17s", comando); if ( strcmp(comando, "FIN") == 0 ) break; if ( strcmp(comando, "MOSTRAR") == 0 ) mostrar(series, total); //if ( strcmp(comando, "BUSCAR_POR_PAIS") == 0 ) } printf("---- FIN ----"); return 0; } // -----------------------Functions----------------------------- void input(datosDeSeries *array, unsigned short total) { unsigned short i, j; for (i = 0 ; i < total ; i++) { scanf("%25[^#]s", array[i].nombre); getchar(); strUpper(array[i].nombre); scanf("%3[^#]s", array[i].codigo); getchar(); strUpper(array[i].codigo); scanf("%f", &array[i].rating); getchar(); scanf("%hu", &array[i].cantidad); getchar(); for (j = 0 ; j < array[i].cantidad; j++) { scanf("%10[^#]s", array[i].cantGeneros[j]); getchar(); strUpper(array[i].cantGeneros[j]); } getchar(); } } void mostrar(datosDeSeries *array, unsigned short total) { unsigned short i, j; printf("------------------------------------\n"); printf(" MOSTRANDO LISTADO DE SERIES\n"); printf("------------------------------------\n"); for ( i = 0 ; i < total ; i ++) { printf("%25s %4s %6.1f", array[i].nombre, array[i].codigo, array[i].rating); for ( j = 0 ; j < array[i].cantidad; j++ ) printf("%12s", array[i].cantGeneros[j]); printf("\n"); } } void strUpper(char *cadena) { while ( *cadena != '\0' ) { if ( islower(*cadena) ) *cadena = toupper(*cadena); cadena ++; } }
run
|
edit
|
history
|
help
0
18BCE2182 ASSESS_1 Q2-1
A_141117_Euclides
14th Feb Project v0.3
ARREGLO DE VARIABLES DE TIPO STRUCT
Dynamic array
B_141104_NotaInterroganteDosPuntos
voltage float hex value
light blue zoda
PUNTEROS 1
A_141121_mayorMenor