image/svg+xml
Programozás I.
The length of main function can be maximum
5 lines! Please create a module for you task,
and implement everything in this module!
Every function made by you must be NULL safe!
Final exam
Warning!
Parameter passing of the application
have to be by the argc/argv of main function!
You cannot use scanf/getchar and other user
input functions!
You need to implement one of these exams!
7. Write an application which can prints the prime
numbers in the given range
Tip: Check the parameters, at least two numbers.
Check whether min is less than max. If not, swap them.
Prime number can divide by 1 and itself without remaining.
You can use more algorithms, for example a for cycle from min to max and checks whether the
given number is prime?
There are more efficient algorithms, you can use one of them too.
suggested libc functions:
printf()
effort level: 3 if the worst algorithm and 4,5 if you found a better algorithm.
1. Write a program which can catalog
all of the files given by arguments to
the console.
Tip: you can use the example of "list a file".
suggested libc functions:
printf()
fopen()
fgets()
effort level: 2
fputs()
fclose()
2. Write a program to check email address validity
Tip: Parse the string and count the special characters like '@', '.'. There are only one '@'
and at least one '.' character.
suggested libc functions:
printf()
effort level: 3 if you make simple checks and 5 for all checks.
More checks (optionally):
the first and last characters cannot be '@' or '.'
cannot be an '.' or '@' beside an '@'
cannot be a '@' or '.' beside an '.'
In this exercise, you should not use the strlen() function to determine
the length of the string, because then you will scan the string twice,
character by character. A good solution is to check in the loop
whether you have reached binary zero.
3. Write a program to check telephone number validity
Tip: Parse the string and check whether all characters are numbers '0'..'9'.
suggested libc functions:
printf()
effort level: 3 if you make simple checks and 5 for all checks.
More checks (optionally):
you can use ' ', '/' or '-' charaters optionally
you can use '(' ')' pairs optionally. Yuo have to check the number of opening and closing brackets.
In this exercise, you should not use the strlen() function to determine
the length of the string, because then you will scan the string twice,
character by character. A good solution is to check in the loop
whether you have reached binary zero.
here.
4. Write the strcmp() function
Tip: You can get more information about the function
suggested libc functions:
printf()
effort level: 3
In this exercise, you should not use the strlen() function to
determine the length of the string, because then you will
scan the string twice, character by character. A good
solution is to check in the loop whether you have reached
binary zero.
5. Write an uppercase() function.
Tip: Parse the string and make the letters to uppercase.
Every characters are in the ASCII codetable, the differences between the upper and lower case is 0x20.
The uppercase is meanings an and operation with ~0x20 (clear the 5.th. bit).
suggested libc functions:
printf()
effort level: 3
In this exercise, you should not use the strlen() function to determine
the length of the string, because then you will scan the string twice,
character by character. A good solution is to check in the loop
whether you have reached binary zero.
6. Write an application which can prints the
given file with line numbers.
Tip: you can use the example of "list a file".
suggested libc functions:
printf()
fputs()
effort level: 3
fopen()
fclose()
fgets()
So Long, and
Thanks for All the Fish!
Please choose one of these exams and implement it.
After your application works well, please create a
repository for this application and share it on Gitlab
with your teacher. The teacher must be a developer
of your repository.
1
main
Warning
length of main
2.all cat
3. email check
4. telephone number check
5.strcmp
6.uppercase()
7.cat with line numbers
8. prime
Thank you!