Skip to content

Instantly share code, notes, and snippets.

View moqdm's full-sized avatar
๐Ÿ›๏ธ

M Moghaddam moqdm

๐Ÿ›๏ธ
View GitHub Profile
@moqdm
moqdm / dictionary.c
Last active September 6, 2021 13:29
it's my PSet 5: Speller solution... *Please just take a look if you couldn't solve it ... Thank you ๐Ÿ™‚ #cs50
// Implements a dictionary's functionality
#include <stdbool.h>
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include "dictionary.h"
#include <string.h>
#include <strings.h>
@moqdm
moqdm / inheritance.c
Created August 24, 2021 11:21
it's my Lab 5: Inheritance solution... *Please just take a look if you couldn't solve it ... Thank you ๐Ÿ™‚ #cs50
// Simulate genetic inheritance of blood type
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
// Each person has two parents and two alleles
typedef struct person
{
@moqdm
moqdm / recover.c
Last active September 6, 2021 13:28
it's my PSet 4: Recover solution... *Please just take a look if you couldn't solve it ... Thank you ๐Ÿ™‚ #cs50
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
typedef uint8_t BYTE;
int main(int argc, char *argv[])
{
if (argc != 2)
{
@moqdm
moqdm / helpersM.c
Last active September 6, 2021 13:28
it's my PSet 4: Filter (More) solution... *Please just take a look if you couldn't solve it ... Thank you ๐Ÿ™‚ #cs50
#include "helpers.h"
#include <math.h>
// Convert image to grayscale
void grayscale(int height, int width, RGBTRIPLE image[height][width])
{
for (int i = 0; i < height; i++)
{
for (int j = 0; j < width; j++)
{
@moqdm
moqdm / helpersL.c
Last active September 6, 2021 13:28
it's my PSet 4: Filter (Less) solution... *Please just take a look if you couldn't solve it ... Thank you ๐Ÿ™‚ #cs50
#include "helpers.h"
#include <math.h>
// Convert image to grayscale
void grayscale(int height, int width, RGBTRIPLE image[height][width])
{
for (int i = 0; i < height; i++)
{
for (int j = 0; j < width; j++)
{
@moqdm
moqdm / volume.c
Created August 22, 2021 19:23
it's my Lab 4: Volume solution... *Please just take a look if you couldn't solve it ... Thank you ๐Ÿ™‚ #cs50
// Modifies the volume of an audio file
#include <cs50.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
// Number of bytes in .wav header
const int HEADER_SIZE = 44;
@moqdm
moqdm / runoff.c
Last active September 6, 2021 13:28
it's my PSet 3: Runoff solution... *Please just take a look if you couldn't solve it ... Thank you ๐Ÿ™‚ #cs50
#include <cs50.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <stdlib.h>
// Max voters and candidates
#define MAX_VOTERS 100
#define MAX_CANDIDATES 9
@moqdm
moqdm / plurality.c
Last active September 6, 2021 13:28
it's my PSet 3: Plurality solution... *Please just take a look if you couldn't solve it ... Thank you ๐Ÿ™‚ #cs50
#include <cs50.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <stdlib.h>
// Max number of candidates
#define MAX 9
@moqdm
moqdm / answers.txt
Last active August 21, 2021 15:10
it's my Lab 3: Sort solution... *Please just take a look if you couldn't solve it ... Thank you ๐Ÿ™‚ #cs50
sort1 uses: Bubble Sort
How do you know?: I checked the time for the least amount of data in the sorted state based on omega.
sort2 uses: Merge Sort
How do you know?: I checked the time for the least amount of data in the sorted state based on omega.
sort3 uses: Selection Sort
@moqdm
moqdm / caesar.c
Last active September 6, 2021 13:27
it's my PSet 2: Caesar solution... *Please just take a look if you couldn't solve it ... Thank you ๐Ÿ™‚ #cs50
#include <cs50.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <stdlib.h>
//Variable.
int s = 0;
int main(int argc, string argv[])
{