Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New exercises #176

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

New exercises #176

wants to merge 3 commits into from

Conversation

iaceene
Copy link

@iaceene iaceene commented Sep 2, 2024

exercises: ft_swapcases, title, and interval_spaces.

Table of Contents

  1. ft_swapcases
  2. title
  3. interval_spaces

ft_swapcases

Assignment Name: ft_swapcases

Objective:
Write a program that takes a string as an argument and prints it with the case of each alphabetical character swapped (lowercase becomes uppercase and vice versa). Non-alphabetical characters remain unchanged.

Expected Files: ft_swapcases.c

Allowed Functions: write

Example Usage:

$> ./ft_swapcases "Hello World!" | cat -e
hELLO wORLD!$
$> ./ft_swapcases "42School" | cat -e
42sCHOOL$
$> ./ft_swapcases "" | cat -e
$
$> ./ft_swapcases | cat -e
$

Notes:

  • If no arguments are provided, the program should simply print a newline.
  • Handle both uppercase and lowercase letters.
  • The program directly prints the modified string to standard output.

title

Assignment Name: title

Objective:
Write a program that takes a string as an argument and displays the string with the first letter of each word capitalized. Words are separated by spaces, and all non-alphabetical characters remain unchanged.

Expected Files: title.c

Allowed Functions: write

Example Usage:

$> ./title "hello world" | cat -e
Hello World$
$> ./title "this is a test" | cat -e
This Is A Test$
$> ./title "this is 42a test" | cat -e
This Is 42a Test$
$> ./title "MY TITLE" | cat -e
MY TITLE$
$> ./title "" | cat -e
$
$> ./title | cat -e
$

Notes:

  • If the number of arguments is not exactly one, the program should print only a newline.
  • The program capitalizes the first letter of each word while leaving the rest of the string unchanged.

interval_spaces

Assignment Name: interval_spaces

Objective:
Write a program that takes a string as an argument and displays each of its alphabetical characters separated by three spaces. The last character should be followed directly by a newline, without any trailing spaces. Non-alphabetical characters should be ignored.

Expected Files: interval_spaces.c

Allowed Functions: write

Example Usage:

$> ./interval_spaces "abc" | cat -e
a   b   c$
$> ./interval_spaces "abc def" | cat -e
a   b   c   d   e   f$
$> ./interval_spaces "a1b2c3" | cat -e
a   b   c$
$> ./interval_spaces "Hello, World!" | cat -e
H   e   l   l   o   W   o   r   l   d$
$> ./interval_spaces "" | cat -e
$
$> ./interval_spaces | cat -e
$

Notes:

  • If the number of arguments is not exactly one, the program should print only a newline.
  • Non-alphabetical characters are ignored, and the output has no trailing spaces.

@JCluzet
Copy link
Owner

JCluzet commented Sep 8, 2024

Hi, thanks for the exercises, they are well-structured and clear! Before we can merge, there’s just one small thing missing: could you add a file named beta with just your GitHub login inside? This will trigger a warning indicating that it’s a contribution. Once that’s done, we can proceed with the merge. Thanks!

Let me know if that works for you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants