Question for Pascal users?

1 vue (au cours des 30 derniers jours)
Juan
Juan le 16 Mar 2018
Modifié(e) : Juan le 16 Mar 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;

Réponses (0)

Catégories

En savoir plus sur Elementary Math dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by