Skip to content

Instantly share code, notes, and snippets.

View CraigRodrigues's full-sized avatar

Craig Rodrigues CraigRodrigues

View GitHub Profile
@CraigRodrigues
CraigRodrigues / caesar.c
Last active October 1, 2022 02:57
My solution to CS50 pset2 - "Hail, Caesar!"
#include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
/**
* Caesar.c
* A program that encrypts messages using Caesar’s cipher. Your program must
* accept a single command-line argument: a non-negative integer. Let’s call it
* k for the sake of discussion. If your program is executed without any
@CraigRodrigues
CraigRodrigues / initials.c
Created May 31, 2016 19:38
My solution to CS50 pset2 - "Initializing"
#include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
/**
*
* Write, in a file called initials.c, a program that prompts a user for
* their name (using GetString to obtain their name as a string) and then
* outputs their initials in uppercase with no spaces or periods,
@CraigRodrigues
CraigRodrigues / vigenere.c
Created June 1, 2016 02:45
My solution to CS50 pset2 - "Parlez-vous français?"
#include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
/**
* Vigenere.c
*
* A program that encrypts messages using Vigenère’s cipher. This program
* must accept a single command-line argument: a keyword, k, composed entirely
@CraigRodrigues
CraigRodrigues / water1.c
Created June 2, 2016 17:38
My solution to CS50 pset1 - "Smart Water" (modified)
#include <stdio.h>
#include <cs50.h>
// function that returns the number of 16oz bottles used
int getBottles(int time, int showerflow)
{
return (time * showerflow)/16;
}
int main(void)
@CraigRodrigues
CraigRodrigues / caesar2.c
Last active June 2, 2016 20:03
My solution to CS50 pset2 - "Hail, Caesar!" (using function)
#include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
/**
* Caesar.c
* A program that encrypts messages using Caesar’s cipher. Your program must
* accept a single command-line argument: a non-negative integer. Let’s call it
* k for the sake of discussion. If your program is executed without any
@CraigRodrigues
CraigRodrigues / credit2.c
Created June 3, 2016 16:30
My solution to CS50 Hacker pset1 - "Bad Credit " (printf tests included)
#include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
// calculates the number of digits in the card number
int getCardDigits(long long card_num)
{
int card_digits = (int)log10(card_num) + 1;
@CraigRodrigues
CraigRodrigues / credit.c
Created June 3, 2016 16:46
My solution to CS50 Hacker pset1 - "Bad Credit"
#include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
// calculates the number of digits in the card number
int getCardDigits(long long card_num)
{
int card_digits = (int)log10(card_num) + 1;
@CraigRodrigues
CraigRodrigues / helpers.c
Created June 8, 2016 19:09
CS50 pset3 - "Game of Fifteen" - Linear Search Algorithm
/**
* helpers.c
*
* Computer Science 50
* Problem Set 3
*
* Helper functions for Problem Set 3.
*/
#include <cs50.h>
@CraigRodrigues
CraigRodrigues / helpers2.c
Last active June 10, 2016 20:48
CS50 pset3 - "Game of Fifteen" - Helpers - Insertion Sort & Binary Search (Recursion)
/**
* helpers.c
*
* Computer Science 50
* Problem Set 3
*
* Helper functions for Problem Set 3.
*/
#include <cs50.h>
@CraigRodrigues
CraigRodrigues / fifteen.c
Created June 10, 2016 21:01
CS50 pset3 - "Game of Fifteen"
/**
* fifteen.c
*
* Computer Science 50
* Problem Set 3
*
* Implements Game of Fifteen (generalized to d x d).
*
* Usage: fifteen d
*