Jul 19, 2015 at 3:52am Jul 19, 2015 at 3:52am UTC
Hi, help with this code:
#include <stdlib.h>
#include <stdio.h>
#include <strings.h>
int main()
{
char nome[50];
char muie[50];
float altura = 1, maior = -9999;
int cont = 0;
while(altura > 0){
printf("Digite o nome da muie ae: ");
scanf("%s", &nome);
printf("Agora digite a alturinha ae: ");
scanf("%f", &altura);
if(altura > maior){
maior = altura;
muie = nome;
}
cont++;
}
printf("A muie %s eh a mais alta da regiao com altura %.2f\n", muie, maior);
printf("A quantidade de muie nessa bagacinha ae eh %d", cont);
return 0;
}
Jul 21, 2015 at 9:10pm Jul 21, 2015 at 9:10pm UTC
Try this
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
#include <stdlib.h>
#include <stdio.h>
#include <strings.h>
int main()
{
char nome[50];
char muie[50];
float altura = 1, maior = -9999;
int cont = 0;
while (altura > 0){
printf("Digite o nome da muie ae: " );
scanf("%s" , &nome);
printf("Agora digite a alturinha ae: " );
scanf("%f" , &altura);
if (altura > maior){
maior = altura;
muie == nome;
}
cont++;
}
printf("A muie %s eh a mais alta da regiao com altura %.2f\n" , muie, maior);
printf("A quantidade de muie nessa bagacinha ae eh %d" , cont);
return 0;
}
Runs perfect with codeblocks
but, yeah as @coputergeek01 said ,............how would you break your loop or ...you know however this code runs perfectly with me
Last edited on Jul 21, 2015 at 9:13pm Jul 21, 2015 at 9:13pm UTC