Skip to content

Instantly share code, notes, and snippets.

View chap3.4
#include <cs50.h>
#include <stdio.h>
// function prototypes
void insertion_sort(int arr[], int n);
void print_array(int arr[], int n);
// size of array
#define SIZE 10
View chap3.3
#include <cs50.h>
#include <stdio.h>
// function prototypes
void selection_sort(int arr[], int size);
void print_array(int arr[], int size);
// size of array
#define SIZE 10
View chap3.1
#include <cs50.h>
#include <stdio.h>
// function prototypes
void bubble_sort(int arr[], int size);
void print_array(int arr[], int size);
// size of array
#define SIZE 10
View chap3.1
#include <cs50.h>
#include <stdio.h>
#define NUMBERS_ON_CARD 24
// function prototype
bool linear_search(int arr[], int n, int size);
// Numbers on bingo card
int bingo_card[] = {7, 14, 4, 9, 6, 26, 22, 24, 20, 28, 40, 34, 36, 35, 58, 55, 46, 52, 49, 73, 68, 72, 74, 64};
View Caesar
#include <stdio.h>
#include <cs50.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
int main(int argc, string argv[])
{
if (argc != 2)
View chap2.7
#include<stdio.h>
#include<cs50.h>
#include "multiplication.h"
int main(void)
{
//To Do: Write a function to prompt the user for numberA and numberB
int A = get_int(":");
int B = get_int(":");
//To Do: Write a function to return the product of numberA and numberB. "The product of the number is: "
View chap2.6
#include <stdio.h>
#include <cs50.h>
#include <math.h>
#define BASE 2
// returns true if binary, false if not binary
bool check_binary(int b)
{
while (b > 0)
View chap2.5
#include <cs50.h>
#include <stdio.h>
#include <string.h>
int main(void)
{
// get a string named plaintext
string plaintext = get_string("plaintext: ");
View chap2.4
#include <cs50.h>
#include <stdio.h>
int main(int argc, string argv[])
{
if (argc != 3)
{
printf("Usage: ./exit <firstname> <lastname>\n");
return 1;
}
View chap2.3
#include <cs50.h>
#include <stdio.h>
int main(int argc, string argv[])
{
if (argc != 2)
{
printf("You need to provide the name in the command line.\n");
return 1;