Необходимо написать программу для вывода на печать 100 билетов с индивидуальными заданиями пример заданий
пример 1
пример2
файл примеров http://netsoftware.ucoz.ru/exemp.rar
для корректной работы нам будет нужен модуль построения формул в графическом виде для Delphi http://www.delphikingdom.com/asp/viewitem.asp?catalogid=718 автор Антон Григорьев
задача составления функций. таким образом анализируем файлы получаем что формула состоит из 4 частей условно разделим их F1+F2+F3+F4 знаки могут быть + - * /
таким образом перепишем формулу result:=Function1+Znak+Function2+znak+Function3+znak+Function4 где znak - процедура которая формирует знак случайным образом Function1 - принимает 1 из значений
опишем тип для хранения
Tformula=record s1:string; // основная формула s2:string; // вторая функция s3:string; // описание 1 переменной s4:string; // описание 2 переменной s5:string; // описание 3 переменной (группа значений) s6:string; // описание 4 переменно1 (группа значений) end;
напишем процедуру генерации формулы
Function GetZnak(s:integer):char; begin if s=0 then result:='+' else if s=1 then result:='-' else if s=2 then result:='*' else if s=3 then result:='/'; end;
Function GetFunction1(index:integer;f1,fx:char):string; begin if index=0 then result:=f1+'('+fx+')' else if index=1 then result:='sqrt('+f1+'('+fx+'))' else if index=2 then result:='sqrt('+f1+'('+fx+')'+')' else result:=F1+'(sqr('+fx+'))'; end;
Function GetFunction2(index:integer;f1,fy:char):string; begin
if index=0 then result:='Sqrt(cos('+fy+'))' else if index=1 then result:='sqr(ctg('+fy+'))' else if index=2 then result:='ctg('+fy+')' else if index=3 then result:='sin('+fy+')' else if index=4 then result:='sqr(tg('+fy+'))' else if index=5 then result:='cos('+fy+')' else if index=6 then result:='sqr(ctg('+fy+'))' else if index=7 then result:='Sin('+fy+')' else if index=8 then result:='sqr(ctg('+fy+'))' else if index=9 then result:='sqr(ctg('+fy+'))' else result:='sqr(ctg('+fy+'))'
end;
Function GetFunction3(index:integer;fz:char):string; begin if index=0 then result:='Ln('+fz+')' else if index=1 then result:='sqrt(Cos('+fz+'))' else if index=2 then result:='sqrt(ln('+fz+'))' else if index=3 then result:='sqrt(ctg('+fz+'))' else if index=4 then result:='sqrt(ln('+fz+'))' else if index=5 then result:='sin('+fz+')' else if index=6 then result:='tg('+fz+')' else result:='ctg('+fz+')' end;
Function GetFunction4(index:integer;fe:char):string; begin if index=0 then result:='e^cos('+fe+')' else if index=1 then result:='e^ctg('+fe+')' else if index=2 then result:='e^ctg('+fe+')' else if index=3 then result:='e^sin('+fe+')' else result:='e^tg('+fe+')'
end;
// таким образом получаем функцию для генерации формулы // Function GetVariantFunction:Tformula; label loop; var F1:char; // функция B(x)/A(x)/M(x) fx:char; fy:char; fz:char; FB:char; x,i:integer; begin loop:
F1:=chr(ord('A')+random(26)); Fy:=chr(ord('A')+random(26)); Fz:=chr(ord('A')+random(26)); FB:=chr(ord('A')+random(26)); if f1='F' then goto loop; fx:=chr(ord('A')+random(26)); if f1=fx then goto loop; if fx='F' then goto loop; if fy='F' then goto loop; if fz='F' then goto loop; if (fx=fy) or (fx=fz) or (fy=fz) then goto loop; if (f1=fy) or (fx=fy) then goto loop; if FB in [fx,fy,fz] then goto loop; result.s1:='f('+fx+','+fy+','+fz+')=('+GetFunction1(random(4),f1,fx)+GetZnak(random(1))+GetFunction2(random(4),f1,fy)+')'+GetZnak(random(4))+ '('+GetFunction3(random(7),fz)+GetZnak(random(2))+GetFunction4(random(4),fx)+')' +#13+#10;
result.s2:=F1+'('+fx+')='+Fb+'1'; i:=1+random(2); for x:=2 to 5 do result.s2:=result.s2+'+'+fb+inttostr(x)+'*'+fx+'^'+inttostr(x*i); result.s3:=''; for x:=1 to 5 do begin result.s3:=result.s3+Fb+inttostr(x)+'='+inttostr(0+random(1))+'.'+inttostr(random(10000))+' ,' end;
result.s4:=Fx+'='+inttostr(0+random(1))+'.'+inttostr(random(10000));
result.s5:=''; for x:=1 to 5 do begin result.s5:=result.s5+Fz+'='+inttostr(0+random(1))+'.'+inttostr(random(10000))+' ,' end; result.s6:=''; for x:=1 to 5 do begin result.s6:=result.s6+Fy+'='+inttostr(0+random(1))+'.'+inttostr(random(10000))+' ,' end; end;
полный текст модуля можно скачать по ссылке http://netsoftware.ucoz.ru/25_generator_formul.zip
|