Filter löschen
Filter löschen

Question for Pascal users?

3 Ansichten (letzte 30 Tage)
Juan
Juan am 16 Mär. 2018
Bearbeitet: Juan am 16 Mär. 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;

Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by