Instantly share code, notes, and snippets.

# jmichalenko

Created May 12, 2024 13:20
starter code for monte hall project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 //monte_hall.c //Monte Hall Problem is adapted from Rosetta Code // Content is available under GNU Free Documentation License 1.2 unless otherwise noted. #include #include #include #define GAMES 3000000
Created May 12, 2024 13:17
starter code for simulate.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 //simulate.c /** * At University High School, 80% of the students are expected to get at * least a 4 on their APCSP exam. The program below is intended to * simulate this result with n students, and display the number * of students who received a 4 or a 5. **/ #include
Created May 12, 2024 13:14
starter code for binarysearch lab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 // implement binary search function #include #include #define NUMBERS 9 bool bin_search(int value, int values[], int size); int main(void)
Created May 12, 2024 13:11
starter code for insertion lab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 // complete the insertion_sort function #include #include // function prototypes void insertion_sort(int arr[], int n); void print_array(int arr[], int n); // size of array
Created May 12, 2024 13:07
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 // complete the selection_sort function #include #include // function prototypes void selection_sort(int arr[], int size); void print_array(int arr[], int size); // size of array
Created May 12, 2024 13:02
bubble sort starter code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 // complete the bubble_sort function #include #include // function prototypes void bubble_sort(int arr[], int size); void print_array(int arr[], int size); // size of array
Created March 18, 2024 23:59
CS50 Labs starter code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 #include #include int main (void) { //To Do: Write a function to prompt the user for numberA and numberB //To Do: Write a function to return the product of numberA and numberB. "The product of the number is: " //After you are able to write the function and compile the program, make a header file and move the function protopye and definition here //Add the include statement at the top of the file
Created March 18, 2024 23:57
CS50 Labs starter code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 #include #include #include #define BASE 2 // returns true if binary, false if not binary bool check_binary(int b) { while (b > 0)
Created March 18, 2024 23:54
CS50 Labs starter code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 #include #include #include int main(void) { // get a string named plaintext string plaintext = get_string("plaintext: "); // output the string
Created March 18, 2024 23:51
CS50 Labs starter code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 #include #include int main(int argc, string argv[]) { if (argc != 3) { printf("Usage: ./exit \n"); } else