This website works better with JavaScript.
Home
Help
Sign In
tmeissner
/
learning-by-doing
Watch
1
Star
0
Fork
0
Code
Issues
0
Pull Requests
0
Releases
0
Wiki
Activity
Browse Source
Add first exercises of chapter 06
master
T. Meissner
9 years ago
parent
03287ab627
commit
7046a29fc4
5 changed files
with
82 additions
and
0 deletions
Split View
Diff Options
Show Stats
Download Patch File
Download Diff File
+21
-0
c_primer_plus/chapter06/01.c
+16
-0
c_primer_plus/chapter06/02.c
+16
-0
c_primer_plus/chapter06/03.c
+19
-0
c_primer_plus/chapter06/04.c
+10
-0
c_primer_plus/chapter06/Makefile
+ 21
- 0
c_primer_plus/chapter06/01.c
View File
@ -0,0 +1,21 @@
#
include
<stdio.h>
int
main
(
void
)
{
unsigned
char
abc
[
26
]
;
for
(
size_t
i
=
'
a
'
;
i
<
=
'
z
'
;
i
+
+
)
{
abc
[
i
-
'
a
'
]
=
i
;
}
for
(
size_t
i
=
0
;
i
<
sizeof
(
abc
)
;
i
+
+
)
{
printf
(
"
%c
"
,
abc
[
i
]
)
;
}
printf
(
"
\n
"
)
;
return
0
;
}
+ 16
- 0
c_primer_plus/chapter06/02.c
View File
@ -0,0 +1,16 @@
#
include
<stdio.h>
int
main
(
void
)
{
for
(
size_t
i
=
0
;
i
<
5
;
i
+
+
)
{
for
(
size_t
j
=
0
;
j
<
=
i
;
j
+
+
)
{
printf
(
"
$
"
)
;
}
printf
(
"
\n
"
)
;
}
return
0
;
}
+ 16
- 0
c_primer_plus/chapter06/03.c
View File
@ -0,0 +1,16 @@
#
include
<stdio.h>
int
main
(
void
)
{
for
(
int
i
=
0
;
i
<
6
;
i
+
+
)
{
for
(
int
j
=
'
F
'
;
j
>
=
(
'
F
'
-
i
)
;
j
-
-
)
{
printf
(
"
%c
"
,
j
)
;
}
printf
(
"
\n
"
)
;
}
return
0
;
}
+ 19
- 0
c_primer_plus/chapter06/04.c
View File
@ -0,0 +1,19 @@
#
include
<stdio.h>
int
main
(
void
)
{
unsigned
char
letter
=
'
A
'
;
for
(
unsigned
char
i
=
0
;
i
<
6
;
i
+
+
)
{
for
(
unsigned
char
j
=
letter
;
j
<
=
(
letter
+
i
)
;
j
+
+
)
{
printf
(
"
%c
"
,
j
)
;
}
letter
+
=
(
i
+
1
)
;
printf
(
"
\n
"
)
;
}
return
0
;
}
+ 10
- 0
c_primer_plus/chapter06/Makefile
View File
@ -0,0 +1,10 @@
SRC
:=
$(
shell ls *.c
)
%
:
%.
c
gcc -Wall -Wextra
$@
.c -o
$@
.PHONY
:
clean
clean
:
@rm -f ??
Write
Preview
Loading…
Cancel
Save