diff --git a/lazarus/.gitignore b/lazarus/.gitignore index 0b6f40f..ed74c23 100644 --- a/lazarus/.gitignore +++ b/lazarus/.gitignore @@ -6,6 +6,8 @@ # lazarus auto-generated files */backup/* */lib/* +*/*/backup/* +*/*/lib/* # lazarus user config *.lps \ No newline at end of file diff --git a/lazarus/console/average/average.lpi b/lazarus/console/average/average.lpi new file mode 100644 index 0000000..12236c8 --- /dev/null +++ b/lazarus/console/average/average.lpi @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + </local> + </RunParams> + <Units Count="1"> + <Unit0> + <Filename Value="average.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="average"/> + </Target> + <SearchPaths> + <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/lazarus/console/average/average.lpr b/lazarus/console/average/average.lpr new file mode 100644 index 0000000..e496fd7 --- /dev/null +++ b/lazarus/console/average/average.lpr @@ -0,0 +1,27 @@ +program average; + +uses + SysUtils; + +var + i: integer; + h: array[0..9] of integer; + sum: integer; + avg: single; + s: string; + +begin + for i := 0 to 9 do begin + Writeln('Enter height ', i+1); + Readln(h[i]); + end; + + sum := 0; + for i := 0 to 9 do begin + sum := sum + h[i]; + end; + avg := sum / 10; + + Writeln('Average height is ', FloatToStr(avg)); + Readln(s); +end. diff --git a/lazarus/console/box-and-hole/boxandhole.lpi b/lazarus/console/box-and-hole/boxandhole.lpi new file mode 100644 index 0000000..2be0d35 --- /dev/null +++ b/lazarus/console/box-and-hole/boxandhole.lpi @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <General> + <Flags> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <UseDefaultCompilerOptions Value="True"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="boxandhole"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + </local> + </RunParams> + <Units Count="1"> + <Unit0> + <Filename Value="boxandhole.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="boxandhole"/> + </Target> + <SearchPaths> + <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/lazarus/console/box-and-hole/boxandhole.lpr b/lazarus/console/box-and-hole/boxandhole.lpr new file mode 100644 index 0000000..a24995f --- /dev/null +++ b/lazarus/console/box-and-hole/boxandhole.lpr @@ -0,0 +1,44 @@ +program boxandhole; + +var + a, b, c: integer; + x, y: integer; + pass: boolean; + s: string; + +begin + Writeln('Enter box size (a, b, c):'); + Readln(a); + Readln(b); + Readln(c); + + Writeln('Enter hole size (x, y):'); + Readln(x); + Readln(y); + + pass := false; + if (a < x) and (b < y) then pass := true; + if (b < x) and (c < y) then pass := true; + if (c < x) and (a < y) then pass := true; + + if (b < x) and (a < y) then pass := true; + if (c < x) and (b < y) then pass := true; + if (a < x) and (c < y) then pass := true; + + { or coding conditions in other way: + pass := ((a < x) and (b < y)) + or ((b < x) and (c < y)) + or ((c < x) and (a < y)) + or ((b < x) and (a < y)) + or ((c < x) and (b < y)) + or ((a < x) and (c < y)); + } + + if pass then begin + writeln('Will pass trought'); + end else begin + writeln('Box too large'); + end; + + readln(s); +end. diff --git a/lazarus/console/expressions/expressions.lpi b/lazarus/console/expressions/expressions.lpi new file mode 100644 index 0000000..fc5e722 --- /dev/null +++ b/lazarus/console/expressions/expressions.lpi @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <General> + <Flags> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <UseDefaultCompilerOptions Value="True"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="expressions"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + </local> + </RunParams> + <Units Count="1"> + <Unit0> + <Filename Value="expressions.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="expressions"/> + </Target> + <SearchPaths> + <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/lazarus/console/expressions/expressions.lpr b/lazarus/console/expressions/expressions.lpr new file mode 100644 index 0000000..90ca77b --- /dev/null +++ b/lazarus/console/expressions/expressions.lpr @@ -0,0 +1,37 @@ +program expressions; + +uses + SysUtils; + +var + s: string; + a, b, c: single; + result: single; + +begin + a := 10; + b := 15; + c := 20; + + result := (1/4)*sqrt((a+b+c)*(b+c-a)*(a+c-b)*(a+b-c)); + Writeln('Area of triangle with' + + ' sides ' + FloatToStr(a) + + ', ' + FloatToStr(b) + + ' and ' + FloatToStr(c) + + ' is ' + FloatToStr(result) ); + + result := (1/3)*pi*a*(b*b); + Writeln('Volume of cone with' + + ' height ' + FloatToStr(a) + + ' and radius ' + FloatToStr(b) + + ' is ' + FloatToStr(result) ); + + result := (4/3)*pi*a*b*c; + Writeln('Volume of ellipsoid with' + + ' radiuses ' + FloatToStr(a) + + ', ' + FloatToStr(b) + + ' and ' + FloatToStr(b) + + ' is ' + FloatToStr(result) ); + + Readln(s); +end. diff --git a/lazarus/console/hello-world/helloworld.lpi b/lazarus/console/hello-world/helloworld.lpi new file mode 100644 index 0000000..674a691 --- /dev/null +++ b/lazarus/console/hello-world/helloworld.lpi @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <General> + <Flags> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <UseDefaultCompilerOptions Value="True"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="helloworld"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + </local> + </RunParams> + <Units Count="1"> + <Unit0> + <Filename Value="helloworld.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="helloworld"/> + </Target> + <SearchPaths> + <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/lazarus/console/hello-world/helloworld.lpr b/lazarus/console/hello-world/helloworld.lpr new file mode 100644 index 0000000..32fd954 --- /dev/null +++ b/lazarus/console/hello-world/helloworld.lpr @@ -0,0 +1,8 @@ +program helloworld; + +var + s: string; +begin + Writeln('Hello world!'); + Readln(s); +end. diff --git a/lazarus/console/sum/sum.lpi b/lazarus/console/sum/sum.lpi new file mode 100644 index 0000000..a47c727 --- /dev/null +++ b/lazarus/console/sum/sum.lpi @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <General> + <Flags> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <UseDefaultCompilerOptions Value="True"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="sum"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication Use="True"/> + </local> + </RunParams> + <Units Count="1"> + <Unit0> + <Filename Value="sum.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="Project1"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="sum"/> + </Target> + <SearchPaths> + <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/lazarus/console/sum/sum.lpr b/lazarus/console/sum/sum.lpr new file mode 100644 index 0000000..e8500d0 --- /dev/null +++ b/lazarus/console/sum/sum.lpr @@ -0,0 +1,20 @@ +program Project1; + +var + a: integer; + b: integer; + c: integer; + s: string; + +begin + Writeln('Enter A:'); + Read(a); + Writeln('Enter B:'); + Read(b); + + c := a + b; + Writeln(a, '+', b, '=', c); + + Readln(s); + Readln(s); +end. diff --git a/lazarus/console/support/support.lpi b/lazarus/console/support/support.lpi new file mode 100644 index 0000000..fb362fe --- /dev/null +++ b/lazarus/console/support/support.lpi @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <General> + <Flags> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <UseDefaultCompilerOptions Value="True"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="support"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + </local> + </RunParams> + <Units Count="1"> + <Unit0> + <Filename Value="support.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="support"/> + </Target> + <SearchPaths> + <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/lazarus/console/support/support.lpr b/lazarus/console/support/support.lpr new file mode 100644 index 0000000..ff44d9d --- /dev/null +++ b/lazarus/console/support/support.lpr @@ -0,0 +1,48 @@ +program support; + +var + s: string; + +begin + Writeln('Have you any problem? (yes/no)'); + Readln(s); + while s = 'yes' do begin + Writeln('Have you a problem with electronic devices? (yes/no)'); + Readln(s); + if s = 'yes' then begin + Writeln('Have you a problem with TV? (yes/no)'); + Readln(s); + if s = 'yes' then begin + Writeln('You must to go to TV master'); + end else begin + Writeln('Have you a problem with computer? (yes/no)'); + Readln(s); + if s = 'yes' then begin + Writeln('You must go to sysadmin'); + end else begin + Writeln('I am sorry, I cannot help you.'); + end; + end; + end else begin + Writeln('Have you a problem with teapot? (yes/no)'); + Readln(s); + if s = 'yes' then begin + Writeln('Was you teapot broken? (yes/no)'); + Readln(s); + if s = 'yes' then begin + Writeln('You must buy our super glue'); + end else begin + Writeln('I am sorry, I cannot help you.'); + end; + end else begin + Writeln('I am sorry, I cannot help you.'); + end; + end; + + Writeln('Have you other problems? (yes/no)'); + Readln(s); + end; + + Writeln('Good bye'); + readln(s); +end. diff --git a/lazarus/console/talk/talk.lpi b/lazarus/console/talk/talk.lpi new file mode 100644 index 0000000..c777c55 --- /dev/null +++ b/lazarus/console/talk/talk.lpi @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="9"/> + <General> + <Flags> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <UseDefaultCompilerOptions Value="True"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="talk"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <i18n> + <EnableI18N LFM="False"/> + </i18n> + <VersionInfo> + <StringTable ProductVersion=""/> + </VersionInfo> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + </local> + </RunParams> + <Units Count="1"> + <Unit0> + <Filename Value="talk.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="talk"/> + </Target> + <SearchPaths> + <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/lazarus/console/talk/talk.lpr b/lazarus/console/talk/talk.lpr new file mode 100644 index 0000000..afea2db --- /dev/null +++ b/lazarus/console/talk/talk.lpr @@ -0,0 +1,20 @@ +program talk; + +var + name: string; + say: string; +begin + Writeln('Hello!'); + Readln(say); + + Writeln('What is your name?'); + Readln(name); + + Writeln('Nice to meet you ', name); + Writeln('How are you?'); + Readln(say); + + Writeln('Oh.. program ends'); + Writeln('Good bye ', name); + Readln(say); +end.