1 / 8

Множественный тип данных

Множественный тип данных. МОУ лицей №5, г. Воронеж Лопушанская Н.Д. Сформулируй задачу. type mn = set of 0..9 ; var vse : mn ; a , c : integer ; begin readln ( a ); vse :=[ ]; while a <> 0 do begin c := a mod 10; vse := vse +[ c ]; a := a div 10; end ; for c :=0 to 9 do

Download Presentation

Множественный тип данных

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Множественный тип данных МОУ лицей №5,г. ВоронежЛопушанская Н.Д.

  2. Сформулируй задачу typemn=set of 0..9; varvse:mn; a,c:integer; begin readln(a); vse:=[]; whilea<>0do begin c:=amod10; vse:= vse +[c]; a:=adiv 10; end; forc:=0 to 9 do ifcinvsethen writeln(c) end. Дано целое число. Вывести все различные цифры, входящие в его запись.

  3. Измените программу так, чтобы вывод содержал не только цифры, но и само исходное число typemn=set of 0..9; varvse:mn; a, c:integer; typemn=set of 0..9; varvse:mn; a, , c:integer; b beginreadln(a); vse:=[]; whilea<>0do begin c:=amod10; vse:= vse +[c]; a:=adiv 10; end; b:=a; Writeln (‘В число’, b, 'входят следующие цифры'); forc:=0 to 9 do ifcinvsethen writeln(c) end.

  4. Измените программу так, чтобы выводились цифры, входящие в запись числа >1 раза typemn=set of0..9; varvse, :mn; a, b, c:integer; typemn=set of0..9; varvse:mn; a, b, c:integer; mnogo begin readln(a); b:=a; vse:=[]; whilea<>0 do begin c:=amod 10; a:=adiv 10; end; forc:=0 to 9 do ifcinthenwriteln(c) end. mnogo:=[ ]; ifcinvsethenmnogo:=mnogo+[c]else vse:= vse +[c]; vse:=vse +[c]; writeln (‘В число’, b, более одного раза входят следующие цифры'); vse mnogo

  5. Добавьте вывод цифр встречающихся один раз typemn=setof0..9; varvse, mnogo, odin:mn; a, b, c:integer; begin readln(a); b:=a; vse:=[ ]; mnogo:=[ ]; whilea<>0 do begin c:=amod 10; ifcinvsethenmnogo:=mnogo+[c] elsevse:=vse +[c]; a:=adiv 10; end; writeln(‘В число’, b, ‘ один раз входят следующие цифры'); forc:=0 to 9 do ifcinodinthenwriteln(c) end. odin:=vse-mnogo;

  6. Решаем ребус МУХА МУХА Сколько решений? СЛОН

  7. [] С Л О Н , , , М У Х А [ ] , , , 4 * = [ ] 4 C Л О Н

  8. Домашнее задание – написать программу подсчета количества решений

More Related