Skip to content

Instantly share code, notes, and snippets.

View andrija-zikovic's full-sized avatar
🏠
Working from home

Andrija Žiković andrija-zikovic

🏠
Working from home
View GitHub Profile
# Simulate a sports tournament
import csv
import sys
import random
# Number of simluations to run
N = 1000
#include <cs50.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
// each of our text files contains 1000 words
#define LISTSIZE 1000
// values for colors and score (EXACT == right letter, right place; CLOSE == right letter, wrong place; WRONG == wrong letter)
// Modifies the volume of an audio file
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
// Number of bytes in .wav header
const int HEADER_SIZE = 44;
int main(int argc, char *argv[])
// Saves popular dog names in a trie
// https://www.dailypaws.com/dogs-puppies/dog-names/common-dog-names
#include <cs50.h>
#include <ctype.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cs50.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
// Max number of candidates
#define MAX 9
// preferences[i][j] is number of voters who prefer i over j
int preferences[MAX][MAX];
// Practice working with structs
// Practice applying sorting algorithms
#include <cs50.h>
#include <stdio.h>
#define NUM_CITIES 10
typedef struct
{
@andrija-zikovic
andrija-zikovic / substitution.c
Created May 26, 2023 11:37
CS50/substitution
#include <cs50.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int only_letters(string text);
int repeated(string text);
char rotate(char c, string key);
int main(int argc, string argv[])
@andrija-zikovic
andrija-zikovic / snackbar.c
Created May 26, 2023 11:36
CS50/snackbar
// Practice using structs
// Practice writing a linear search function
/**
* Beach Burger Shack has the following 10 items on their menu
* Burger: $9.5
* Vegan Burger: $11
* Hot Dog: $5
* Cheese Dog: $7
* Fries: $5
@andrija-zikovic
andrija-zikovic / seven-day-average.py
Created May 26, 2023 11:35
CS50/seven-day-average
import csv
import requests
def main():
# Read NYTimes Covid Database
download = requests.get(
"https://raw.githubusercontent.com/nytimes/covid-19-data/master/us-states.csv"
)
decoded_content = download.content.decode("utf-8")
@andrija-zikovic
andrija-zikovic / cash.py
Created May 26, 2023 11:33
CS50 Sentimental staff
from cs50 import get_float
import decimal
def main():
## Ask how many dollars the customer is owed
while True:
dollars = get_float("Change owned: ")
if dollars > 0:
break