Portuguese doubts about assigning values to characters

1

I would like to know how to assign characters already typed by the user in the loop.

Code:

nu,cont,contp :inteiro

pot :inteiro

tipo :caractere
inicio


cont <- 1
escreval("digite a qtd de usinas")
leia (nu)

escreval ("H-hidroeletrica")
escreval("T-Termoeletrica")
escreval("E-EOLICA")

repita

escreval("digite o TIPO de cada usina ")
leia(tipo)    

cont <- cont+1

ate (cont > nu)    

repita

contp <- contp+1

escreval("Digite a **POTENCIA** de cada usina ")
leia(pot)    

ate  contp = nu)

My question and I asked the user to tell you the type of the H-E-O plant. Just below ask to say the power would like to know how to assign the types to the values entered?

For a better understanding where I want to get the exercise is this:

After reading this number of mills, the program asks for each plant which type of plant (H-hydroelectric, T-thermoelectric, E-eolic) and which power is generated, after reading the data from all the plants in the program counts the total energy generated for each type and evaluates in which flag the region should operate. when more than 20% of the energy generated is from a thermoelectric plant, it operates on a red flag. When the thermoelectric generation is between 10 and 20% does the region operate on a yellow flag?

    
asked by anonymous 08.05.2015 / 15:32

1 answer

1

You can not understand right what you want, but I think it helps you:

INICIO

    VARIAVEIS
    quantidade, potencia: inteiro;
    tipo: char;

    ESCREVA("Digite a quantidade de usinas: ");
    LEIA(quantidade);

    ESCREVA("Digite o tipo de usina: ");
    LEIA(tipo);

    ESCREVA("Digite a potência gerada: ");
    LEIA(potencia);

    SE (potencia >= 20) ENTAO
        ESCREVA("Bandeira Vermelha");

    SE (potencia > 10 E potencia < 20) ENTAO
        ESCREVA("Bandeira Amarela");

FIM
    
12.09.2016 / 23:28