Borrar filtros
Borrar filtros

Question for Pascal users?

3 visualizaciones (últimos 30 días)
Juan
Juan el 16 de Mzo. de 2018
Editada: Juan el 16 de Mzo. de 2018
I have a job application in which I need to solve an easy problem through programing. I've solved it through Matlab (my favourite software for these kind of problems) but they asked me to write it for Pascal software. I've never used that program and I'm stuck.
If someone knows Pascal language could you please translate the following code? It's really easy and short.
I thank you in advance
function [CT] = CostoTotal(U)
F(1)=0;
CE =0;
for dia=1:365
for hora=1:24
if hora<=7 & hora>=23
precio_horario=60*rand;
else
precio_horario=120*rand;
end
if precio_horario >= U
P=0;
else
P=1;
end
F(hora + (dia-1)*24 + 1)= F(hora + (dia-1)*24) + 1-P*5;
CE=CE + precio_horario*P;
end
end
cpp = sumsqr(max(F,0))*1000/8760;
CT = CE + cpp;

Respuestas (0)

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by