The task: calculate and print the positive elements that stand in even places C (8) = (-6.3; -1.0; 10.3; -8.8; 6.3; -1.1; 0.0; 0.1) Here is my code:
program laba7_3; const n=5; var m:array[1..n] of integer; k,i,j:integer; Begin writeln('Vvedit massiv'); for i:=1 to n do read(m[i]); for i:=1 to n-1 do for j:=i+1 to n do if (m[j]>m[i]) then begin k:=m[i]; m[i]:=m[j]; m[j]:=k; end; writeln('vidsort mas'); for i:=1 to n do writeln(m[i],' '); readln(m[i]); end.
But here's the error: Runtime Error: The input string had the wrong format. on the line read (m [i]);
3,2
does not parse inInteger
. True, it doesn’t takedouble
indouble
because a comma. - VladD