forked from root/public
Augusto
5 years ago
8 changed files with 160 additions and 0 deletions
@ -0,0 +1,16 @@
|
||||
# displayalpham |
||||
## Instructions |
||||
|
||||
Write a program that displays the alphabet, with even letters in uppercase, and |
||||
odd letters in lowercase, followed by a newline. |
||||
|
||||
The function must have the next signature. |
||||
|
||||
Example : |
||||
|
||||
```console |
||||
student@ubuntu:~/student/displayalpham$ go build |
||||
student@ubuntu:~/student/displayalpham$ ./displayalpham | cat -e |
||||
aBcDeFgHiJkLmNoPqRsTuVwXyZ$ |
||||
student@ubuntu:~/student/displayalpham$ |
||||
``` |
@ -0,0 +1,16 @@
|
||||
# displayalrevm |
||||
## Instructions |
||||
|
||||
Write a program that displays the alphabet in reverse, with even letters in |
||||
uppercase, and odd letters in lowercase, followed by a newline. |
||||
|
||||
The function must have the next signature. |
||||
|
||||
Example : |
||||
|
||||
```console |
||||
student@ubuntu:~/student/displayalrevm$ go build |
||||
student@ubuntu:~/student/displayalrevm$ ./displayalrevm | cat -e |
||||
aBcDeFgHiJkLmNoPqRsTuVwXyZ$ |
||||
student@ubuntu:~/student/displayalrevm$ |
||||
``` |
@ -0,0 +1,28 @@
|
||||
# lastword |
||||
## Instructions |
||||
|
||||
Write a program that takes a string and displays its last word, followed by a |
||||
newline. |
||||
|
||||
A word is a section of string delimited by spaces/tabs or by the start/end of |
||||
the string. |
||||
|
||||
If the number of parameters is not 1, or if there are no words, simply display |
||||
a newline. |
||||
|
||||
Example : |
||||
|
||||
```console |
||||
student@ubuntu:~/student/lastword$ go build |
||||
student@ubuntu:~/student/lastword$ ./lastword "FOR PONY" | cat -e |
||||
PONY$ |
||||
student@ubuntu:~/student/lastword$ ./lastword "this ... is sparta, then again, maybe not" | cat -e |
||||
not$ |
||||
student@ubuntu:~/student/lastword$ ./lastword " " | cat -e |
||||
$ |
||||
student@ubuntu:~/student/lastword$ ./lastword "a" "b" | cat -e |
||||
$ |
||||
student@ubuntu:~/student/lastword$ ./lastword " lorem,ipsum " | cat -e |
||||
lorem,ipsum$ |
||||
student@ubuntu:~/student/lastword$ |
||||
``` |
@ -0,0 +1,4 @@
|
||||
# displayalpham |
||||
## Instructions |
||||
|
||||
Write a program that displays a 'z' character on the standard output. |
@ -0,0 +1,29 @@
|
||||
# repeatalpha |
||||
## Instructions |
||||
|
||||
Write a program called repeat_alpha that takes a string and display it |
||||
repeating each alphabetical character as many times as its alphabetical index, |
||||
followed by a newline. |
||||
|
||||
'a' becomes 'a', 'b' becomes 'bb', 'e' becomes 'eeeee', etc... |
||||
|
||||
Case remains unchanged. |
||||
|
||||
If the number of arguments is not 1, just display a newline. |
||||
|
||||
Examples: |
||||
|
||||
```console |
||||
student@ubuntu:~/student/repeatalpha$ go build |
||||
student@ubuntu:~/student/repeatalpha$ ./repeatalpha "abc" | cat -e |
||||
abbccc |
||||
student@ubuntu:~/student/repeatalpha$ ./repeatalpha "Alex." | cat -e |
||||
Alllllllllllleeeeexxxxxxxxxxxxxxxxxxxxxxxx.$ |
||||
student@ubuntu:~/student/repeatalpha$ ./repeatalpha "abacadaba 42!" | cat -e |
||||
abbacccaddddabba 42!$ |
||||
student@ubuntu:~/student/repeatalpha$ ./repeatalpha | cat -e |
||||
$ |
||||
student@ubuntu:~/student/repeatalpha$ ./repeatalpha "" | cat -e |
||||
$ |
||||
student@ubuntu:~/student/repeatalpha$ |
||||
``` |
@ -0,0 +1,20 @@
|
||||
# reversebits |
||||
## Instructions |
||||
|
||||
Write a function that takes a byte, reverses it, bit by bit (like the |
||||
example) and returns the result. |
||||
|
||||
Your function must be declared as follows: |
||||
|
||||
func ReverseBits(octet byte) byte { |
||||
... |
||||
} |
||||
|
||||
Example: |
||||
|
||||
1 byte |
||||
_____________ |
||||
00100110 |
||||
|| |
||||
\/ |
||||
01100100 |
@ -0,0 +1,20 @@
|
||||
# swapbits |
||||
## Instructions |
||||
|
||||
Write a function that takes a byte, swaps its halves (like the example) and |
||||
returns the result. |
||||
|
||||
Your function must be declared as follows: |
||||
|
||||
func SwapBits(octet byte) byte { |
||||
... |
||||
} |
||||
|
||||
Example: |
||||
|
||||
1 byte |
||||
_____________ |
||||
0100 | 0001 |
||||
\ / |
||||
/ \ |
||||
0001 | 0100 |
@ -0,0 +1,27 @@
|
||||
# union |
||||
## Instructions |
||||
|
||||
Write a program that takes two strings and displays, without doubles, the |
||||
characters that appear in either one of the strings. |
||||
|
||||
The display will be in the order characters appear in the command line, and |
||||
will be followed by a \n. |
||||
|
||||
If the number of arguments is not 2, the program displays \n. |
||||
|
||||
Example : |
||||
|
||||
```console |
||||
student@ubuntu:~/student/union$ go build |
||||
student@ubuntu:~/student/union$ ./union zpadinton "paqefwtdjetyiytjneytjoeyjnejeyj" | cat -e |
||||
zpadintoqefwjy$ |
||||
student@ubuntu:~/student/union$ ./union ddf6vewg64f gtwthgdwthdwfteewhrtag6h4ffdhsd | cat -e |
||||
df6vewg4thras$ |
||||
student@ubuntu:~/student/union$ ./union "rien" "cette phrase ne cache rien" | cat -e |
||||
rienct phas$ |
||||
student@ubuntu:~/student/union$ ./union | cat -e |
||||
$ |
||||
student@ubuntu:~/student/union$ ./union "rien" | cat -e |
||||
$ |
||||
student@ubuntu:~/student/union$ |
||||
``` |
Loading…
Reference in new issue