2
I’ve got this exercise to do:
Make a program that asks the user the amount of power plants energy in a region, after reading this amount of plants, the program requests for each plant what type of power plant (h-hydroelectric T- Electronic E- eolica and what power generated, after reading the data of all 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 electric generation is between 10 and 20 % of the region operates under the yellow flag.
But I’m having a hard time. I did this part of the code, but I can’t make the repetition work in a way that repeats until the number of plants entered by the user:
algoritmo "semnome"
// Função :
// Autor :
// Data : 08/05/2015
// Seção de Declarações
var nu,cont :inteiro tipo :caractere
inicio
cont <- 1
escreval("digite a qtd de usinas")
leia (nu)
repita
escreval("digite o tipo de cada usina ")
leia(tipo)
ate (cont = nu)
// Seção de Comandos
fimalgoritmo
Hello. Welcome to SOPT. Please read [help] and mainly [Ask]. The purpose of the site is not to do your homework. If you have specific questions about your problem, especially about something you’ve already tried (in this case, post the part of the code you’ve already done!), we’ll certainly help. Otherwise, the question will simply be too specific to be useful to anyone other than you.
– Luiz Vieira
after requesting the number of power plants, I am not able to repeat the number of power plants specified by the user, and this part is essential to manage the remaining code .
– user24775
You will notice that I edited your question (you could have done it yourself) to include your sample code. It looks much better than in the comments. Still, as I said, you lack to explain exactly where you are with doubts. So, don’t forget to [Edit] the question to include this type of information.
– Luiz Vieira
I withdrew my vote to close the question. Please put this explanation of doubt in the question. :)
– Luiz Vieira
Use a loop for(for) or while(while), that answer maybe I can help.
– rray