meteor90
?>

перевести с паскаля на с++!! const n = 50; type a = array [1..n] of integer; var mas, c: a; i, j, m, x: integer; begin writeln('введите число элементов массива:'); readln(m); writeln('введите элементы массива mas:'); for i := 1 to m do readln(mas[i]); writeln('полученный массив'); for i := 1 to m do write(mas[i]:4); writeln; for i := 1 to m do begin c[i] := mas[i]; while c[i] >= 10 do c[i] := c[i] div 10; end; for i := 2 to m do for j := m downto i do if c[j - 1] > c[j] then begin x := c[j - 1]; c[j - 1] := c[j]; c[j] := x; x := mas[j - 1]; mas[j - 1] := mas[j]; mas[j] := x; end; writeln('преобразованный массив:'); for i := 1 to m do write(mas[i]:4); writeln; end.

Информатика

Ответы

Роман
Var so,sr,c:string;
t,k:integer;
begin;
readln(so);
t:=0;
for i:=1 to length(so) do
sr:=sr+'*';
while t<>6 do
begin;
readln(c);
if length(c)<>1 then
 begin;
  writeln('Только одна буква!');
  continue;
 end;
if pos(c,so)<>0 then
 begin;
 for i:=1 to length(so) do
   if so[i]=c then
   begin;
     delete(sr,i,1);
     insert(c,sr,i);
   end;
 writeln(sr);
 writeln('Осталось ',6-t,' попыток');
 end
 else
 begin;
 writeln(sr);
 inc(t);
 writeln('Осталось ',6-t,' попыток');
 end;
 if so=sr then break;
end;
if so=sr then writeln('Вы выиграли') else writeln('Вы проиграли');
end.
iraimironova
Var so,sr,c:string;
t,k:integer;
begin;
readln(so);
t:=0;
for i:=1 to length(so) do
sr:=sr+'*';
while t<>6 do
begin;
readln(c);
if length(c)<>1 then
 begin;
  writeln('Только одна буква!');
  continue;
 end;
if pos(c,so)<>0 then
 begin;
 for i:=1 to length(so) do
   if so[i]=c then
   begin;
     delete(sr,i,1);
     insert(c,sr,i);
   end;
 writeln(sr);
 writeln('Осталось ',6-t,' попыток');
 end
 else
 begin;
 writeln(sr);
 inc(t);
 writeln('Осталось ',6-t,' попыток');
 end;
 if so=sr then break;
end;
if so=sr then writeln('Вы выиграли') else writeln('Вы проиграли');
end.

Ответить на вопрос

Поделитесь своими знаниями, ответьте на вопрос:

перевести с паскаля на с++!! const n = 50; type a = array [1..n] of integer; var mas, c: a; i, j, m, x: integer; begin writeln('введите число элементов массива:'); readln(m); writeln('введите элементы массива mas:'); for i := 1 to m do readln(mas[i]); writeln('полученный массив'); for i := 1 to m do write(mas[i]:4); writeln; for i := 1 to m do begin c[i] := mas[i]; while c[i] >= 10 do c[i] := c[i] div 10; end; for i := 2 to m do for j := m downto i do if c[j - 1] > c[j] then begin x := c[j - 1]; c[j - 1] := c[j]; c[j] := x; x := mas[j - 1]; mas[j - 1] := mas[j]; mas[j] := x; end; writeln('преобразованный массив:'); for i := 1 to m do write(mas[i]:4); writeln; end.
Ваше имя (никнейм)*
Email*
Комментарий*

Популярные вопросы в разделе

md-masya
klepa-79
Татьяна_Вологжин
Vik1744184
Kalmikova1666
knyazev527
Мария591
nsh25044
officem695
Андреевна-Арзуманян1109
Вайнер
igortychinin
levickaalubov5
strager338
katushak29