Category Archives: C language (en)
C Language: Dictionary Spell Checker
At the end of the fifth week of the CS50 Harvard course, we studied hash tables, which can be used to solve the problem of hashing words from text to check their spelling in a dictionary (speller.c). A dictionary is … Continue reading
C language: inheritance of blood type of family members
In the fifth week of the Computer Science – CS50 (Harvard) course, we studied data structures and learned how to access structure elements by their address. To complete your homework (Lab 5 – inheritance.c), you need to understand the scientific … Continue reading
C Language: Simple Random Number Generator
Random number generator in C with srand() and time(). Srand() is a helper function for the rand() function, generating a seed for the start of a sequence of (pseudo)random numbers. Because the time returned by the time() function changes once … Continue reading
C language: recover photos from memory card
Imagine that you deleted photos from your memory card and then wanted to restore them. It turns out that in some cases it is possible to do this, because when we delete a photo with the “delete” button, what actually … Continue reading
C language: a filter that highlights the edges of objects in an image
At the end of the fourth week of the CS50 (Harvard) course, we had an interesting task: to make a program that takes the original image and imposes a filter on it with selection of the edges of objects (filter-more). … Continue reading
C language: change file sound volume
In the fourth week of the CS50 (Harvard) course, we learned how to work with memory, which will help you perform a laboratory work on changing the volume of the sound in a .wav file using a program that receives … Continue reading
C language: Apply a filter to an image
In the 4th week of the CS50 (Harvard) course, we studied the principles of working with memory and data arrays. We were faced with the task of writing a program that will apply filters to the original image (filter-less). You … Continue reading
C language: addresses and pointers
An example of how addresses are stored in memory: #include <stdio.h> #include <stdlib.h> int main(void) { int* x = NULL; printf (“address of new pointer-type variable x: %p\n”, &x); printf (“value of variable x: %p\n”, x); x = (int*) malloc(sizeof(int)); … Continue reading
C language: Swap variables
A curious feature: howto swap numeric variables ezpz without a buffer using the bitwise XOR operation (bitwise exclusive OR): #include <stdio.h> int main(void) { int a = 3; int b = 5; printf(“a = %d, b = %d\n”, a, b); … Continue reading
C language: sorting lab
We continue the course cs50, week three, sorting algorithms. It’s time for the lab. It is very simple: download test setup: https://cdn.cs50.net/2021/fall/labs/3/sort.zip inside the archive there are three already compiled C programs: sort1, sort2 and sort3 are binaries, i.e. binary … Continue reading
C Language: Recursion Exercises
To learn recursion you need to pump up some muscles. To do so – make some of exercises which are listed below. If something did not work out, you can peep the solution. Most likely the next day you will … Continue reading
C Language: Recursion and the Collatz Conjecture
We continue to take the Computer Science CS50 course and the C language. We study recursion using the example of the Collatz hypothesis – an interesting (and easy to understand) mathematical problem that has not yet been solved by scientists. … Continue reading
C language: multi-round voting
In the third week of the Computer Science CS50 (Harvard) course, it is proposed to do homework in Problem Set 3 called runoff.c – you need to write a program code that does not just calculate which candidate received the … Continue reading
C Language: Majority Elections
The third week of Computer Science CS50 (Harvard) training begins and we continue to learn the C language. The first task: the implementation of a voting system where the candidate with the most votes wins, the so-called. plurality system or … Continue reading
C language: Scrabble game with a friend
In the second week of the Computer Science CS50 (Harvard) course, after completing all the individual tasks, we move on to the C lab, which must be completed in a group. It will be an interesting task – to write … Continue reading
C Language: Advanced Caesarian Encryption
We continue to do homework from Problem set 2 in Computer science CS50 (Harvard). Last time, we learned how to encrypt text by shifting letters by a certain number (key) entered by the user. And this time we will solve … Continue reading
C Language: Calculating the Level of Difficulty of a Text Using the Coleman-Liau Index
We continue to take the Computer Science CS50 (Harvard) course, and this time we will do the task of calculating the level of complexity of the text according to the Colman-Liau index (readability.c) in the C programming language. According to … Continue reading