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
// Gist https://gist.github.com/440681ee258659c96d40eb9eb60b14e5 | |
#include <iostream> | |
#include <string> | |
const int kThisYear{2022}; | |
int main(int argc, char const *argv[]) { | |
int your_birth_year{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
// Gist https://gist.github.com/ed20598a5ccf74be58e34a18e3379ff0 | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
int main(int argc, char const* argv[]) { | |
std::vector<std::string> command_line_arguments{argv, argv + argc}; | |
std::cout << "There are " << argc << " arguments on the command line.\n"; |
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
// Gist https://gist.github.com/8bde313d4a8d491c0229ed30fdad0bc7 | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
int main(int argc, char const* argv[]) { | |
std::vector<std::string> command_line_arguments{argv, argv + argc}; | |
if (command_line_arguments.size() < 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
// Gist https://gist.github.com/29e77a62a20852cb0925aeb5ab840a77 | |
#include <array> | |
#include <iostream> | |
using namespace std; | |
int main(int argc, char const* argv[]) { | |
std::array<int, 5> even_numbers{2, 4, 6, 8, 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
// Gist https://gist.github.com/d8488f24f51eaf25e2213d5091927253 | |
#include <iostream> | |
#include <vector> | |
#include <string> | |
int main(int argc, char const *argv[]) { | |
std::vector<std::string> arguments = std::vector<std::string>(argv, argv + argc); | |
for(const std::string& arg : arguments){ |
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
{ | |
// Place your snippets for cpp here. Each snippet is defined under a snippet name and has a prefix, body and | |
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the | |
// same ids are connected. | |
// Example: | |
// "Print to console": { | |
// "prefix": "log", | |
// "body": [ | |
// "console.log('$1');", |
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
// Gist https://gist.github.com/83a91cafc678eaf64db6f3ac7d6e5438 | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
int main(int argc, char const *argv[]) { | |
std::vector<std::string> arguments = | |
std::vector<std::string>{argv, argv + argc}; |
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
// Gist https://gist.github.com/7323b58b786d7db312a39ab8b0373413 | |
#include <array> | |
#include <iostream> | |
#include <string> | |
int main(int argc, char const* argv[]) { | |
std::array<int, 5> my_array{11, 12, 13, 14, 15}; | |
// Does not change the values in the array |
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
// Gist https://gist.github.com/268280c9d47f4388b5a74ad22b735cd2 | |
#include <iostream> | |
const int kMax = 5; | |
int main(int argc, char const *argv[]) { | |
std::cout << "Counting to " << kMax << " with a for loop.\n"; | |
for (int counter = 0; counter < kMax; counter++) { |
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
// Gist https://gist.github.com/450b2211f29cc7cae4735833f96bdedb | |
#include <iostream> | |
int main(int argc, char const *argv[]) { | |
std::cout << "Enter a number between 10 and 20: "; | |
int input_number{0}; | |
std::cin >> input_number; | |
while (input_number < 10 || input_number > 20) { |