This file contains hidden or 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
| SCENARIO( "vectors can be sized and resized", "[vector]" ) { | |
| GIVEN( "A vector with some items" ) { | |
| std::vector<int> v( 5 ); | |
| REQUIRE( v.size() == 5 ); | |
| REQUIRE( v.capacity() >= 5 ); | |
| WHEN( "the size is increased" ) { | |
| v.resize( 10 ); |
This file contains hidden or 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
| TEST_CASE( "vectors can be sized and resized", "[vector]" ) { | |
| std::vector<int> v( 5 ); | |
| REQUIRE( v.size() == 5 ); | |
| REQUIRE( v.capacity() >= 5 ); | |
| SECTION( "resizing bigger changes size and capacity" ) { | |
| v.resize( 10 ); |
This file contains hidden or 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
| #define CATCH_CONFIG_MAIN | |
| #include "catch.hpp" | |
| #include <vector> | |
| #include "../include/binary_search.hpp" | |
| std::vector<int> arr = {10,20,30,40,50,60,70,80,90,100}; | |
| TEST_CASE("Testing Binary Search") { | |
| // testing for existing terms |
This file contains hidden or 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 <vector> | |
| #include "../include/binary_search.hpp" | |
| int binary_search(std::vector<int> array, int x){ | |
| int l = 0; | |
| int r = array.size() - 1; | |
| while (l <= r) { | |
| int m = (l + r) / 2; | |
This file contains hidden or 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
| import pyautogui | |
| import time | |
| msg = input("Enter the message: ") | |
| n = input("How many times ?: ") | |
| print("t minus") | |
| count = 5 | |
| while(count != 0): |
This file contains hidden or 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 <stdio.h> | |
| #include <string.h> | |
| #include <stdlib.h> | |
| char atbash_encrypt(char input){ | |
| if(input == ' '){ | |
| return ' '; | |
| } | |
| char small_letters[26] = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'}; |
This file contains hidden or 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 <iostream> | |
| #include <vector> | |
| #include <cstring> | |
| using namespace std; | |
| vector<int> parse_string_to_int(string input,const char* t){ // "1,2,3" => [1,2,3] | |
| char array[input.length()+1]; | |
| strcpy(array, input.c_str()); // converting the string into a char[] |
NewerOlder