dopo@dc-business.com 0 Posted May 8, 2019 Report Share Posted May 8, 2019 (edited) Boas. Preciso de fazer um exercício para que apresente o nome da banda, o tipo de música, quantos integrantes e qual é o ranking. Eu consegui fazer mas no resultado, o tipo de música aparece-me um "?" e no ranking aparece-me 0. Foram usadas 2 folhas. 1ª Folha (main) #include <stdio.h> #include <stdlib.h> #include <locale.h> #include "oi.h" int main() { setlocale(LC_ALL,"portuguese"); int x; for(x=0;x<5;x++) { system("cls"); printf("Digite o nome da banda: "); gets(musica[x].nome); printf("\nDigite o tipo de música: "); gets(musica[x].tipo); printf("\nQuantos integrantes tem a banda: "); scanf("%i",&musica[x].n); fflush(stdin); printf("\nQual é a posição da banda no ranking: "); scanf("%i",&musica[x].tipo); fflush(stdin); } system("cls");\ for(x=0;x<5;x++){ printf("Nome: %s\n",musica[x].nome); printf("Música: %s\n",musica[x].tipo); printf("Nº.Integrantes: %i\n",musica[x].n); printf("Ranking: %i\n",musica[x].pos); } return x; } 2ª Folha #ifndef OI_H_INCLUDED #define OI_H_INCLUDED struct banda{ char nome[35]; char tipo[15]; int n; int pos; }; struct banda musica[5]; #endif // OI_H_INCLUDED Edited May 13, 2019 by thoga31 GeSHi Link to post Share on other sites
HappyHippyHippo 1,162 Posted May 16, 2019 Report Share Posted May 16, 2019 vê onde estás a gravar o valor de posição IRC : sim, é algo que ainda existe >> #p@p Portugol Plus Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now