I try to convert pascal to c++ and i have some mistakes in c++ code [on hold]
var
a:array[1..100]of integer;
n,i,k:integer;
begin
k:=0;
read l(n);
for i:=1 to n do
read(a[i]);
for i:=2 to n-1 do
if (a[i]>a[i-1]) and (a[i]>a[i+1]) then
inc(k);
writel(k);
end.
Aucun commentaire:
Enregistrer un commentaire