Quotes.cpp 2.64 KB
Newer Older
Noah Olsen's avatar
commit  
Noah Olsen committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
/*************************************************************************
 *
 * Homework 4:  Exploring continuous deployment.
 *
 * File Name: quote.cpp
 * Course:    CPTR 245
 *
 */

#include "Quotes.h"
#include <random>
#include <string>
#include <vector>

Quotes::Quotes(unsigned int seed) {
    this->seed = seed;

    quotes = {
        {"Andrew Platner", "", ""},
        {"Austin Garner",
         "Men talk of killing time, while time quietly kills them.",
         "Dion Boucicault"},
        {"Cameron Bierwagen", "", ""},
        {"Elon Bontemps",
         "True humility is not thinking less of yourself; it is thinking of "
         "yourself less",
         "C.S. Lewis"},
        {"Ivan Guillen",
         "Logic will get you from A to B. Imagination will take you "
         "everywhere.",
         "Albert Einstein"},
        {"James Foster",
         "The most disastrous thing that you can ever learn is your first "
         "programming language.",
         "Alan Kay"},
        {"Jarod Owen", "I do not fear computers. I fear lack of them.",
         "Isaac Asimov"},
        {"Jeff Peters", "God does not play dice with the universe.",
         "A. Einstein"},
        {"Kaelan Willauer",
         "Action without a name, a 'who' attached to it, is meaningless.",
         "St. Jerome"},
        {"Luke Hagan", "", ""},
        {"Luke Irvine",
         "Life is what happens when you're busy making other plans.", "Lennon"},
        {"Michael Stacy",
         "Measuring programming progress by number of lines "
         "is like measuring aircraft build process by the weight",
         "anonymous author"},
        {"Nelson Phillips", "Ogres are like onions, they have layers", "Shrek"},
        {"Noah Olsen", "The greatest teacher, failure is", "Master Yoda"},
        {"Owen Hoffman", "", ""},
        {"Welcome! Please select a menu option.", "Talk is cheap. Show me the code.",
         "Linus Torvalds"},
        {"Samuel Nguyen", "", ""},
        {"Trevor Claridge",
         "Its easy to make frends if you let pepul laff at you.",
         "Daniel Keyes"},
        {"Trevor Natiuk",
         "Before you marry a person, you should first make "
         "them use a computer with slow Internet to see who they really are",
         "Will Ferrell"},
        {"Will Hensel",
         "The question of whether a computer can think is no more "
         "interesting than the question of whether a submaring can swim.",
         "Edsger W. Dijkstra"},
    };
}

Quote Quotes::getRandomQuote() {
    int index = rand_r(&seed) % quotes.size();
    return quotes.at(index);
}

Quote Quotes::getQuote(int id) {
    int index = id % quotes.size();
    return quotes.at(index);
}