Skip to content

Instantly share code, notes, and snippets.

Avatar

Craig Rodrigues CraigRodrigues

View GitHub Profile
@CraigRodrigues
CraigRodrigues / caesar.c
Last active Jul 15, 2020
My solution to CS50 pset2 - "Hail, Caesar!"
View caesar.c
#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
My solution to CS50 pset2 - "Initializing"
View initials.c
#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 Jun 1, 2016
My solution to CS50 pset2 - "Parlez-vous français?"
View vigenere.c
#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 Jun 2, 2016
My solution to CS50 pset1 - "Smart Water" (modified)
View water1.c
#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 Jun 2, 2016
My solution to CS50 pset2 - "Hail, Caesar!" (using function)
View caesar2.c
#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 Jun 3, 2016
My solution to CS50 Hacker pset1 - "Bad Credit " (printf tests included)
View credit2.c
#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 Jun 3, 2016
My solution to CS50 Hacker pset1 - "Bad Credit"
View credit.c
#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 Jun 8, 2016
CS50 pset3 - "Game of Fifteen" - Linear Search Algorithm
View helpers.c
/**
* helpers.c
*
* Computer Science 50
* Problem Set 3
*
* Helper functions for Problem Set 3.
*/
#include <cs50.h>
@CraigRodrigues
CraigRodrigues / helpers2.c
Last active Jun 10, 2016
CS50 pset3 - "Game of Fifteen" - Helpers - Insertion Sort & Binary Search (Recursion)
View helpers2.c
/**
* helpers.c
*
* Computer Science 50
* Problem Set 3
*
* Helper functions for Problem Set 3.
*/
#include <cs50.h>
@CraigRodrigues
CraigRodrigues / fifteen.c
Created Jun 10, 2016
CS50 pset3 - "Game of Fifteen"
View fifteen.c
/**
* fifteen.c
*
* Computer Science 50
* Problem Set 3
*
* Implements Game of Fifteen (generalized to d x d).
*
* Usage: fifteen d
*
You can’t perform that action at this time.