1
I would like to know how to assign to characters values 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 say what type of plant H-E-O. Just below ask to say the power would like to know how to assign the types to the entered values?
For a better understanding where I want to get the exercise is this:
After reading this quantity of plants, the program requests for each plant which type of plant ( H-hydroelectric, T-Electric, E-eolica) and which power generated, After reading the data of all the plants, 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 thermoelectric power, it is operated in red flag. When the thermoelectric generation is between 10 and 20% the region operates in yellow flag?
Partner you wrote in such a strange way that in the end I did not understand your doubt...
– Andrey Hartung
I’ll summarize ... I need to make the program assign the values to the characters typed by the user. from there I calculate the percentage of each type of plant ...
– user24775
ask the user for the amount of power plants in a region, after reading this amount of power plants, the program asks for each power plant type ( h-hidroeletrica T- Termoeletrica E- eolica and what the generated power, after the distribution of all the power plants, the program accounts for 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 Termoeletrica operates in red flag. when the thermal power generation is between 10 and 20 % the region operates in yellow flag
– user24775
You want to make like a menu?
– Maurício Z.B