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/80d95db3aeb0de7d181440ce47f32a36 | |
// Filename cpsc120_animated_image.cc | |
// CompileCommand clang++ -std=c++17 -I /usr/include/GraphicsMagick cpsc120_animated_image.cc -lGraphicsMagick++ -lGraphicsMagick | |
// 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 cpsc120_animated_image.cc -lGraphicsMagick++ -lGraphicsMagick | |
// ./a.out my_image.jpg |
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/9218c947894149cabdebadb1a1083000 | |
// Filename cpsc120_fancy_image.cc | |
// CompileCommand clang++ -std=c++17 -I /usr/include/GraphicsMagick -lGraphicsMagick++ cpsc120_fancy_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++ cpsc120_fancy_image.cc | |
// ./a.out my_image.jpg |
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/c60dcd64a98e664c6d75115e7f57fe41 | |
// Filename cpsc120_image_with_text.cc | |
// CompileCommand clang++ -std=c++17 -I /usr/include/GraphicsMagick -lGraphicsMagick++ cpsc120_image_with_text | |
// 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++ cpsc120_image_with_text |
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/7dfcb98e197573a97b0766d48af7a6d2 | |
// Filename cpsc120_food_class.cc | |
// CompileCommand clang++ -std=c++17 cpsc120_food_class.cc | |
// Create a vector of objects. The object has multiple data members. | |
#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/mshafae/759d0d17b0bb03873516dcc9e16f5dca | |
// Filename cpsc120_2D_vector_pt2.cpp | |
// CompileCommand clang++ -std=c++17 cpsc120_2D_vector_pt2.cpp | |
// Create a vector of vectors, the inner vectors contain strings | |
// Note that C++ is row major order. | |
#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/mshafae/ff7818bd3514ad0539e90b5d2f8933b3 | |
// Filename cpsc120_vector.cc | |
// CompileCommand clang++ -std=c++17 cpsc120_vector.cc | |
// Working with C++ vectors. | |
#include <iostream> | |
#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/mshafae/eb239941e0171dcf564d91a3f75c64a7 | |
// Filename cpsc120_2D_vector.cpp | |
// CompileCommand clang++ -std=c++17 cpsc120_2D_vector.cpp | |
// Create a vector of vectors, the inner vectors contain strings | |
// Note that C++ is row major order. | |
#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/mshafae/4d282935ea5deaf8c2e6aca83a9fcac8 | |
// Filename cpsc120_filelines_to_vector.cc | |
// CompileCommand clang++ -std=c++17 cpsc120_filelines_to_vector | |
// Read a file line by line and place contents into a std::vector | |
#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/mshafae/4d282935ea5deaf8c2e6aca83a9fcac8 | |
// Filename cpsc120_filelines_to_vector.cc | |
// CompileCommand clang++ -std=c++17 cpsc120_filelines_to_vector.cc | |
// Read a file line by line and place contents into a std::vector | |
#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/mshafae/77d3cda92a90746210f3224c1cf83555 | |
// Filename cpsc120_double_comparison.cc | |
// CompileCommand clang++ -std=c++17 cpsc120_double_comparison.cc | |
// Demonstrating how doubles are approximating Real numbers and how direct | |
// comparison must be avoided. | |
#include <iomanip> | |
#include <iostream> | |
// lhs stands for "left hand side" |