c-exercises 0.0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,30 @@
1
+ # Środowisko Programisty
2
+
3
+ Gem zawierający zadania do wykładu „Języki Programowania”.
4
+
5
+
6
+ ## Instalacja
7
+
8
+ Wykonać polecenie:
9
+
10
+ gem install c-exercises
11
+
12
+
13
+ ## Uruchamianie
14
+
15
+ Sprawdzamy gdzie w systemie został zainstalowany gem *c-exercises*:
16
+
17
+ gem which c-exercises
18
+
19
+ Aplikację uruchamiamy w taki sposób:
20
+
21
+ <pre>rackup /«<i>ścieżka do katalogu z gemem</i>»/lib/config.ru -p «<i>numer portu</i>»
22
+ </pre>
23
+
24
+ Na przykład:
25
+
26
+ rackup rackup /usr/lib/ruby/gems/1.8/gems/c-exercises-0.0.0.0/lib/config.ru -p 8098
27
+
28
+ Po uruchomieniu aplikacja jest dostępna z URL:
29
+
30
+ http://localhost:8098/
@@ -0,0 +1,33 @@
1
+ require 'rake'
2
+
3
+ $LOAD_PATH.unshift('lib')
4
+
5
+ begin
6
+ require 'jeweler'
7
+ Jeweler::Tasks.new do |gemspec|
8
+ gemspec.name = "c-exercises"
9
+ gemspec.summary = "Zadania do wykladu Jezyki Programowania."
10
+ gemspec.email = "matwb@ug.edu.pl"
11
+ gemspec.authors = ["Wlodek Bzyl"]
12
+ gemspec.homepage = "http://github.com/wbzyl/c-exercises"
13
+
14
+ gemspec.description = <<-EOF
15
+ Zadania do wykladu Jezyki Programowania
16
+ EOF
17
+
18
+ gemspec.files = FileList['lib/**/*', "Rakefile", "VERSION.yml"]
19
+
20
+ gemspec.add_runtime_dependency 'rack'
21
+ gemspec.add_runtime_dependency 'sinatra'
22
+ gemspec.add_runtime_dependency 'rdiscount'
23
+ gemspec.add_runtime_dependency 'ultraviolet'
24
+ gemspec.add_runtime_dependency 'rack-codehighlighter'
25
+ gemspec.add_runtime_dependency 'sinatra-rdiscount'
26
+ gemspec.add_runtime_dependency 'sinatra-static-assets'
27
+ end
28
+ Jeweler::GemcutterTasks.new
29
+ rescue LoadError
30
+ puts "Jeweler not available."
31
+ puts "Install it with:"
32
+ puts " sudo gem install jeweler"
33
+ end
@@ -0,0 +1,5 @@
1
+ ---
2
+ :major: 0
3
+ :minor: 0
4
+ :patch: 1
5
+ :build: 0
@@ -0,0 +1,77 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ # Zobacz przykład: http://gist.github.com/38605
4
+
5
+ #gem 'rdiscount'
6
+ #gem 'sinatra'
7
+ #gem 'sinatra-rdiscount'
8
+ #gem 'emk-sinatra-url-for'
9
+ #gem 'sinatra-static-assets'
10
+
11
+ require 'rdiscount'
12
+ require 'sinatra/base'
13
+ require 'sinatra/rdiscount'
14
+
15
+ require 'sinatra/url_for'
16
+ require 'sinatra/static_assets'
17
+
18
+ module WB
19
+ class CExercises < Sinatra::Base
20
+ helpers Sinatra::UrlForHelper
21
+ register Sinatra::StaticAssets
22
+
23
+ # disable overriding public and views dirs
24
+ set :app_file, __FILE__
25
+ set :static, true
26
+
27
+ # the middleware stack can be used internally as well. I'm using it for
28
+ # sessions, logging, and methodoverride. This lets us move stuff out of
29
+ # Sinatra if it's better handled by a middleware component.
30
+ set :logging, true # use Rack::CommonLogger
31
+
32
+ helpers Sinatra::RDiscount
33
+
34
+ # configure blocks:
35
+ # configure :production do
36
+ # end
37
+
38
+ #before do
39
+ # mime :sql, 'text/plain; charset="UTF-8"' # when served by Sinatra itself
40
+ #end
41
+
42
+ # helper methods
43
+ #attr_reader :title
44
+
45
+ def page_title
46
+ @title || ""
47
+ end
48
+
49
+ # def title=(name)... does not work, bug?
50
+ def title(name)
51
+ @title = " | #{name}"
52
+ end
53
+
54
+ get '/' do
55
+ rdiscount :main
56
+ end
57
+
58
+ get '/:section' do
59
+ rdiscount :"#{params[:section]}"
60
+ end
61
+
62
+ # does not work with sub-uri; bug?
63
+ # get '/labs/:section' do
64
+ # rdiscount "labs/#{params[:section]}".to_sym
65
+ # end
66
+
67
+ error do
68
+ e = request.env['sinatra.error']
69
+ Kernel.puts e.backtrace.join("\n")
70
+ 'Application error'
71
+ end
72
+
73
+ # each Sinatra::Base subclass has its own private middleware stack:
74
+ # use Rack::Lint
75
+ end
76
+ end
77
+
@@ -0,0 +1,15 @@
1
+ require 'c-exercises'
2
+
3
+ gem 'rack-codehighlighter'
4
+ require 'rack/codehighlighter'
5
+
6
+ gem 'ultraviolet'
7
+ require 'uv'
8
+
9
+ use Rack::ShowExceptions
10
+ use Rack::Lint
11
+
12
+ use Rack::Codehighlighter, :ultraviolet, :markdown => true,
13
+ :element => "pre>code", :pattern => /\A:::([-\w]+)\s*\n/
14
+
15
+ run WB::CExercises.new
@@ -0,0 +1 @@
1
+ /* ruby3.js */
@@ -0,0 +1,196 @@
1
+ /* font-face fonts works with Firefox and Opera */
2
+
3
+ @font-face {
4
+ font-family: "Cyklop";
5
+ src: url(fonts/Cyklop-Regular.otf) format("opentype");
6
+ font-weight: normal;
7
+ }
8
+
9
+ @font-face {
10
+ font-family: "Cyklop";
11
+ src: url(fonts/Cyklop-Italic.otf) format("opentype");
12
+ font-style: italic;
13
+ }
14
+
15
+ #logo {
16
+ font: italic 256%/1 "Cyklop", "DejaVu Sans", sans-serif;
17
+ margin-bottom: 24px;
18
+ }
19
+
20
+ #logo a {
21
+ text-decoration: none;
22
+ color: #5A0405;
23
+ }
24
+
25
+ #logo a:focus, #logo a:hover {
26
+ color: #321494;
27
+ }
28
+
29
+ #logo span {
30
+ margin-left: 1em;
31
+ color: #B019BD;
32
+ }
33
+
34
+ /* hack for RDiscount comments */
35
+
36
+ h4 {
37
+ display: none;
38
+ }
39
+
40
+ html {
41
+ /* http://www.hicksdesign.co.uk/journal/forcing-scrollbars-now-even-better */
42
+ height: 100%;
43
+ margin-bottom: 1px;
44
+
45
+ background-color: #E3E6F7;
46
+ margin: 24px auto 24px 44px;
47
+ }
48
+
49
+ body {
50
+ font-family: "DejaVu Sans", "Trebuchet MS", sans-serif ;
51
+ line-height: 28px;
52
+ width: 869px;
53
+ }
54
+
55
+ #header {
56
+ padding-top: 24px;
57
+ padding-bottom: 0px;
58
+ background-color: #F07818;
59
+ /* border: solid #888; */
60
+ /* border-width: 1px 1px 0px 1px; */
61
+ }
62
+
63
+ #links {
64
+ float: right;
65
+ }
66
+
67
+ #links a {
68
+ text-decoration: none;
69
+ color: #A00;
70
+ }
71
+
72
+ .container {
73
+ /* border: 1px solid #888; */
74
+ background-color: #FEF9F0;
75
+ }
76
+
77
+ a[href^="http:"], a[href^="mailto:"], a[href^="http:"]:visited,
78
+ a[href$=".pdf"], a[href$=".doc"], a[href$=".xls"], a[href$=".rss"],
79
+ a[href$=".rdf"], a[href^="aim:"] {
80
+ padding:2px 16px 2px 0;
81
+ }
82
+
83
+ h1 {
84
+ font-size: 160%;
85
+ font-family: "Cyklop", "DejaVu Sans", serif;
86
+ font-style: italic;
87
+ font-weight: normal;
88
+ color: #D80000;
89
+ padding-top: 16px;
90
+ padding-bottom: 16px;
91
+ background-color: #F0D800;
92
+ width: 869px;
93
+ margin-left: -44px;
94
+ padding-left: 44px;
95
+ }
96
+
97
+ blockquote {
98
+ font: normal 14/1.5 "DejaVu Sans", sans-serif;
99
+ width: 297px;
100
+ margin-top: 6px;
101
+ margin-left: 528px;
102
+ padding: 18px 22px 18px 22px;
103
+ position: absolute;
104
+ background: #99ff99;
105
+ -moz-border-radius: 4px;
106
+ color: #800;
107
+ }
108
+
109
+ blockquote img {
110
+ margin: 0 auto 12px auto;
111
+ display: block;
112
+ }
113
+
114
+ blockquote p.author {
115
+ margin-top: -1em;
116
+ padding-right: 44px;
117
+ color: #800;
118
+ font-style: italic;
119
+ text-align: right;
120
+ }
121
+
122
+ h2 {
123
+ font-size: 140%;
124
+ padding-bottom: 6px;
125
+ border-bottom: 2px dotted #D80000;
126
+ color: #D80000;
127
+ }
128
+
129
+ h3 {
130
+ font-size: 120%;
131
+ color: #D80000;
132
+ }
133
+
134
+ pre.dawn {
135
+ margin-left: -50px;
136
+ padding: 8px 0 8px 39px;
137
+ border-left: 11px solid rgb(237,0,86);
138
+ }
139
+
140
+ pre code, li pre {
141
+ margin: 0;
142
+ padding: 0;
143
+ border: none;
144
+ }
145
+
146
+ code {
147
+ margin: 0 2px;
148
+ padding: 0.06em 0.125em;
149
+ border: 1px solid #403B33;
150
+ }
151
+
152
+ caption {
153
+ text-align: right;
154
+ }
155
+
156
+ pre, code {
157
+ font-family: "DejaVu Sans Mono", PakTypeNaqsh, monospace;
158
+ }
159
+
160
+ /* tabele */
161
+
162
+ thead th {
163
+ background-color: #ADD8C7;
164
+ }
165
+ li ul {
166
+ margin-bottom: 1.5em;
167
+ }
168
+
169
+ .table1 {
170
+ background-color: #EB7C7C;
171
+ }
172
+
173
+ .table2 {
174
+ background-color: #ECB39F;
175
+ }
176
+
177
+ /* różne */
178
+
179
+ .center {
180
+ text-align: center;
181
+ }
182
+
183
+ blockquote h1 {
184
+ font-weight: bold;
185
+ font-size: 100%;
186
+ font-family: "DejaVu Sans", "PakTypeNaqsh", serif;
187
+ color: #D80000;
188
+ padding-top: 16px;
189
+ padding-bottom: 16px;
190
+ background-color: #00A800;
191
+ color: white;
192
+ width: 100%;
193
+ margin-left: -22px;
194
+ margin-top: -18px;
195
+ -moz-border-radius: 4px;
196
+ }
@@ -0,0 +1,27 @@
1
+ /* -----------------------------------------------------------------------
2
+
3
+
4
+ Blueprint CSS Framework 0.8
5
+ http://blueprintcss.org
6
+
7
+ * Copyright (c) 2007-Present. See LICENSE for more info.
8
+ * See README for instructions on how to use Blueprint.
9
+ * For credits and origins, see AUTHORS.
10
+ * This is a compressed file. See the sources in the 'src' directory.
11
+
12
+ ----------------------------------------------------------------------- */
13
+
14
+ /* ie.css */
15
+ body {text-align:center;}
16
+ .container {text-align:left;}
17
+ * html .column, * html div.span-1, * html div.span-2, * html div.span-3, * html div.span-4, * html div.span-5, * html div.span-6, * html div.span-7, * html div.span-8, * html div.span-9, * html div.span-10, * html div.span-11, * html div.span-12, * html div.span-13, * html div.span-14, * html div.span-15, * html div.span-16, * html div.span-17, * html div.span-18, * html div.span-19, * html div.span-20, * html div.span-21, * html div.span-22, * html div.span-23, * html div.span-24 {overflow-x:hidden;}
18
+ * html legend {margin:0px -8px 16px 0;padding:0;}
19
+ ol {margin-left:2em;}
20
+ sup {vertical-align:text-top;}
21
+ sub {vertical-align:text-bottom;}
22
+ html>body p code {*white-space:normal;}
23
+ hr {margin:-8px auto 11px;}
24
+ img {-ms-interpolation-mode:bicubic;}
25
+ .clearfix, .container {display:inline-block;}
26
+ * html .clearfix, * html .container {height:1%;}
27
+ fieldset {padding-top:0;}
@@ -0,0 +1,30 @@
1
+ /* -----------------------------------------------------------------------
2
+
3
+
4
+ Blueprint CSS Framework 0.8
5
+ http://blueprintcss.org
6
+
7
+ * Copyright (c) 2007-Present. See LICENSE for more info.
8
+ * See README for instructions on how to use Blueprint.
9
+ * For credits and origins, see AUTHORS.
10
+ * This is a compressed file. See the sources in the 'src' directory.
11
+
12
+ ----------------------------------------------------------------------- */
13
+
14
+ /* print.css */
15
+ body {line-height:1.5;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;color:#000;background:none;font-size:10pt;}
16
+ .container {background:none;}
17
+ hr {background:#ccc;color:#ccc;width:100%;height:2px;margin:2em 0;padding:0;border:none;}
18
+ hr.space {background:#fff;color:#fff;}
19
+ h1, h2, h3, h4, h5, h6 {font-family:"Helvetica Neue", Arial, "Lucida Grande", sans-serif;}
20
+ code {font:.9em "Courier New", Monaco, Courier, monospace;}
21
+ img {float:left;margin:1.5em 1.5em 1.5em 0;}
22
+ a img {border:none;}
23
+ p img.top {margin-top:0;}
24
+ blockquote {margin:1.5em;padding:1em;font-style:italic;font-size:.9em;}
25
+ .small {font-size:.9em;}
26
+ .large {font-size:1.1em;}
27
+ .quiet {color:#999;}
28
+ .hide {display:none;}
29
+ a:link, a:visited {background:transparent;font-weight:700;text-decoration:underline;}
30
+ a:link:after, a:visited:after {content:" (" attr(href) ")";font-size:90%;}
@@ -0,0 +1,249 @@
1
+ /* -----------------------------------------------------------------------
2
+
3
+
4
+ Blueprint CSS Framework 0.8
5
+ http://blueprintcss.org
6
+
7
+ * Copyright (c) 2007-Present. See LICENSE for more info.
8
+ * See README for instructions on how to use Blueprint.
9
+ * For credits and origins, see AUTHORS.
10
+ * This is a compressed file. See the sources in the 'src' directory.
11
+
12
+ ----------------------------------------------------------------------- */
13
+
14
+ /* reset.css */
15
+ html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td {margin:0;padding:0;border:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline;}
16
+ body {line-height:1.5;}
17
+ table {border-collapse:separate;border-spacing:0;}
18
+ caption, th, td {text-align:left;font-weight:normal;}
19
+ table, td, th {vertical-align:middle;}
20
+ blockquote:before, blockquote:after, q:before, q:after {content:"";}
21
+ blockquote, q {quotes:"" "";}
22
+ a img {border:none;}
23
+
24
+ /* typography.css */
25
+ body {font-size:75%;color:#222;background:#fff;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;}
26
+ h1, h2, h3, h4, h5, h6 {font-weight:normal;color:#111;}
27
+ h1 {font-size:3em;line-height:1;margin-bottom:0.5em;}
28
+ h2 {font-size:2em;margin-bottom:0.75em;}
29
+ h3 {font-size:1.5em;line-height:1;margin-bottom:1em;}
30
+ h4 {font-size:1.2em;line-height:1.25;margin-bottom:1.25em;}
31
+ h5 {font-size:1em;font-weight:bold;margin-bottom:1.5em;}
32
+ h6 {font-size:1em;font-weight:bold;}
33
+ h1 img, h2 img, h3 img, h4 img, h5 img, h6 img {margin:0;}
34
+ p {margin:0 0 1.5em;}
35
+ p img.left {float:left;margin:1.5em 1.5em 1.5em 0;padding:0;}
36
+ p img.right {float:right;margin:1.5em 0 1.5em 1.5em;}
37
+ a:focus, a:hover {color:#000;}
38
+ a {color:#009;text-decoration:underline;}
39
+ blockquote {margin:1.5em;color:#666;font-style:italic;}
40
+ strong {font-weight:bold;}
41
+ em, dfn {font-style:italic;}
42
+ dfn {font-weight:bold;}
43
+ sup, sub {line-height:0;}
44
+ abbr, acronym {border-bottom:1px dotted #666;}
45
+ address {margin:0 0 1.5em;font-style:italic;}
46
+ del {color:#666;}
47
+ pre {margin:1.5em 0;white-space:pre;}
48
+ pre, code, tt {font:1em 'andale mono', 'lucida console', monospace;line-height:1.5;}
49
+ li ul, li ol {margin:0 1.5em;}
50
+ ul, ol {margin:0 1.5em 1.5em 1.5em;}
51
+ ul {list-style-type:disc;}
52
+ ol {list-style-type:decimal;}
53
+ dl {margin:0 0 1.5em 0;}
54
+ dl dt {font-weight:bold;}
55
+ dd {margin-left:1.5em;}
56
+ table {margin-bottom:1.4em;width:100%;}
57
+ th {font-weight:bold;}
58
+ thead th {background:#c3d9ff;}
59
+ th, td, caption {padding:4px 10px 4px 5px;}
60
+ tr.even td {background:#e5ecf9;}
61
+ tfoot {font-style:italic;}
62
+ caption {background:#eee;}
63
+ .small {font-size:.8em;margin-bottom:1.875em;line-height:1.875em;}
64
+ .large {font-size:1.2em;line-height:2.5em;margin-bottom:1.25em;}
65
+ .hide {display:none;}
66
+ .quiet {color:#666;}
67
+ .loud {color:#000;}
68
+ .highlight {background:#ff0;}
69
+ .added {background:#060;color:#fff;}
70
+ .removed {background:#900;color:#fff;}
71
+ .first {margin-left:0;padding-left:0;}
72
+ .last {margin-right:0;padding-right:0;}
73
+ .top {margin-top:0;padding-top:0;}
74
+ .bottom {margin-bottom:0;padding-bottom:0;}
75
+
76
+ /* forms.css */
77
+ label {font-weight:bold;}
78
+ fieldset {padding:1.4em;margin:0 0 1.5em 0;border:1px solid #ccc;}
79
+ legend {font-weight:bold;font-size:1.2em;}
80
+ input.text, input.title, textarea, select {margin:0.5em 0;border:1px solid #bbb;}
81
+ input.text:focus, input.title:focus, textarea:focus, select:focus {border:1px solid #666;}
82
+ input.text, input.title {width:300px;padding:5px;}
83
+ input.title {font-size:1.5em;}
84
+ textarea {width:390px;height:250px;padding:5px;}
85
+ .error, .notice, .success {padding:.8em;margin-bottom:1em;border:2px solid #ddd;}
86
+ .error {background:#FBE3E4;color:#8a1f11;border-color:#FBC2C4;}
87
+ .notice {background:#FFF6BF;color:#514721;border-color:#FFD324;}
88
+ .success {background:#E6EFC2;color:#264409;border-color:#C6D880;}
89
+ .error a {color:#8a1f11;}
90
+ .notice a {color:#514721;}
91
+ .success a {color:#264409;}
92
+
93
+ /* grid.css */
94
+ .container {width:913px;margin:0 auto;}
95
+ .showgrid {background:url(src/grid.png);}
96
+ .column, div.span-1, div.span-2, div.span-3, div.span-4, div.span-5, div.span-6, div.span-7, div.span-8, div.span-9, div.span-10, div.span-11, div.span-12, div.span-13, div.span-14, div.span-15, div.span-16, div.span-17, div.span-18, div.span-19, div.span-20, div.span-21 {float:left;margin-right:11px;}
97
+ .last, div.last {margin-right:0;}
98
+ .span-1 {width:33px;}
99
+ .span-2 {width:77px;}
100
+ .span-3 {width:121px;}
101
+ .span-4 {width:165px;}
102
+ .span-5 {width:209px;}
103
+ .span-6 {width:253px;}
104
+ .span-7 {width:297px;}
105
+ .span-8 {width:341px;}
106
+ .span-9 {width:385px;}
107
+ .span-10 {width:429px;}
108
+ .span-11 {width:473px;}
109
+ .span-12 {width:517px;}
110
+ .span-13 {width:561px;}
111
+ .span-14 {width:605px;}
112
+ .span-15 {width:649px;}
113
+ .span-16 {width:693px;}
114
+ .span-17 {width:737px;}
115
+ .span-18 {width:781px;}
116
+ .span-19 {width:825px;}
117
+ .span-20 {width:869px;}
118
+ .span-21, div.span-21 {width:913px;margin:0;}
119
+ input.span-1, textarea.span-1, input.span-2, textarea.span-2, input.span-3, textarea.span-3, input.span-4, textarea.span-4, input.span-5, textarea.span-5, input.span-6, textarea.span-6, input.span-7, textarea.span-7, input.span-8, textarea.span-8, input.span-9, textarea.span-9, input.span-10, textarea.span-10, input.span-11, textarea.span-11, input.span-12, textarea.span-12, input.span-13, textarea.span-13, input.span-14, textarea.span-14, input.span-15, textarea.span-15, input.span-16, textarea.span-16, input.span-17, textarea.span-17, input.span-18, textarea.span-18, input.span-19, textarea.span-19, input.span-20, textarea.span-20, input.span-21, textarea.span-21 {border-left-width:1px!important;border-right-width:1px!important;padding-left:5px!important;padding-right:5px!important;}
120
+ input.span-1, textarea.span-1 {width:21px!important;}
121
+ input.span-2, textarea.span-2 {width:65px!important;}
122
+ input.span-3, textarea.span-3 {width:109px!important;}
123
+ input.span-4, textarea.span-4 {width:153px!important;}
124
+ input.span-5, textarea.span-5 {width:197px!important;}
125
+ input.span-6, textarea.span-6 {width:241px!important;}
126
+ input.span-7, textarea.span-7 {width:285px!important;}
127
+ input.span-8, textarea.span-8 {width:329px!important;}
128
+ input.span-9, textarea.span-9 {width:373px!important;}
129
+ input.span-10, textarea.span-10 {width:417px!important;}
130
+ input.span-11, textarea.span-11 {width:461px!important;}
131
+ input.span-12, textarea.span-12 {width:505px!important;}
132
+ input.span-13, textarea.span-13 {width:549px!important;}
133
+ input.span-14, textarea.span-14 {width:593px!important;}
134
+ input.span-15, textarea.span-15 {width:637px!important;}
135
+ input.span-16, textarea.span-16 {width:681px!important;}
136
+ input.span-17, textarea.span-17 {width:725px!important;}
137
+ input.span-18, textarea.span-18 {width:769px!important;}
138
+ input.span-19, textarea.span-19 {width:813px!important;}
139
+ input.span-20, textarea.span-20 {width:857px!important;}
140
+ input.span-21, textarea.span-21 {width:901px!important;}
141
+ .append-1 {padding-right:44px;}
142
+ .append-2 {padding-right:88px;}
143
+ .append-3 {padding-right:132px;}
144
+ .append-4 {padding-right:176px;}
145
+ .append-5 {padding-right:220px;}
146
+ .append-6 {padding-right:264px;}
147
+ .append-7 {padding-right:308px;}
148
+ .append-8 {padding-right:352px;}
149
+ .append-9 {padding-right:396px;}
150
+ .append-10 {padding-right:440px;}
151
+ .append-11 {padding-right:484px;}
152
+ .append-12 {padding-right:528px;}
153
+ .append-13 {padding-right:572px;}
154
+ .append-14 {padding-right:616px;}
155
+ .append-15 {padding-right:660px;}
156
+ .append-16 {padding-right:704px;}
157
+ .append-17 {padding-right:748px;}
158
+ .append-18 {padding-right:792px;}
159
+ .append-19 {padding-right:836px;}
160
+ .append-20 {padding-right:880px;}
161
+ .prepend-1 {padding-left:44px;}
162
+ .prepend-2 {padding-left:88px;}
163
+ .prepend-3 {padding-left:132px;}
164
+ .prepend-4 {padding-left:176px;}
165
+ .prepend-5 {padding-left:220px;}
166
+ .prepend-6 {padding-left:264px;}
167
+ .prepend-7 {padding-left:308px;}
168
+ .prepend-8 {padding-left:352px;}
169
+ .prepend-9 {padding-left:396px;}
170
+ .prepend-10 {padding-left:440px;}
171
+ .prepend-11 {padding-left:484px;}
172
+ .prepend-12 {padding-left:528px;}
173
+ .prepend-13 {padding-left:572px;}
174
+ .prepend-14 {padding-left:616px;}
175
+ .prepend-15 {padding-left:660px;}
176
+ .prepend-16 {padding-left:704px;}
177
+ .prepend-17 {padding-left:748px;}
178
+ .prepend-18 {padding-left:792px;}
179
+ .prepend-19 {padding-left:836px;}
180
+ .prepend-20 {padding-left:880px;}
181
+ div.border {padding-right:4px;margin-right:5px;border-right:1px solid #eee;}
182
+ div.colborder {padding-right:27px;margin-right:27px;border-right:1px solid #eee;}
183
+ .pull-1 {margin-left:-44px;}
184
+ .pull-2 {margin-left:-88px;}
185
+ .pull-3 {margin-left:-132px;}
186
+ .pull-4 {margin-left:-176px;}
187
+ .pull-5 {margin-left:-220px;}
188
+ .pull-6 {margin-left:-264px;}
189
+ .pull-7 {margin-left:-308px;}
190
+ .pull-8 {margin-left:-352px;}
191
+ .pull-9 {margin-left:-396px;}
192
+ .pull-10 {margin-left:-440px;}
193
+ .pull-11 {margin-left:-484px;}
194
+ .pull-12 {margin-left:-528px;}
195
+ .pull-13 {margin-left:-572px;}
196
+ .pull-14 {margin-left:-616px;}
197
+ .pull-15 {margin-left:-660px;}
198
+ .pull-16 {margin-left:-704px;}
199
+ .pull-17 {margin-left:-748px;}
200
+ .pull-18 {margin-left:-792px;}
201
+ .pull-19 {margin-left:-836px;}
202
+ .pull-20 {margin-left:-880px;}
203
+ .pull-21 {margin-left:-924px;}
204
+ .pull-1, .pull-2, .pull-3, .pull-4, .pull-5, .pull-6, .pull-7, .pull-8, .pull-9, .pull-10, .pull-11, .pull-12, .pull-13, .pull-14, .pull-15, .pull-16, .pull-17, .pull-18, .pull-19, .pull-20, .pull-21 {float:left;position:relative;}
205
+ .push-1 {margin:0 -44px 1.5em 44px;}
206
+ .push-2 {margin:0 -88px 1.5em 88px;}
207
+ .push-3 {margin:0 -132px 1.5em 132px;}
208
+ .push-4 {margin:0 -176px 1.5em 176px;}
209
+ .push-5 {margin:0 -220px 1.5em 220px;}
210
+ .push-6 {margin:0 -264px 1.5em 264px;}
211
+ .push-7 {margin:0 -308px 1.5em 308px;}
212
+ .push-8 {margin:0 -352px 1.5em 352px;}
213
+ .push-9 {margin:0 -396px 1.5em 396px;}
214
+ .push-10 {margin:0 -440px 1.5em 440px;}
215
+ .push-11 {margin:0 -484px 1.5em 484px;}
216
+ .push-12 {margin:0 -528px 1.5em 528px;}
217
+ .push-13 {margin:0 -572px 1.5em 572px;}
218
+ .push-14 {margin:0 -616px 1.5em 616px;}
219
+ .push-15 {margin:0 -660px 1.5em 660px;}
220
+ .push-16 {margin:0 -704px 1.5em 704px;}
221
+ .push-17 {margin:0 -748px 1.5em 748px;}
222
+ .push-18 {margin:0 -792px 1.5em 792px;}
223
+ .push-19 {margin:0 -836px 1.5em 836px;}
224
+ .push-20 {margin:0 -880px 1.5em 880px;}
225
+ .push-21 {margin:0 -924px 1.5em 924px;}
226
+ .push-1, .push-2, .push-3, .push-4, .push-5, .push-6, .push-7, .push-8, .push-9, .push-10, .push-11, .push-12, .push-13, .push-14, .push-15, .push-16, .push-17, .push-18, .push-19, .push-20, .push-21 {float:right;position:relative;}
227
+ .prepend-top {margin-top:1.5em;}
228
+ .append-bottom {margin-bottom:1.5em;}
229
+ .box {padding:1.5em;margin-bottom:1.5em;background:#E5ECF9;}
230
+ hr {background:#ddd;color:#ddd;clear:both;float:none;width:100%;height:.1em;margin:0 0 1.45em;border:none;}
231
+ hr.space {background:#fff;color:#fff;}
232
+ .clearfix:after, .container:after {content:"\0020";display:block;height:0;clear:both;visibility:hidden;overflow:hidden;}
233
+ .clearfix, .container {display:block;}
234
+ .clear {clear:both;}
235
+
236
+ /* link-icons */
237
+ body a.noicon {background:transparent none !important;padding:0 !important;margin:0 !important;}
238
+ a[href^="http:"], a[href^="mailto:"], a[href^="http:"]:visited, a[href$=".pdf"], a[href$=".doc"], a[href$=".xls"], a[href$=".rss"], a[href$=".rdf"], a[href^="aim:"] {padding:2px 22px 2px 0;margin:-2px 0;background-repeat:no-repeat;background-position:right center;}
239
+ a[href^="http:"] {background-image:url(icons/external.png);}
240
+ a[href^="mailto:"] {background-image:url(icons/email.png);}
241
+ a[href^="http:"]:visited {background-image:url(icons/visited.png);}
242
+ a[href$=".pdf"] {background-image:url(icons/pdf.png);}
243
+ a[href$=".doc"] {background-image:url(icons/doc.png);}
244
+ a[href$=".xls"] {background-image:url(icons/xls.png);}
245
+ a[href$=".rss"], a[href$=".rdf"] {background-image:url(icons/feed.png);}
246
+ a[href^="aim:"] {background-image:url(icons/im.png);}
247
+
248
+ /* tutorials */
249
+ body {font-size:16px;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;}
@@ -0,0 +1,121 @@
1
+ pre.dawn .MetaSeparator {
2
+ font-weight: bold;
3
+ background-color: #DCDCDC;
4
+ color: #19356D;
5
+ }
6
+ pre.dawn .SupportVariable {
7
+ color: #234A97;
8
+ }
9
+ pre.dawn .Constant {
10
+ font-weight: bold;
11
+ color: #811F24;
12
+ }
13
+ pre.dawn .EmbeddedSource {
14
+ background-color: #829AC2;
15
+ }
16
+ pre.dawn .StringRegexpConstantCharacterEscape {
17
+ font-weight: bold;
18
+ color: #811F24;
19
+ }
20
+ pre.dawn .Support {
21
+ color: #691C97;
22
+ }
23
+ pre.dawn .MarkupList {
24
+ color: #693A17;
25
+ }
26
+ pre.dawn .Storage {
27
+ color: #A71D5D;
28
+ font-style: italic;
29
+ }
30
+ pre.dawn .line-numbers {
31
+ background-color: #7496CF;
32
+ color: #000000;
33
+ }
34
+ pre.dawn .StringConstant {
35
+ font-weight: bold;
36
+ color: #696969;
37
+ }
38
+ pre.dawn .MarkupUnderline {
39
+ text-decoration: underline;
40
+ color: #080808;
41
+ }
42
+ pre.dawn .MarkupHeading {
43
+ font-weight: bold;
44
+ color: #19356D;
45
+ }
46
+ pre.dawn .SupportConstant {
47
+ color: #B4371F;
48
+ }
49
+ pre.dawn .MarkupQuote {
50
+ background-color: #C5C5C5;
51
+ color: #0B6125;
52
+ font-style: italic;
53
+ }
54
+ pre.dawn .StringRegexpSpecial {
55
+ font-weight: bold;
56
+ color: #CF5628;
57
+ }
58
+ pre.dawn .InvalidIllegal {
59
+ background-color: #B52A1D;
60
+ color: #F8F8F8;
61
+ font-style: italic;
62
+ }
63
+ pre.dawn .MarkupDeleted {
64
+ color: #B52A1D;
65
+ }
66
+ pre.dawn .MarkupRaw {
67
+ background-color: #C5C5C5;
68
+ color: #234A97;
69
+ }
70
+ pre.dawn .SupportFunction {
71
+ color: #693A17;
72
+ }
73
+ pre.dawn .PunctuationSeparator {
74
+ color: #794938;
75
+ }
76
+ pre.dawn .StringRegexp {
77
+ color: #CF5628;
78
+ }
79
+ pre.dawn .StringEmbeddedSource {
80
+ background-color: #829AC2;
81
+ color: #080808;
82
+ }
83
+ pre.dawn .MarkupLink {
84
+ color: #234A97;
85
+ font-style: italic;
86
+ }
87
+ pre.dawn .MarkupBold {
88
+ font-weight: bold;
89
+ color: #080808;
90
+ }
91
+ pre.dawn .StringVariable {
92
+ color: #234A97;
93
+ }
94
+ pre.dawn .String {
95
+ color: #0B6125;
96
+ }
97
+ pre.dawn .Keyword {
98
+ color: #794938;
99
+ }
100
+ pre.dawn {
101
+ /* background-color: #F5F5F5; */
102
+ color: #080808;
103
+ }
104
+ pre.dawn .MarkupItalic {
105
+ color: #080808;
106
+ font-style: italic;
107
+ }
108
+ pre.dawn .InvalidDeprecated {
109
+ font-weight: bold;
110
+ color: #B52A1D;
111
+ }
112
+ pre.dawn .Variable {
113
+ color: #234A97;
114
+ }
115
+ pre.dawn .Entity {
116
+ color: #BF4F24;
117
+ }
118
+ pre.dawn .Comment {
119
+ color: #5A525F;
120
+ font-style: italic;
121
+ }
@@ -0,0 +1,87 @@
1
+ #### {% title "Laboratorium 1" %}
2
+
3
+ # Funkcje *printf*, *scanf*
4
+
5
+ 1\. Funkcja *scanf* jest bardzo podobna do
6
+ funkcji *printf* z tym, że czyta dane z *stdin*
7
+ zamiast zapisywać wyniki na *stdout*. Najprościej mówiąc, użycie
8
+ *scanf* polega na podaniu formatu wprowadzanych danych i adresu
9
+ zmiennej, pod którą chcemy je zapisać. Oto przykłady:
10
+
11
+ Wczytaj liczbę całkowitą i zapisz jej wartość do zmiennej *a*:
12
+
13
+ :::c
14
+ scanf("%d",&a)
15
+
16
+ Wczytaj liczbę zmiennopozycyjną i zapisz jej wartość do zmiennej *b*:
17
+
18
+ :::c
19
+ scanf("%f",&b)
20
+
21
+ Wczytaj dwie liczby całkowite odzielone spacją i zapisz ich wartości
22
+ do zmiennych *c* oraz *d*:
23
+
24
+ :::c
25
+ scanf("%d %d", &c, &d)
26
+
27
+ W miejsce `...` poniżej wpisz kod, tak aby powstały działające programy.
28
+
29
+ Pierwszy program:
30
+
31
+ :::c
32
+ /* Program ten wykonuje konwersję ze stopni na radiany
33
+ według wzoru: rad = 2 * PI * deg / 360 */
34
+ #include <stdio.h>
35
+ #include <math.h>
36
+ int main() {
37
+ double deg, rad;
38
+ printf("Podaj kat w stopniach : ");
39
+ scanf("...", &deg);
40
+ rad = ... ; /* grep PI /usr/include/math.h */
41
+ printf("%lf deg = %lf rad\n", ... , ...);
42
+ return 0;
43
+ }
44
+
45
+ Drugi program:
46
+
47
+ :::c
48
+ /* Program ten dla dwóch liczb wczytanych z klawiatury
49
+ wypisuje, która z nich jest większa. */
50
+ #include <stdio.h>
51
+ int main()
52
+ {
53
+ int ..., ... ;
54
+
55
+ printf("Podaj pierwsza liczbe: ");
56
+ scanf(..., &licz1);
57
+ printf("...");
58
+ scanf(..., &licz2);
59
+ if (...)
60
+ ...
61
+ return 0;
62
+ }
63
+
64
+ 2\. Napisz program, który wczyta liczbę rzeczywistą i
65
+ wypisze jej pierwiastek kwadratowy. W wypadku podania liczby
66
+ ujemnej, program powinien wypisać komunikat o błędzie oraz
67
+ zakończyć działanie.
68
+
69
+ 3\. Napisz program, który wczyta liczbę rzeczywistą i
70
+ wypisze jej odwrotność oraz jej pierwiastek kwadratowy.
71
+ Program nie powinien obliczać odwrotności liczby 0
72
+ oraz pierwiastka z liczby ujemnej. W takiej
73
+ sytuacji zamiast obliczeń program powinien wypisać
74
+ odpowiedni komunikat.
75
+
76
+ 4\. Napisz program, który prosi użytkownika
77
+ o wprowadzenie trzech liczb z klawiatury, a następnie
78
+ wypisze sumę, iloczyn, najmniejszą i największą z
79
+ wprowadzonych liczb.
80
+
81
+ Dialog na terminalu powinien wyglądać tak:
82
+
83
+ Wprowadź trzy liczby całkowite: 1 2 3
84
+ Suma wynosi: 6
85
+ Iloczyn wynosi: 6
86
+ Najmniejsza liczba to: 1
87
+ Największa liczba to: 3
@@ -0,0 +1,16 @@
1
+ #### {% title "Blogi studentów" %}
2
+
3
+ # Blogi studentów
4
+
5
+ <blockquote>
6
+ {%= image_tag "/images/john-long.jpg", :alt => "[John W. Long]" %}
7
+ <p>Programmers have almost made code simplicity an art form while
8
+ designers are known for spending vast amounts of time doing very
9
+ tedious and repetitive work to get the effect that they want.</p>
10
+ <p class="author">— John W. Long</p>
11
+ </blockquote>
12
+
13
+ ## Grupa A
14
+
15
+ ## Grupa B
16
+
File without changes
@@ -0,0 +1,40 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl">
5
+
6
+ <head>
7
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
8
+
9
+ <%= stylesheet_link_tag "/stylesheets/screen.css", "/stylesheets/uv.css", "/stylesheets/c.css" %>
10
+ <%= stylesheet_link_tag "/stylesheets/print.css", :media => "print" %>
11
+ <!--[if IE]>
12
+ <%= stylesheet_link_tag "css/blueprint/ie.css" %>
13
+ <![endif]-->
14
+
15
+ <title><%= "C" + page_title %></title>
16
+ </head>
17
+ <body>
18
+ <div class="span-21" id="header">
19
+ <div id="logo" class="push-1 span-13">
20
+ <%= link_to "Zadania z C", "/" %>
21
+ </div>
22
+ <div class="span-7 last">
23
+ <div class="append-1" id="links">
24
+ <a href="http://inf.ug.edu.pl/~wbzyl/">home</a>
25
+ </div>
26
+ </div>
27
+ </div>
28
+
29
+ <div class="span-21 container"><!-- showgrid -->
30
+ <div class="push-1 span-12" id="content">
31
+
32
+ <%= yield %>
33
+
34
+ </div>
35
+ <div class="span-8 last">
36
+ </div>
37
+ </div>
38
+
39
+ </body>
40
+ </html>
@@ -0,0 +1,19 @@
1
+ # Języki Programowania
2
+
3
+ Link do slajdów z wykładów.
4
+
5
+ ## Laboratoria
6
+
7
+ 1. {%= link_to "Funkcje printf i scanf", "/01" %}
8
+ 1. {%= link_to "Kompilacja i konsolidacja", "/02" %}
9
+ 1. {%= link_to "Pliki nagłówkowe", "/03" %}
10
+
11
+ ## Literatura
12
+
13
+ 1. [FreeBSD Man Pages] [freebsd].
14
+ 1. [Thinking in C Beta 3](http://mindview.net/CDs/ThinkingInC)
15
+
16
+
17
+ #### Linki
18
+
19
+ [freebsd]: http://www.freebsd.org/cgi/man.cgi "FreeBSD Man Pages: Index Page"
metadata ADDED
@@ -0,0 +1,151 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: c-exercises
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Wlodek Bzyl
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-02-16 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rack
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "0"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: sinatra
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "0"
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: rdiscount
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "0"
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: ultraviolet
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: "0"
54
+ version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: rack-codehighlighter
57
+ type: :runtime
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: "0"
64
+ version:
65
+ - !ruby/object:Gem::Dependency
66
+ name: sinatra-rdiscount
67
+ type: :runtime
68
+ version_requirement:
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: "0"
74
+ version:
75
+ - !ruby/object:Gem::Dependency
76
+ name: sinatra-static-assets
77
+ type: :runtime
78
+ version_requirement:
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: "0"
84
+ version:
85
+ description: |
86
+ Zadania do wykladu Jezyki Programowania
87
+
88
+ email: matwb@ug.edu.pl
89
+ executables: []
90
+
91
+ extensions: []
92
+
93
+ extra_rdoc_files:
94
+ - README.markdown
95
+ files:
96
+ - Rakefile
97
+ - VERSION.yml
98
+ - lib/c-exercises.rb
99
+ - lib/config.ru
100
+ - lib/public/javascripts/c.js
101
+ - lib/public/stylesheets/c.css
102
+ - lib/public/stylesheets/fonts/Cyklop-Italic.otf
103
+ - lib/public/stylesheets/icons/doc.png
104
+ - lib/public/stylesheets/icons/email.png
105
+ - lib/public/stylesheets/icons/external.png
106
+ - lib/public/stylesheets/icons/feed.png
107
+ - lib/public/stylesheets/icons/im.png
108
+ - lib/public/stylesheets/icons/pdf.png
109
+ - lib/public/stylesheets/icons/visited.png
110
+ - lib/public/stylesheets/icons/xls.png
111
+ - lib/public/stylesheets/ie.css
112
+ - lib/public/stylesheets/print.css
113
+ - lib/public/stylesheets/screen.css
114
+ - lib/public/stylesheets/src/grid.png
115
+ - lib/public/stylesheets/uv.css
116
+ - lib/views/01.rdiscount
117
+ - lib/views/blogs.rdiscount
118
+ - lib/views/favicon.ico.rdiscount
119
+ - lib/views/layout.rdiscount
120
+ - lib/views/main.rdiscount
121
+ - README.markdown
122
+ has_rdoc: true
123
+ homepage: http://github.com/wbzyl/c-exercises
124
+ licenses: []
125
+
126
+ post_install_message:
127
+ rdoc_options:
128
+ - --charset=UTF-8
129
+ require_paths:
130
+ - lib
131
+ required_ruby_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: "0"
136
+ version:
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - ">="
140
+ - !ruby/object:Gem::Version
141
+ version: "0"
142
+ version:
143
+ requirements: []
144
+
145
+ rubyforge_project:
146
+ rubygems_version: 1.3.5
147
+ signing_key:
148
+ specification_version: 3
149
+ summary: Zadania do wykladu Jezyki Programowania.
150
+ test_files: []
151
+