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/746e191172af461f09f7b06bbebd3680 | |
#include <array> | |
#include <iostream> | |
#include <string> | |
int main(int argc, char const* argv[]) { | |
std::array<int, 6> my_array{10, 11, 12, 13, 14, 15}; | |
bool should_skip_first{true}; |
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/30ad98e4ca6f0aa45db9e9a31c5625af | |
// Filename cpsc120_write_message.cc | |
// CompileCommand clang++ -std=c++17 cpsc120_write_message.cc | |
// Read a line of text from cin and then write the line out to a file | |
#include <fstream> | |
#include <iostream> | |
#include <string> | |
#include <vector> |
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/f6a5ebf19ad736a3bdcf28be34b84cc4 | |
// To try out this program, you don't need to have a folder full of JPEG images. | |
// Do the following from from the command line to create some sample data to | |
// demonstrate how this program works. | |
// $ mkdir sample_data | |
// $ cd sample_data | |
// $ touch blue.jpeg red.jpeg yellow.jpeg orange.jpeg green.jpeg purple.jpeg | |
// $ cd .. |
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
#!/bin/bash | |
# Gist https://gist.github.com/5618d1816364893ce9236d5d50272aa2 | |
backup_file () | |
{ | |
DATE=`date +"%Y%m%d-%S"` | |
NAME=${1} | |
NEWNAME=${NAME}-${DATE}.og | |
echo "Copying ${NAME} to ${NEWNAME}" |
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/36392c28705f3b62dda5d99d1db340b3 | |
#include <algorithm> | |
#include <iostream> | |
#include <iterator> | |
#include <string> | |
#include <vector> | |
int main(int argc, char const *argv[]) { |
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/697c2c169ebd5cdef9a3eb7d8c0bee1e | |
#include <array> | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
int main(int argc, char const *argv[]) { | |
std::vector<std::string> arguments{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/e319fd4912f979828fc7aca6a714820d | |
#include <iostream> | |
#include <string> | |
int main(int argc, char const* argv[]) { | |
std::string a_big_number{"65536"}; | |
int the_integer_value{-1}; | |
try { |
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/mshafae/1e50f814b084f19af6a702ba8f1b9d6d | |
// Filename cpsc120_image.cc | |
// CompileCommand clang++ -std=c++17 -I /usr/include/GraphicsMagick -lGraphicsMagick++ cpsc120_image.cc | |
// Create a simple, small image from a given | |
// filename. GraphicsMagick will figure out how to output to the given file | |
// format. | |
// Supported formats: http://www.graphicsmagick.org/formats.html | |
// Example: | |
// clang++ -std=c++17 -I /usr/include/GraphicsMagick -lGraphicsMagick++ |
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
// cpsc120_prompt.cc | |
// Gist https://gist.github.com/70457715ff7fc2fcdcdaf44437624dd0 | |
#include <iostream> | |
#include <string> | |
std::string PromptForString(std::string query) { | |
std::cout << query; | |
std::string answer; | |
std::cin >> answer; |
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/70457715ff7fc2fcdcdaf44437624dd0 | |
#include <iostream> | |
#include <string> | |
std::string PromptForString(std::string query) { | |
std::cout << query; | |
std::string answer; | |
std::cin >> answer; | |
return answer; |