B CPE 042 Day03 .pdf



Nom original: B-CPE-042_Day03.pdf

Ce document au format PDF 1.5 a été généré par LaTeX with hyperref package / pdfTeX-1.40.16, et a été envoyé sur fichier-pdf.fr le 06/10/2016 à 17:50, depuis l'adresse IP 89.84.x.x. La présente page de téléchargement du fichier a été vue 1742 fois.
Taille du document: 231 Ko (7 pages).
Confidentialité: fichier public


Aperçu du document


B1- C Pool
B-CPE-042

Day 03
First C Programming

v1.6

Day 03
First C Programming
repository name: : CPool_Day03
repository rights: : ramassage-tek
language: : C
group size: : 1

• Your repository must contain the totality of your source files, but no useless files (binary, temp files,
obj files,...).
• Don’t push your main function into your delivery directory, we will be adding our own. Your files
will be compiled adding our main.c and our my_putchar.c files.
• You are only allowed to use the my_putchar function to complete the following tasks, but don’t
push it into your delivery directory, and don’t copy it in any of your delivered files.
• If one of your files prevents you from compiling with * .c, the Autograder will not be able to correct
your work and you will receive a 0.

Arrays are forbidden for every task.

Create your repository at the beginning of the day and submit your work on a regular basis!
The delivery directory is specified within the instructions for each task.
In order to keep your repository clean, pay attention to gitignore.

1

Task 1
my_print_alpha
Write a function that, beginning with a, displays the lowercase alphabet in ascending order, on a single line. It must
be prototyped as follows:
i n t my_print_alpha ( ) ;

Delivery:: CPool_Day03/my_print_alpha.c

Task 2
my_print_revalpha
Write a function that, beginning with z, displays the lowercase alphabet in descending order, on a single line. It must
be prototyped as follows:
i n t my_print_revalpha ( ) ;

Delivery: CPool_Day03/my_print_revalpha.c

Task 3
my_print_digits
Write a function that displays all the digits, on a single line, in ascending order. It must be prototyped as follows:
int my_print_digits ( ) ;

Delivery: CPool_Day03/my_print_digits.c

2

Task 4
my_isneg
Write a function that displays either N if the integer passed as parameter is negative, P, if positive or null. It must be
prototyped as follows:
i n t my_isneg ( i n t n ) ;

Delivery: CPool_Day03/my_isneg.c

Task 5
my_print_comb
Write a function that displays, in ascending order, all the numbers composed by three different digits numbers (012,
013, 014, 015, 016, 017, 018, 019, 023, ..., 789). Given three digits (all different), only the smallest number composed
by thoses digits must be displayed. It must be prototyped as follows:
i n t my_print_comb ( ) ;

Delivery: CPool_Day03/my_print_comb.c
Terminal
∼/B-CPE-042> ./a.out
012, 013, 014, 015, 016, 017, 018, 019, 023, ..., 789

+ x

Neither 987 nor 999 is to be displayed (as an example).

Task 6
my_print_comb2
Write a function that displays, in ascending order, all the different combinations of two two-digit numbers (00 01,
00 02, 00 03, 00 04, 00 05,...,01 99, 02 03, ..., 98 99). It must be prototyped as follows:
i n t my_print_comb2 ( )

;

3

Delivery: CPool_Day03/my_print_comb2.c
Terminal
∼/B-CPE-042> ./a.out
00 01, 00 02, 00 03, 00 04, 00 05,...,01 99, 02 03, ..., 98 99

4

+ x

Task 7
my_put_nbr
Write a function that displays the number given as parameter. It must be able to display all the possible values of an
int, and must be prototyped as follows:
i n t my_put_nbr ( i n t nb ) ;

Delivery: CPool_Day03/my_put_nbr.c

For instance, my_put_nbr(42) displays 42, my_put_nbr(0) displays 0, my_put_nbr(-2147483647)
displays -2147483647.

Task 8
Unit Tests
It is highly recommended to test your functions as you develop them. It is common practice to create a function
named main (and a designated file to host it) to check the functions separately.
Create a directory named tests.
Create a main function within a file named tests-my_put_nbr.c, to be stored in the tests directory named.
This function must contain all the necessary calls to my_put_nbr in order to cover all of the function’s possible situations (both regular or irregular).
For instance, for the my_isneg function, you could have a file similar to the following:
i n t main ( )
{
my_isneg ( 0 ) ;
my_isneg ( 2 1 ) ;
my_isneg ( − 2 1 ) ;
return (0) ;
}

To recap: please put all of your main functions into the tests directory (designated for the day), using the following
name convention: tests-my_function.c
The Autograder will indicate the percentage of tests covered by your main function.

You are expected to do the same for all of the other days

5

Task 9
my_print_combn
Write a function that displays, in ascending order, all the numbers composed by n different digits numbers (n being
given as parameter). Given n digits (all different), only the smallest number composed by thoses digits must be
displayed. It must be prototyped as follows:
i n t my_print_combn ( i n t n )

Delivery: CPool_Day03/my_print_combn.c

my_print_combn(3) gives the same result as my_print_comb.

6


Aperçu du document B-CPE-042_Day03.pdf - page 1/7
 
B-CPE-042_Day03.pdf - page 2/7
B-CPE-042_Day03.pdf - page 3/7
B-CPE-042_Day03.pdf - page 4/7
B-CPE-042_Day03.pdf - page 5/7
B-CPE-042_Day03.pdf - page 6/7
 




Télécharger le fichier (PDF)


B-CPE-042_Day03.pdf (PDF, 231 Ko)

Télécharger
Formats alternatifs: ZIP



Documents similaires


b cpe 042 day03 2
b cpe 042 day04 1
b cpe 042 tree
b cpe 042 rush2
summary of verilog syntax
flmsg