Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <math.h>
- int main()
- {
- char nome[100][30];
- float dados[100][2],maisVelho=0,contMaisVelho=0;
- int i,k,j;
- for(i=0;i<100;i++)
- {
- __fpurge(stdin);
- printf("\n Digite o nome: ");
- fgets(nome[i],30,stdin);
- if(strlen(nome[i])==1) break;
- printf("\n Digite a idade: ");
- scanf("%f",&dados[i][0]);//a posição j=0 é responsavel pelas idades
- printf("\n Digite o peso: ");
- scanf("%f",&dados[i][1]);//a posição j=1 é responsavel pelos pesos
- if(dados[i][0]==maisVelho) contMaisVelho++;
- if(dados[i][0]>maisVelho)
- {
- maisVelho = dados[i][0];
- k=i;
- }
- }
- for(j=0;j<i;j++)
- {
- if(dados[j][0]>=15 && dados[j][0]<=19 && dados[j][1]>80) printf("\n %s",nome[j]);
- }
- if(contMaisVelho > 0)
- {
- printf("\n existe(m) outro(s)... nome: %s",nome[k]);
- }else{
- printf("\n Nome do mais velho: %s",nome[k]);
- }
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement