Skip to content

Instantly share code, notes, and snippets.

View ThatOneCubanDude's full-sized avatar

ThatOneCubanDude

View GitHub Profile
@ThatOneCubanDude
ThatOneCubanDude / hello.c
Created March 26, 2020 22:43
My solution to CS50x Problem Set 1 - Hello. Feel free to critique.
#include <stdio.h>
#include <cs50.h>
int main(void)
{
printf("hello, %s\n", get_string("What is your name?\n"));
}
@ThatOneCubanDude
ThatOneCubanDude / mario_less_comfortable.c
Created March 26, 2020 22:46
My solution to CS50x Problem Set 1 - Mario(less comfortable). Feel free to critique or ask questions.
#include <cs50.h>
#include <stdio.h>
//mentions function "get_height" so we can use it later on
int get_height(string prompt);
//main code
int main(void)
{
int n = get_height("Height: ");
@ThatOneCubanDude
ThatOneCubanDude / mario_more_comfortable.c
Created March 26, 2020 22:47
My solution to CS50x Problem Set 1 - Mario(more comfortable). Feel free to critique or ask questions.
#include <cs50.h>
#include <stdio.h>
//mentions function "get_height" so we can use it later on
int get_height(string prompt);
//main code
int main(void)
{
int n = get_height("Height: ");
@ThatOneCubanDude
ThatOneCubanDude / cash.c
Created March 26, 2020 22:51
My solution to CS50x Problem Set 1 - Cash. Feel free to critique or ask questions.
#include <stdio.h>
#include <cs50.h>
#include <math.h>
float get_positive_float(void);
int main(void)
{
//creates variable "change" (amount of cents due) and varable "coins" (the amount of coins to be given out)
float change = round(get_positive_float() * 100);
@ThatOneCubanDude
ThatOneCubanDude / credit.c
Created March 26, 2020 22:53
My solution to CS50x Problem Set 1 - Credit. Feel free to critique or ask questions.
#include <stdio.h>
#include <cs50.h>
#include <math.h>
int main(void)
{
//gets a valid number from the user
long long int credit_card;
do
{
@ThatOneCubanDude
ThatOneCubanDude / readability.c
Created March 26, 2020 22:55
My solution to CS50x Problem Set 2 - Readability. Feel free to critique or ask questions.
#include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
int main(void)
{
// gets text input from user
string text = get_string("Text: ");
@ThatOneCubanDude
ThatOneCubanDude / caesar.c
Created March 26, 2020 22:56
My solution to CS50x Problem Set 2 - Caesar. Feel free to critique or ask questions.
#include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
int main(int argc, string argv[])
{
//checks if user input exactly 1 command line argument, if not prints out error message
@ThatOneCubanDude
ThatOneCubanDude / substitution.c
Created March 26, 2020 22:57
My solution to CS50x Problem Set 2 - Substitution. Feel free to critique or ask questions.
#include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
int main(int argc, string argv[])
{
//checks if user has inputed a command line argument, if not returns error message
if (argc == 2)