When printing string, meaningless characters are shown

Asked

Viewed 66 times

0

I need to do a program that calculates the average salary of a company, asking the user for the amount of employees, the name and salary of each employee and returning the average, the name of the employee with the highest salary and the name of the employee with the lowest salary.

The program must first request the number of employees and then ask for the names of each one of them.

The program is almost ready, the only problem is that at the time of execution it does not show the names as it should show, but rather a lot of meaningless characters. Can someone tell me where my mistake is?

char nome[11], nome_maior[11], nome_menor[11];
int quant, cont = 1;
float salario, salario_maior = 0, salario_menor=999999, media, soma;

printf("Digite a quantidade de funcionários: "); scanf("%d", &quant);

while(cont <= quant){
    printf("\nInsira o NOME do funcionário: "); scanf("%s", nome);
    printf("\nInsira o salário: "); scanf("%f", &salario);
    soma = soma + salario;
    cont = cont + 1;
    if(salario < salario_menor){
       nome_menor == nome;  
       salario_menor = salario;
    }if(salario > salario_maior){
        nome_maior == nome;
        salario_maior = salario;
    }}
            printf("\nO maior salário é de %s com %.2f", nome_maior, salario_maior);
            printf("\nO menor salário é de %s com %.2f", nome_menor, salario_menor);
            printf("\nA média dos salários apresentados é de %.2f", media=salario/quant);
return 0;

Caracteres estranhos

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.