├── .gitignore
├── 1-hello-world
├── art
│ ├── bjarne.gif
│ ├── bjarne2.gif
│ ├── compiler.png
│ ├── file-name.png
│ ├── files1.png
│ ├── files2.png
│ ├── folder-icon.png
│ ├── folder-icon.svg
│ ├── process-quiz.png
│ ├── process.gif
│ ├── process.svg
│ ├── program-structure.png
│ ├── terminal.png
│ └── xkcd-compiling.png
├── block-letters
│ ├── block-letters-hint.png
│ ├── block-letters.png
│ ├── codecademy.cpp
│ ├── daftpunk.cpp
│ ├── initials.cpp
│ └── snowman.cpp
├── hello.cpp
├── letter.cpp
├── pattern.cpp
└── spell.cpp
├── 2-variables
├── art
│ ├── data-types.gif
│ └── declare-intialize.png
├── bmi.cpp
├── dog-years
│ ├── dog.gif
│ ├── dog_years1.cpp
│ ├── dog_years2.cpp
│ └── snoop_dog.cpp
├── piggy-bank
│ ├── Oct-31-2018 19-08-11.gif
│ ├── currency.cpp
│ ├── currency2.cpp
│ ├── flag-for-el-salvador.png
│ ├── flag-for-guatemala.png
│ ├── flag-for-mexico.png
│ ├── piggy-bank.gif
│ ├── piggy-bank2.gif
│ └── piggybank.gif
├── quadratic-formula
│ ├── graph.gif
│ ├── quadratic-formula.png
│ └── quadratic.cpp
├── temperature1.cpp
└── temperature2.cpp
├── 3-conditionals-and-logic
├── coinflip.cpp
├── coinflip.gif
├── coinflip1.gif
├── grade.cpp
├── harry-potter-sorting-hat
│ ├── harrypotter.gif
│ ├── points.gif
│ ├── sombreroseleccionador.cpp
│ └── sortinghat.cpp
├── leap_year.cpp
├── logical-operators.gif
├── magic-8-ball
│ ├── magic8.cpp
│ ├── magic8_switch.cpp
│ └── magic8ball.gif
├── metrocard.cpp
├── pH.cpp
├── pokedex.cpp
├── rock-paper-scissors-lizard-spock
│ ├── RPS.cpp
│ ├── RPSLS.cpp
│ ├── RPSLS.gif
│ ├── RPSLS_if.cpp
│ ├── RPSLS_switch.cpp
│ ├── RPSLS_switch_scores.cpp
│ └── rpsls_new
├── space.cpp
└── streetsign.gif
├── 4-loops
├── 99bottles.cpp
├── art
│ ├── bug.gif
│ ├── bug.jpg
│ ├── circle.png
│ ├── compile-time-error-hint.png
│ ├── compile-time-error.png
│ ├── link-time-error-hint.png
│ ├── link-time-error.png
│ ├── run-time-error.png
│ └── troublemaker.png
├── enter_pin.cpp
├── fizzbuzz
│ ├── fizzbuzz.cpp
│ ├── fizzbuzz.gif
│ └── fizzbuzz3.cpp
├── guess.cpp
├── square.cpp
└── troublemaker.cpp
├── 5-vectors
├── art
│ ├── 11235.gif
│ └── size.png
├── oddeven.cpp
└── whale.cpp
├── 6-functions
├── a.out
├── ufo.cpp
├── ufo_functions.cpp
└── ufo_functions.hpp
├── 7-classes-and-objects
├── app.cpp
├── profile.cpp
└── profile.hpp
├── 8-references-and-pointers
├── bleep
│ ├── bleep.cpp
│ ├── functions.cpp
│ └── functions.hpp
├── memory.gif
├── pointers.cpp
├── pointers.png
└── pointers_big.png
├── README.md
├── blogs
├── belllabs.jpeg
├── bjarne_stroustrup.jpeg
├── simon_brand.png
├── simon_brand.sketch
├── stackoverflow1.png
├── stackoverflow2.png
├── stackoverflow3.png
├── stackoverflow4.png
└── stackoverflow5.png
├── challenge-projects
└── tic-tac-toe
│ ├── play.cpp
│ ├── play.hpp
│ └── ttt.cpp
├── cheatsheets
├── cheatsheet1.pdf
└── cheatsheet2.pdf
├── community-challenge
├── May-24-2019 11-28-25.gif
├── README.md
├── gif.gif
├── highfive.gif
├── prizes.png
└── project-ideas.md
├── logo.png
└── other
├── Screen Shot 2019-02-01 at 1.28.26 PM.png
├── Screen Shot 2019-02-01 at 1.28.36 PM.png
├── Screen Shot 2019-02-05 at 6.09.25 PM.png
├── Screen Shot 2019-02-13 at 12.34.27 PM.png
├── Screen Shot 2019-02-13 at 12.34.32 PM.png
├── Screen Shot 2019-02-13 at 12.34.37 PM.png
├── Screen Shot 2019-02-13 at 12.40.08 PM.png
├── Screen Shot 2019-02-13 at 12.40.13 PM.png
├── Screen Shot 2019-02-14 at 1.49.31 PM.png
└── location.png
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | .DS_Store
3 |
--------------------------------------------------------------------------------
/1-hello-world/art/bjarne.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/1-hello-world/art/bjarne.gif
--------------------------------------------------------------------------------
/1-hello-world/art/bjarne2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/1-hello-world/art/bjarne2.gif
--------------------------------------------------------------------------------
/1-hello-world/art/compiler.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/1-hello-world/art/compiler.png
--------------------------------------------------------------------------------
/1-hello-world/art/file-name.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/1-hello-world/art/file-name.png
--------------------------------------------------------------------------------
/1-hello-world/art/files1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/1-hello-world/art/files1.png
--------------------------------------------------------------------------------
/1-hello-world/art/files2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/1-hello-world/art/files2.png
--------------------------------------------------------------------------------
/1-hello-world/art/folder-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/1-hello-world/art/folder-icon.png
--------------------------------------------------------------------------------
/1-hello-world/art/folder-icon.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
--------------------------------------------------------------------------------
/1-hello-world/art/process-quiz.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/1-hello-world/art/process-quiz.png
--------------------------------------------------------------------------------
/1-hello-world/art/process.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/1-hello-world/art/process.gif
--------------------------------------------------------------------------------
/1-hello-world/art/process.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
203 |
--------------------------------------------------------------------------------
/1-hello-world/art/program-structure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/1-hello-world/art/program-structure.png
--------------------------------------------------------------------------------
/1-hello-world/art/terminal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/1-hello-world/art/terminal.png
--------------------------------------------------------------------------------
/1-hello-world/art/xkcd-compiling.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/1-hello-world/art/xkcd-compiling.png
--------------------------------------------------------------------------------
/1-hello-world/block-letters/block-letters-hint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/1-hello-world/block-letters/block-letters-hint.png
--------------------------------------------------------------------------------
/1-hello-world/block-letters/block-letters.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/1-hello-world/block-letters/block-letters.png
--------------------------------------------------------------------------------
/1-hello-world/block-letters/codecademy.cpp:
--------------------------------------------------------------------------------
1 | // Fun Fact: Artichokes are my favorite vegetable.
2 | // Twitter: @JoannaMathes
3 |
4 | #include
5 |
6 | int main() {
7 |
8 | std::cout << " __________________ \n";
9 | std::cout << " | |______________| | \n";
10 | std::cout << " | | | | \n";
11 | std::cout << " | | | | \n";
12 | std::cout << " | | | | \n";
13 | std::cout << " | | XXXXX | | \n";
14 | std::cout << " | | XX X | | \n";
15 | std::cout << " | | X | | \n";
16 | std::cout << " | | X | | \n";
17 | std::cout << " | | X | | \n";
18 | std::cout << " | | XX X | | \n";
19 | std::cout << " | | XXXXX | | \n";
20 | std::cout << " | | | | ========== \n";
21 | std::cout << " | |--------------| | | | \n";
22 | std::cout << " |__________________| ========== \n";
23 |
24 | return 0;
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/1-hello-world/block-letters/daftpunk.cpp:
--------------------------------------------------------------------------------
1 | // Fun Fact: I am not very interesting.
2 | // GitHub: @TheGiraffe
3 |
4 | #include
5 |
6 | int main() {
7 |
8 | std::cout << "DDDD IIIII GGG IIIII TTTTT A L \n";
9 | std::cout << "D D I G G I T A A L \n";
10 | std::cout << "D D I G I T A A L \n";
11 | std::cout << "D D I G GGG I T AAAAA L \n";
12 | std::cout << "D D I G G I T A A L \n";
13 | std::cout << "D D I G G I T A A L \n";
14 | std::cout << "DDDD IIIII GGG IIIII T A A LLLLL \n";
15 | std::cout << " L OOO V V EEEEE \n";
16 | std::cout << " L O O V V E \n";
17 | std::cout << " L O O V V E \n";
18 | std::cout << " L O O V V EEE \n";
19 | std::cout << " L O O V V E \n";
20 | std::cout << " L O O V V E \n";
21 | std::cout << " LLLLL OOO V EEEEE \n";
22 | std::cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
23 | std::cout << " ####### ####### \n";
24 | std::cout << " ########## ########## \n";
25 | std::cout << " ###################### \n";
26 | std::cout << " #################### \n";
27 | std::cout << " ################## \n";
28 | std::cout << " ############ \n";
29 | std::cout << " ######## \n";
30 | std::cout << " ## \n";
31 | std::cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n";
32 | std::cout << "DDDD A FFFFF TTTTT \n";
33 | std::cout << "D D A A F T \n";
34 | std::cout << "D D A A F T \n";
35 | std::cout << "D D AAAAA FFF T \n";
36 | std::cout << "D D A A F T \n";
37 | std::cout << "D D A A F T \n";
38 | std::cout << "DDDD A A F T \n";
39 | std::cout << " PPPP U U N N K K \n";
40 | std::cout << " P P U U NN N K K \n";
41 | std::cout << " P P U U N N N K K \n";
42 | std::cout << " PPPP U U N NN KK \n";
43 | std::cout << " P U U N N K K \n";
44 | std::cout << " P U U N N K K \n";
45 | std::cout << " P UUU N N K K \n";
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/1-hello-world/block-letters/initials.cpp:
--------------------------------------------------------------------------------
1 | // Sonny Li
2 | // Fun Fact: I played guitar in a band called Attica.
3 |
4 | #include
5 |
6 | int main() {
7 |
8 | std::cout << " SSS L \n";
9 | std::cout << " S S L \n";
10 | std::cout << " S L \n";
11 | std::cout << " SSS L \n";
12 | std::cout << " S L \n";
13 | std::cout << " S S L \n";
14 | std::cout << " SSS LLLLL \n";
15 |
16 | return 0;
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/1-hello-world/block-letters/snowman.cpp:
--------------------------------------------------------------------------------
1 | // Fun Fact: I drink a looot of water.
2 | // Twitter: @anne_melody
3 |
4 | #include
5 |
6 | int main() {
7 |
8 | std::cout << " * * \n";
9 | std::cout << "* * \n";
10 | std::cout << " * * * \n";
11 | std::cout << " * * \n";
12 | std::cout << " * \n";
13 | std::cout << "* * * \n";
14 | std::cout << " * * * \n";
15 | std::cout << " HHHHHHH * \n";
16 | std::cout << " * HHHHHHH \n";
17 | std::cout << " * HHHHHHHHHHH * * \n";
18 | std::cout << " * @ @ * \n";
19 | std::cout << " * ^ * \n";
20 | std::cout << " * * * * \n";
21 | std::cout << " SSS * * S \n";
22 | std::cout << " * SSSSSSSS * \n";
23 | std::cout << " * O SS * \n";
24 | std::cout << " * O S * \n";
25 | std::cout << " * O * \n";
26 | std::cout << " * * \n";
27 | std::cout << " * * * \n";
28 |
29 | return 0;
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/1-hello-world/hello.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 |
5 | std::cout << "Hello World!\n";
6 |
7 | return 0;
8 |
9 | }
10 |
--------------------------------------------------------------------------------
/1-hello-world/letter.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 |
5 | std::cout << "Dear Self, \n";
6 | std::cout << " \n";
7 | std::cout << "I will build a VR app.\n";
8 | std::cout << " \n";
9 | std::cout << " - Sonny\n";
10 |
11 | return 0;
12 |
13 | }
--------------------------------------------------------------------------------
/1-hello-world/pattern.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 |
5 | std::cout << " 1\n";
6 | std::cout << " 2 3\n";
7 | std::cout << " 4 5 6\n";
8 | std::cout << "7 8 9 10\n";
9 |
10 | return 0;
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/1-hello-world/spell.cpp:
--------------------------------------------------------------------------------
1 | // Harry Potter spell
2 |
3 | #include
4 |
5 | int main() {
6 |
7 | std::cout << "Expecto Patronum\n";
8 |
9 | return 0;
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/2-variables/art/data-types.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/2-variables/art/data-types.gif
--------------------------------------------------------------------------------
/2-variables/art/declare-intialize.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/2-variables/art/declare-intialize.png
--------------------------------------------------------------------------------
/2-variables/bmi.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 |
5 | double height, weight, bmi;
6 |
7 | std::cout << "Type in your height (m): ";
8 | std::cin >> height;
9 |
10 | std::cout << "Type in your weight (kg): ";
11 | std::cin >> weight;
12 |
13 | bmi = weight / (height * height);
14 |
15 | std::cout << "Your BMI is " << bmi << "\n";
16 |
17 | return 0;
18 |
19 | }
--------------------------------------------------------------------------------
/2-variables/dog-years/dog.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/2-variables/dog-years/dog.gif
--------------------------------------------------------------------------------
/2-variables/dog-years/dog_years1.cpp:
--------------------------------------------------------------------------------
1 | // Learn C++
2 | // Dog Years
3 |
4 | #include
5 |
6 | int main()
7 | {
8 |
9 | int dog_age = 3;
10 |
11 | int early_years, later_years, human_years;
12 |
13 | early_years = 21;
14 |
15 | later_years = (dog_age - 2) * 4;
16 |
17 | human_years = early_years + later_years;
18 |
19 | std::cout << "My name is Sparkles! Ruff Ruff, I am " << human_years << " years old in human years.\n";
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/2-variables/dog-years/dog_years2.cpp:
--------------------------------------------------------------------------------
1 | // Learn C++
2 | // Dog Years
3 |
4 | #include
5 |
6 | int main() {
7 |
8 | std::string dog_name;
9 | int dog_age;
10 |
11 | int early_years, later_years, human_years;
12 |
13 | std::cout << "Enter your dog's name: ";
14 | std::cin >> dog_name;
15 |
16 | std::cout << "Enter your dog's age: ";
17 | std::cin >> dog_age;
18 |
19 | early_years = 21;
20 |
21 | later_years = (dog_age - 2) * 4;
22 |
23 | human_years = early_years + later_years;
24 |
25 | std::cout << "My name is " << dog_name << "! Ruff Ruff, I am " << human_years << " years old in human years.\n";
26 |
27 | return 0;
28 |
29 | }
--------------------------------------------------------------------------------
/2-variables/dog-years/snoop_dog.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 |
5 | // Allow user to enter dog's name
6 | std::string dog_name;
7 | std::cout << "Enter your dog's name: ";
8 | std::cin >> dog_name;
9 |
10 | // Allow user to enter dog's age with decimal
11 | double dog_age;
12 | std::cout << "Enter your dog's age: ";
13 | std::cin >> dog_age;
14 |
15 | double early_years, later_years, human_years;
16 |
17 | // First two years
18 | early_years = 21;
19 |
20 | // Accounts for later years
21 | later_years = (dog_age - 2 ) * 4;
22 |
23 | // My logic for puppy math
24 | if (dog_age < 2) {
25 | early_years = (early_years / 2) * dog_age;
26 | later_years = 0;
27 | }
28 |
29 | human_years = later_years + early_years;
30 |
31 | std::cout << "\nMy name is " << dog_name << "! Ruff ruff, I am " << human_years << " years old in human years.\n";
32 | std::cout << "Bow wow wow yippie yo yippie yay\n";
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/2-variables/piggy-bank/Oct-31-2018 19-08-11.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/2-variables/piggy-bank/Oct-31-2018 19-08-11.gif
--------------------------------------------------------------------------------
/2-variables/piggy-bank/currency.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main()
4 | {
5 |
6 | double p;
7 | double q;
8 | double c;
9 |
10 | double dollars;
11 |
12 | std::cout << "🇲🇽 Enter number of Pesos: ";
13 | std::cin >> p;
14 |
15 | std::cout << "🇬🇹 Enter number of Guatemalan Quetzals: ";
16 | std::cin >> q;
17 |
18 | std::cout << "🇸🇻 Enter number of Salvadoran Colons: ";
19 | std::cin >> c;
20 |
21 | dollars = 0.049 * p + 0.1305 * q + 0.1144 * c;
22 |
23 | std::cout << "Total USD = $" << dollars << "\n";
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/2-variables/piggy-bank/currency2.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | // exchange rates sourced from https://www.fiscal.treasury.gov/reports-statements/treasury-reporting-rates-exchange/current.html
5 | int main() {
6 | double p;
7 | // peso rate = 19.6540
8 | double ep = 19.6540;
9 |
10 | double q;
11 | // quetzal rate = 7.7150
12 | double eq = 7.7150;
13 |
14 | double c;
15 | // colóns rate = 603.5000
16 | double ec = 603.5000;
17 |
18 | double dollars;
19 | std::cout << "Enter number of Mexican Pesos:";
20 | std::cin >> p;
21 | std::cout << "Enter number of quetzals:";
22 | std::cin >> q;
23 | std::cout << "Enter number of colóns:";
24 | std::cin >> c;
25 |
26 |
27 | // foriegn ammount / rate = usd
28 |
29 | dollars = (p/ep)+(q/eq)+(c/ec);
30 |
31 | std::cout << "US Dollars = $" << dollars << "\n";
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/2-variables/piggy-bank/flag-for-el-salvador.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/2-variables/piggy-bank/flag-for-el-salvador.png
--------------------------------------------------------------------------------
/2-variables/piggy-bank/flag-for-guatemala.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/2-variables/piggy-bank/flag-for-guatemala.png
--------------------------------------------------------------------------------
/2-variables/piggy-bank/flag-for-mexico.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/2-variables/piggy-bank/flag-for-mexico.png
--------------------------------------------------------------------------------
/2-variables/piggy-bank/piggy-bank.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/2-variables/piggy-bank/piggy-bank.gif
--------------------------------------------------------------------------------
/2-variables/piggy-bank/piggy-bank2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/2-variables/piggy-bank/piggy-bank2.gif
--------------------------------------------------------------------------------
/2-variables/piggy-bank/piggybank.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/2-variables/piggy-bank/piggybank.gif
--------------------------------------------------------------------------------
/2-variables/quadratic-formula/graph.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/2-variables/quadratic-formula/graph.gif
--------------------------------------------------------------------------------
/2-variables/quadratic-formula/quadratic-formula.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/2-variables/quadratic-formula/quadratic-formula.png
--------------------------------------------------------------------------------
/2-variables/quadratic-formula/quadratic.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | int main() {
5 |
6 | double a, b, c;
7 | double root1, root2;
8 |
9 | std::cout << "Enter a: ";
10 | std::cin >> a;
11 |
12 | std::cout << "Enter b: ";
13 | std::cin >> b;
14 |
15 | std::cout << "Enter c: ";
16 | std::cin >> c;
17 |
18 | root1 = (-b + std::sqrt(b*b - 4*a*c)) / (2*a);
19 | root2 = (-b - std::sqrt(b*b - 4*a*c)) / (2*a);
20 |
21 | std::cout << "Root 1 is " << root1 << "\n";
22 | std::cout << "Root 2 is " << root2 << "\n";
23 |
24 | return 0;
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/2-variables/temperature1.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 |
5 | double tempf = 83.0;
6 | double tempc;
7 |
8 | tempc = (tempf - 32) / 1.8;
9 |
10 | std::cout << "The temp is " << tempc << " degrees Celsius.\n";
11 |
12 | return 0;
13 |
14 | }
--------------------------------------------------------------------------------
/2-variables/temperature2.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 |
5 | double tempf;
6 | double tempc;
7 |
8 | // Ask the user
9 | std::cout << "Enter the temperature in Fahrenheit: ";
10 |
11 | std::cin >> tempf;
12 |
13 | tempc = (tempf - 32) / 1.8;
14 |
15 | std::cout << "The temp is " << tempc << " degrees Celsius.\n";
16 |
17 | return 0;
18 |
19 | }
--------------------------------------------------------------------------------
/3-conditionals-and-logic/coinflip.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | int main() {
6 |
7 | srand (time(NULL));
8 | int coin = rand() % 2;
9 |
10 | if (coin == 0) {
11 |
12 | std::cout << "Heads\n";
13 |
14 | } else {
15 |
16 | std::cout << "Tails\n";
17 |
18 | }
19 |
20 | return 0;
21 |
22 | }
--------------------------------------------------------------------------------
/3-conditionals-and-logic/coinflip.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/3-conditionals-and-logic/coinflip.gif
--------------------------------------------------------------------------------
/3-conditionals-and-logic/coinflip1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/3-conditionals-and-logic/coinflip1.gif
--------------------------------------------------------------------------------
/3-conditionals-and-logic/grade.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 |
5 | int grade = 59;
6 |
7 | if (grade >= 60) {
8 |
9 | std::cout << "Pass\n";
10 |
11 | } else {
12 |
13 | std::cout << "Fail\n";
14 |
15 | }
16 |
17 | return 0;
18 |
19 | }
--------------------------------------------------------------------------------
/3-conditionals-and-logic/harry-potter-sorting-hat/harrypotter.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/3-conditionals-and-logic/harry-potter-sorting-hat/harrypotter.gif
--------------------------------------------------------------------------------
/3-conditionals-and-logic/harry-potter-sorting-hat/points.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/3-conditionals-and-logic/harry-potter-sorting-hat/points.gif
--------------------------------------------------------------------------------
/3-conditionals-and-logic/harry-potter-sorting-hat/sombreroseleccionador.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 |
5 | // La magia empieza aquí
6 |
7 | int gryffindor = 0;
8 | int hufflepuff = 0;
9 | int ravenclaw = 0;
10 | int slytherin = 0;
11 |
12 | int respuesta1;
13 | int respuesta2;
14 | int respuesta3;
15 | int respuesta4;
16 |
17 | std::cout << "¡La prueba del sombrero seleccionador!\n";
18 |
19 | std::cout << "Q1) Cuando muera, quiero que la gente me recuerde como:\n";"\n";
20 |
21 | std::cout << "1) El bueno\n";
22 | std::cout << "2) El grande\n";
23 | std::cout << "3) El sabio\n";
24 | std::cout << "4) El valiente\n";
25 | std::cin >> respuesta1;
26 |
27 | if (respuesta1 ==1) {
28 | hufflepuff++;
29 | } else if (respuesta1==2){
30 | slytherin++;
31 | } else if (respuesta1==3){
32 | ravenclaw++;
33 | } else if (respuesta1==4){
34 | gryffindor++;
35 | }else
36 | std::cout << "Respuesta no válida\n";
37 |
38 | std::cout << "Q2) ¿Amanecer o Atardecer?\n";"\n";
39 |
40 | std::cout << "1) Amanecer\n";
41 | std::cout << "2) Atardecer\n";
42 | std::cin >> respuesta2;
43 |
44 | if (respuesta2 ==1) {
45 | gryffindor++;
46 | ravenclaw++;
47 | } else if (respuesta2==2){
48 | slytherin++;
49 | hufflepuff++;
50 | } else
51 | std::cout << "Respuesta no válida\n";
52 |
53 | std::cout << "Q3) ¿Qué tipo de instrumento satisface más a tu oído?\n";"\n";
54 |
55 | std::cout << "1) El violín\n";
56 | std::cout << "2) La trompeta\n";
57 | std::cout << "3) El piano\n";
58 | std::cout << "4) El tambor\n";
59 | std::cin >> respuesta3;
60 |
61 | if (respuesta3 ==1) {
62 | slytherin++;
63 | } else if (respuesta3==2){
64 | hufflepuff++;
65 | } else if (respuesta3==3){
66 | ravenclaw++;
67 | } else if (respuesta3==4){
68 | gryffindor++;
69 | }else
70 | std::cout << "Respuesta no válida\n";
71 |
72 | std::cout << "Q4) ¿Qué camino te tienta más?\n";"\n";
73 |
74 | std::cout << "1) La calle soleada y ancha cubierta de hierba\n";
75 | std::cout << "2) El callejón estrecho, oscuro, iluminado por linternas\n";
76 | std::cout << "3) El camino sinuoso del bosque cubierto de hojas\n";
77 | std::cout << "4) La calle adoquinada (edificios antiguos)\n";
78 | std::cin >> respuesta4;
79 |
80 | if (respuesta4 ==1) {
81 | hufflepuff++;
82 | } else if (respuesta4==2){
83 | slytherin++;
84 | } else if (respuesta4==3){
85 | gryffindor++;
86 | } else if (respuesta4==4){
87 | ravenclaw++;
88 | }else
89 | std::cout << "Respuesta no válida\n";
90 |
91 | // The code is fine until now, here it starts getting messy
92 |
93 | std::cout << "\nFelicitaciones por haber sido seleccionado en... ";
94 |
95 | int max = 0;
96 | std::string house;
97 |
98 | if (gryffindor > max)
99 | {
100 |
101 | max = gryffindor;
102 | house = "Gryffindor";
103 |
104 | }
105 |
106 | if (hufflepuff > max)
107 | {
108 |
109 | max = hufflepuff;
110 | house = "Hufflepuff";
111 |
112 | }
113 |
114 | if (ravenclaw > max)
115 | {
116 |
117 | max = ravenclaw;
118 | house = "Ravenclaw";
119 |
120 | }
121 |
122 | if (slytherin > max)
123 | {
124 |
125 | max = slytherin;
126 | house = "Slytherin";
127 |
128 | }
129 |
130 | std::cout << house << "!\n";
131 |
132 | return 0;
133 |
134 | }
135 |
--------------------------------------------------------------------------------
/3-conditionals-and-logic/harry-potter-sorting-hat/sortinghat.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 |
5 | int gryffindor = 0;
6 | int hufflepuff = 0;
7 | int ravenclaw = 0;
8 | int slytherin = 0;
9 |
10 | int answer1, answer2, answer3, answer4;
11 |
12 | std::cout << "===============\n";
13 | std::cout << "The Sorting Hat\n";
14 | std::cout << "===============\n\n";
15 |
16 | // ~~~~~~~~~~ Question 1 ~~~~~~~~~~
17 |
18 | std::cout << "Q1) When I'm dead, I want people to remember me as:\n\n";
19 |
20 | std::cout << " 1) The Good\n";
21 | std::cout << " 2) The Great\n";
22 | std::cout << " 3) The Wise\n";
23 | std::cout << " 4) The Bold\n\n";
24 |
25 | std::cout << "Enter your answer (1-4): ";
26 | std::cin >> answer1;
27 |
28 | if (answer1 == 1)
29 | hufflepuff++;
30 | else if (answer1 == 2)
31 | slytherin++;
32 | else if (answer1 == 3)
33 | ravenclaw++;
34 | else if (answer1 == 4)
35 | gryffindor++;
36 |
37 | // ~~~~~~~~~~ Question 2 ~~~~~~~~~~
38 |
39 | std::cout << "\nQ2) Dawn or Dusk?\n\n";
40 |
41 | std::cout << " 1) Dawn\n";
42 | std::cout << " 2) Dusk\n\n";
43 |
44 | std::cout << "Enter your answer (1-2): ";
45 | std::cin >> answer2;
46 |
47 | if (answer2 == 1)
48 | {
49 |
50 | gryffindor++;
51 | ravenclaw++;
52 |
53 | }
54 | else if (answer2 == 2)
55 | {
56 |
57 | hufflepuff++;
58 | slytherin++;
59 |
60 | }
61 | else
62 | {
63 |
64 | std::cout << "Invalid input\n";
65 |
66 | }
67 |
68 | // ~~~~~~~~~~ Question 3 ~~~~~~~~~~
69 |
70 | std::cout << "\nQ3) Which kind of instrument most pleases your ear?\n\n";
71 |
72 | std::cout << " 1) The violin\n";
73 | std::cout << " 2) The trumpet\n";
74 | std::cout << " 3) The piano\n";
75 | std::cout << " 4) The drum\n\n";
76 |
77 | std::cout << "Enter your answer (1-4): ";
78 | std::cin >> answer3;
79 |
80 | if (answer3 == 1)
81 | slytherin++;
82 | else if (answer3 == 2)
83 | hufflepuff++;
84 | else if (answer3 == 3)
85 | ravenclaw++;
86 | else if (answer3 == 4)
87 | gryffindor++;
88 |
89 | // ~~~~~~~~~~ Question 4 ~~~~~~~~~~
90 |
91 | std::cout << "\nQ4) Which road tempts you the most?\n\n";
92 |
93 | std::cout << " 1) The wide, sunny grassy lane\n";
94 | std::cout << " 2) The narrow, dark, lantern-lit alley\n";
95 | std::cout << " 3) The twisting, leaf-strewn path through woods\n";
96 | std::cout << " 4) The cobbled street lined (ancient buildings)\n\n";
97 |
98 | std::cout << "Enter your answer (1-4): ";
99 | std::cin >> answer4;
100 |
101 | if (answer4 == 1)
102 | hufflepuff++;
103 | else if (answer4 == 2)
104 | slytherin++;
105 | else if (answer4 == 3)
106 | gryffindor++;
107 | else if (answer4 == 4)
108 | ravenclaw++;
109 |
110 | // ========== Sorting ==========
111 |
112 | std::cout << "\nCongrats on being sorted into... ";
113 |
114 | int max = 0;
115 | std::string house;
116 |
117 | if (gryffindor > max)
118 | {
119 |
120 | max = gryffindor;
121 | house = "Gryffindor";
122 |
123 | }
124 |
125 | if (hufflepuff > max)
126 | {
127 |
128 | max = hufflepuff;
129 | house = "Hufflepuff";
130 |
131 | }
132 |
133 | if (ravenclaw > max)
134 | {
135 |
136 | max = ravenclaw;
137 | house = "Ravenclaw";
138 |
139 | }
140 |
141 | if (slytherin > max)
142 | {
143 |
144 | max = slytherin;
145 | house = "Slytherin";
146 |
147 | }
148 |
149 | std::cout << house << "!\n";
150 |
151 | return 0;
152 |
153 | }
154 |
--------------------------------------------------------------------------------
/3-conditionals-and-logic/leap_year.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 |
5 | int y = 0;
6 |
7 | std::cout << "Enter year: ";
8 | std::cin >> y;
9 |
10 | if (y < 0 || y > 9999) {
11 |
12 | std::cout << "Invalid entry.\n";
13 |
14 | }
15 | else if (y % 4 == 0 && y % 100 != 0 || y % 400 == 0) {
16 |
17 | std::cout << y << " falls on a leap year.\n";
18 |
19 | }
20 | else{
21 | std::cout << y << " Does not fall on a leap year.\n";
22 | }
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/3-conditionals-and-logic/logical-operators.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/3-conditionals-and-logic/logical-operators.gif
--------------------------------------------------------------------------------
/3-conditionals-and-logic/magic-8-ball/magic8.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | int main() {
5 |
6 | std::cout << "MAGIC 🎱 SAYS: \n\n";
7 |
8 | srand(time(NULL));
9 |
10 | int choice = std::rand() % 20;
11 |
12 | if (choice == 0) {
13 |
14 | std::cout << "It is certain.\n";
15 |
16 | }
17 | else if (choice == 1) {
18 |
19 | std::cout << "It is decidedly so.\n";
20 |
21 | }
22 | else if (choice == 2) {
23 |
24 | std::cout << "Without a doubt.\n";
25 |
26 | }
27 | else if (choice == 3) {
28 |
29 | std::cout << "Yes - definitely.\n";
30 |
31 | }
32 | else if (choice == 4) {
33 |
34 | std::cout << "You may rely on it.\n";
35 |
36 | }
37 | else if (choice == 5) {
38 |
39 | std::cout << "As I see it, yes.\n";
40 |
41 | }
42 | else if (choice == 6) {
43 |
44 | std::cout << "Most likely.\n";
45 |
46 | }
47 | else if (choice == 7) {
48 |
49 | std::cout << "Outlook good.\n";
50 |
51 | }
52 | else if (choice == 8) {
53 |
54 | std::cout << "Yes.\n";
55 |
56 | }
57 | else if (choice == 9) {
58 |
59 | std::cout << "Signs point to yes.\n";
60 |
61 | }
62 | else if (choice == 10) {
63 |
64 | std::cout << "Reply hazy, try again.\n";
65 |
66 | }
67 | else if (choice == 11) {
68 |
69 | std::cout << "Ask again later.\n";
70 |
71 | }
72 | else if (choice == 12) {
73 |
74 | std::cout << "Better not tell you now.\n";
75 |
76 | }
77 | else if (choice == 13) {
78 |
79 | std::cout << "Cannot predict now.\n";
80 |
81 | }
82 | else if (choice == 14) {
83 |
84 | std::cout << "Concentrate and ask again.\n";
85 |
86 | }
87 | else if (choice == 15) {
88 |
89 | std::cout << "Don't count on it.\n";
90 |
91 | }
92 | else if (choice == 16) {
93 |
94 | std::cout << "My reply is no.\n";
95 |
96 | }
97 | else if (choice == 17) {
98 |
99 | std::cout << "My sources say no.\n";
100 |
101 | }
102 | else if (choice == 18) {
103 |
104 | std::cout << "Outlook not so good.\n";
105 |
106 | }
107 | else {
108 |
109 | std::cout << "Very doubtful.\n";
110 |
111 | }
112 |
113 | return 0;
114 |
115 | }
116 |
--------------------------------------------------------------------------------
/3-conditionals-and-logic/magic-8-ball/magic8_switch.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | int main() {
5 |
6 | std::cout << "MAGIC 🎱 SAYS: \n\n";
7 |
8 | srand(time(NULL));
9 |
10 | int choice = std::rand() % 10;
11 |
12 | switch(choice) {
13 | case 0:
14 | std::cout << "No. Not really.\n";
15 | break;
16 | case 1:
17 | std::cout << "Val!\n";
18 | break;
19 | case 2:
20 | std::cout << "You are an adult.\n";
21 | break;
22 | case 3:
23 | std::cout << "Four R's, my friend: Reduce, reuse, recycle, Rihanna.\n";
24 | break;
25 | case 4:
26 | std::cout << "Nomo FOMO.\n";
27 | break;
28 | case 5:
29 | std::cout << "Yas.\n";
30 | break;
31 | case 6:
32 | std::cout << "Work it, dawg!\n";
33 | break;
34 | case 7:
35 | std::cout << "Carpe dayum!\n";
36 | break;
37 | case 8:
38 | std::cout << "Cha-Chinga!\n";
39 | break;
40 | case 9:
41 | std::cout << "Yaaaaas Kween!\n";
42 | break;
43 | default:
44 | std::cout << "IDK.\n";
45 | break;
46 |
47 | }
48 |
49 | return 0;
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/3-conditionals-and-logic/magic-8-ball/magic8ball.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/3-conditionals-and-logic/magic-8-ball/magic8ball.gif
--------------------------------------------------------------------------------
/3-conditionals-and-logic/metrocard.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 |
5 | float rides; // number of subway or local bus rides
6 | float express; // number of express bus rides
7 |
8 | char living; // living or visiting
9 |
10 | std::cout << "====================================================\n";
11 | std::cout << "Welcome to the MetroCard Calculator! - New York City\n";
12 | std::cout << "====================================================\n";
13 | std::cout << "\n";
14 |
15 | std::cout << "The fare for a subway or local bus ride: $2.75\n");
16 | std::cout << "The fare for an express bus ride: $6.50\n");
17 | std::cout << "\n";
18 |
19 | std::cout << "Do you live here or are you visiting? (Input L/V):");
20 | std::cin >> living;
21 |
22 | if (living == 'L' || living == 'l') {
23 |
24 | float monthlycost; // monthly cost using single fare rides
25 |
26 | std::cout << "\n";
27 | std::cout << "How many times do you use the subway/bus a week?:";
28 | scanf("%f", &rides);
29 |
30 | printf("\n");
31 | printf("How many times do you use the express bus a week?:");
32 | scanf("%f", &express);
33 |
34 | monthlycost = (4 * rides * 2.75) + (4 * express * 6.50);
35 |
36 | printf("\n");
37 | printf("============\n");
38 | printf("MONTHLY COST\n");
39 | printf("============\n\n");
40 |
41 | printf(" - Using Single Fare Rides $%0.2f\n", monthlycost);
42 | printf(" - Using 7-Day Unlimited Card (x4) $128.00\n");
43 | printf(" - Using 30-Day Unlimited Card $121.00\n");
44 |
45 | printf("==============================================\n\n");
46 |
47 | if (monthlycost > 121) {
48 |
49 | printf("It would be better to use the 30-Day Unlimited.\n");
50 | printf("You would save $%0.2f per month.\n", monthlycost - 121);
51 |
52 | }
53 | else {
54 |
55 | printf("It would be better to use Single Fare rides.\n");
56 | printf("You would save $%0.2f per month.\n", 121 - monthlycost);
57 |
58 | }
59 |
60 | }
61 | else if (living == 'V' || living == 'v') {
62 |
63 | float days; // number of days
64 | int weeks; // number of weeks (rounded up)
65 |
66 | float tripcost; // trip cost using single fare rides
67 | float unlimited; // trip cost using 7-day unlimited
68 |
69 | printf("\n");
70 | printf("How many days total are you staying in New York?:");
71 | scanf("%f", &days);
72 |
73 | printf("\n");
74 | printf("How many times do you use the subway/bus per day?:");
75 | scanf("%f", &rides);
76 |
77 | printf("\n");
78 | printf("How many times do you use the express bus per day?:");
79 | scanf("%f", &express);
80 |
81 | tripcost = (days * rides * 2.75) + (days * express * 6.50);
82 |
83 | if (days <= 7)
84 | {
85 | weeks = 1;
86 | }
87 | else if (days <= 14)
88 | {
89 | weeks = 2;
90 | }
91 | else if (days <= 21)
92 | {
93 | weeks = 3;
94 | }
95 | else if (days <= 28)
96 | {
97 | weeks = 4;
98 | }
99 | else if (days <= 35)
100 | {
101 | weeks = 5;
102 | }
103 | else if (days <= 42)
104 | {
105 | weeks = 6;
106 | }
107 | else if (days <= 49)
108 | {
109 | weeks = 7;
110 | }
111 |
112 | unlimited = weeks * 32.00;
113 |
114 | printf("\n");
115 | printf("=========\n");
116 | printf("TRIP COST\n");
117 | printf("=========\n\n");
118 |
119 | printf(" - Using Single Fare Rides: $%0.2f\n", tripcost);
120 | printf(" - Using 7-Day Unlimited Card: (x%d) $%0.2f\n", weeks, unlimited);
121 | printf(" - Using 30-Day Unlimited Card: $121.00\n");
122 |
123 | printf("================================================\n\n");
124 |
125 | if (tripcost < 121 && tripcost < unlimited) {
126 |
127 | printf("It would be better to use Single Fare rides.\n");
128 | printf("You would save $%0.2f vs. using 30-Day Unlimited.\n", 121 - tripcost);
129 | printf("You would save $%0.2f vs. using 7-Day Unlimited.\n", unlimited - tripcost);
130 |
131 | }
132 | else if (unlimited < tripcost && unlimited < 121) {
133 |
134 | printf("It would be better to use the 7-Day Unlimited.\n");
135 | printf("You would save $%0.2f vs. using 30-Day Unlimited.\n", 121 - unlimited);
136 | printf("You would save $%0.2f vs. using Single Fare Rides.\n", tripcost - unlimited);
137 |
138 | }
139 | else if (tripcost > 121 && unlimited > 121) {
140 |
141 | printf("It would be better to use the 30-Day Unlimited.\n");
142 | printf("You would save $%f vs. using 7-Day Unlimited.\n", unlimited - 121);
143 | printf("You would save $%f vs. using Single Fare Rides.\n", tripcost - 121);
144 |
145 | }
146 |
147 | }
148 | else {
149 |
150 | printf("\n");
151 | printf("=============\n");
152 | printf("Invalid Entry\n");
153 | printf("=============\n");
154 |
155 | }
156 |
157 | return 0;
158 |
159 | }
160 |
--------------------------------------------------------------------------------
/3-conditionals-and-logic/pH.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 |
5 | double ph = 4.6;
6 |
7 | if (ph > 7) {
8 |
9 | std::cout << "Basic\n";
10 |
11 | } else if (ph < 7) {
12 |
13 | std::cout << "Acidic\n";
14 |
15 | } else {
16 |
17 | std::cout << "Neutral\n";
18 |
19 | }
20 |
21 | return 0;
22 |
23 | }
--------------------------------------------------------------------------------
/3-conditionals-and-logic/pokedex.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 |
5 | int number = 9;
6 |
7 | switch(number) {
8 |
9 | case 1 :
10 | std::cout << "Bulbusaur\n";
11 | break;
12 | case 2 :
13 | std::cout << "Ivysaur\n";
14 | break;
15 | case 3 :
16 | std::cout << "Venusaur\n";
17 | break;
18 | case 4 :
19 | std::cout << "Charmander\n";
20 | break;
21 | case 5 :
22 | std::cout << "Charmeleon\n";
23 | break;
24 | case 6 :
25 | std::cout << "Charizard\n";
26 | break;
27 | case 7 :
28 | std::cout << "Squirtle\n";
29 | break;
30 | case 8 :
31 | std::cout << "Wartortle\n";
32 | break;
33 | case 9 :
34 | std::cout << "Blastoise\n";
35 | break;
36 | default :
37 | std::cout << "Not starter\n";
38 | break;
39 |
40 | }
41 |
42 | return 0;
43 |
44 | }
--------------------------------------------------------------------------------
/3-conditionals-and-logic/rock-paper-scissors-lizard-spock/RPS.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | int main() {
5 |
6 | srand(time(NULL));
7 |
8 | int computer = std::rand() % 3 + 1;
9 |
10 | int user;
11 |
12 | std::cout << "====================\n";
13 | std::cout << "rock paper scissors!\n";
14 | std::cout << "====================\n";
15 |
16 | std::cout << "1) ✊\n";
17 | std::cout << "2) ✋\n";
18 | std::cout << "3) ✌️\n";
19 |
20 | std::cout << "shoot! ";
21 |
22 | std::cin >> user;
23 |
24 | if (user == 1)
25 | std::cout << "you choose: ✊\n";
26 | else if (user == 2)
27 | std::cout << "you choose: ✋\n";
28 | else
29 | std::cout << "you choose: ✌️\n";
30 |
31 | if (computer == 1)
32 | std::cout << "cpu choose: ✊\n";
33 | else if (computer == 2)
34 | std::cout << "cpu choose: ✋\n";
35 | else
36 | std::cout << "cpu choose: ✌️\n";
37 |
38 |
39 | if (user == computer) {
40 |
41 | std::cout << "it's a tie!\n";
42 |
43 | }
44 |
45 | // user rock
46 |
47 | else if (user == 1) {
48 |
49 | if (computer == 2) {
50 |
51 | std::cout << "you lost! booooo!\n";
52 |
53 | }
54 | if (computer == 3) {
55 |
56 | std::cout << "you won! woohoo!\n";
57 |
58 | }
59 |
60 | }
61 |
62 | // user paper
63 |
64 | else if (user == 2) {
65 |
66 | if (computer == 1) {
67 |
68 | std::cout << "you won! woohoo!\n";
69 |
70 | }
71 | if (computer == 3) {
72 |
73 | std::cout << "you lost! boo!\n";
74 |
75 | }
76 |
77 | }
78 |
79 | // user scissors
80 |
81 | else if (user == 3) {
82 |
83 | if (computer == 1) {
84 |
85 | std::cout << "you won! woohoo!\n";
86 |
87 | }
88 | if (computer == 2) {
89 |
90 | std::cout << "you lost! booooo!\n";
91 |
92 | }
93 |
94 | }
95 |
96 | return 0;
97 |
98 | }
99 |
--------------------------------------------------------------------------------
/3-conditionals-and-logic/rock-paper-scissors-lizard-spock/RPSLS.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | This program will allow you to play RPSLS against the computer.
3 | */
4 |
5 | #include
6 | #include
7 |
8 | int main() {
9 |
10 | srand(time(NULL));
11 | int computer = std::rand() % 5 + 1;
12 | int user = 0;
13 |
14 | std::cout << "=================================\n";
15 | std::cout << "rock paper scissors lizard spock!\n";
16 | std::cout << "=================================\n";
17 |
18 | std::cout << "1) ✊\n";
19 | std::cout << "2) ✋\n";
20 | std::cout << "3) ✌️\n";
21 | std::cout << "4) lizard\n";
22 | std::cout << "5) spock\n\n";
23 |
24 | std::cout << "shoot: ";
25 |
26 | int rock = 1;
27 | int paper = 2;
28 | int scissors = 3;
29 | int lizard = 4;
30 | int spock = 5;
31 |
32 | std::cin >> user;
33 |
34 | /*
35 | rock > scissors
36 | scissors > paper
37 | paper > rock
38 | lizard > spock
39 | spock > scissors
40 | scissors > lizard
41 | lizard > paper
42 | paper > spock
43 | spock > rock
44 | rock > lizard
45 | */
46 |
47 | std::cout << "computer: " << computer << "\n\n";
48 |
49 | if (user == rock && computer == scissors) {
50 |
51 | std::cout << "You Win!\n";
52 |
53 | } else if (user == scissors && computer == paper) {
54 |
55 | std::cout << "You Win!\n";
56 |
57 | } else if (user == paper && computer == rock) {
58 |
59 | std::cout << "You Win!\n";
60 |
61 | } else if (user == lizard && computer == spock) {
62 |
63 | std::cout << "You Win!\n";
64 |
65 | } else if (user == spock && computer == scissors) {
66 |
67 | std::cout << "You Win!\n";
68 |
69 | } else if (user == scissors && computer == lizard) {
70 |
71 | std::cout << "You Win!\n";
72 |
73 | } else if (user == lizard && computer == paper) {
74 |
75 | std::cout << "You Win!\n";
76 |
77 | } else if (user == paper && computer == spock) {
78 |
79 | std::cout << "You Win!\n";
80 |
81 | } else if (user == spock && computer == rock) {
82 |
83 | std::cout << "You Win!\n";
84 |
85 | } else if (user == rock && computer == lizard) {
86 |
87 | std::cout << "You Win!\n";
88 |
89 | } else if (user == computer) {
90 |
91 | std::cout << "Tie!\n";
92 |
93 | } else {
94 |
95 | std::cout << "You Lose!\n";
96 |
97 | }
98 |
99 | }
100 |
--------------------------------------------------------------------------------
/3-conditionals-and-logic/rock-paper-scissors-lizard-spock/RPSLS.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/3-conditionals-and-logic/rock-paper-scissors-lizard-spock/RPSLS.gif
--------------------------------------------------------------------------------
/3-conditionals-and-logic/rock-paper-scissors-lizard-spock/RPSLS_if.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | int main() {
5 |
6 | std::cout << "Let's play Rock, Paper, Scissors, Lizard, Spock!\nThank you, The Big Bang Theory!\n\n";
7 |
8 | int player1;
9 |
10 | std::cout << "Select:\n 1) Rock\n 2) Paper\n 3) Scissors\n 4) Lizard\n 5) Spock\n";
11 | std::cin >> player1;
12 |
13 | srand(time(NULL));
14 | int player2 = rand() % 5 + 1;
15 |
16 | std::cout << "\n";
17 |
18 | if (player1 != 1 && player1 != 2 && player1 != 3 && player1 != 4 && player1 != 5) {
19 |
20 | std::cout << "Wrong input, dude. Choose 1, 2, 3, 4 or 5: ";
21 | std::cin >> player1;
22 |
23 | std::cout << "\n";
24 |
25 | }
26 |
27 | if (player1 == player2) {
28 |
29 | std::cout << "It's a draw.\n";
30 |
31 | }
32 |
33 | if (player1 == 1) {
34 |
35 | if (player2 == 2) {
36 | std::cout << "Paper covers Rock. Computer Wins!\n";
37 | }
38 | else if (player2 == 3) {
39 | std::cout << "Rock smashes Scissors. You Win!\n";
40 | }
41 | else if (player2 == 4) {
42 | std::cout << "Rock crushes Lizard. You Win!\n";
43 | }
44 | else if (player2 == 5) {
45 | std::cout << "Spock vaporizes Rock. Computer Wins!\n";
46 | }
47 |
48 | }
49 | else if (player1 == 2) {
50 |
51 | if (player2 == 1) {
52 | std::cout << "Paper covers Rock. You Win!\n";
53 | }
54 | else if (player2 == 3) {
55 | std::cout << "Scissors cuts Paper. Computer Wins!\n";
56 | }
57 | else if (player2 == 4) {
58 | std::cout << "Lizard eats Paper. Computer Wins!\n";
59 | }
60 | else if (player2 == 5) {
61 | std::cout << "Paper disproves Spock. You Win!\n";
62 | }
63 |
64 | }
65 | else if (player1 == 3) {
66 |
67 | if (player2 == 1) {
68 | std::cout << "Rock crushes Scissors. Computer Wins!\n";
69 | }
70 | else if (player2 == 2) {
71 | std::cout << "Scissors cuts Paper. You Win!\n";
72 | }
73 | else if (player2 == 4) {
74 | std::cout << "Scissors decapitate Lizard. You Win!\n";
75 | }
76 | else if (player2 == 5) {
77 | std::cout << "Spock smashes Scissors. Computer Wins!\n";
78 | }
79 |
80 | }
81 | else if (player1 == 4) {
82 |
83 | if (player2 == 1) {
84 | std::cout << "Rock crushes Lizard. Computer Wins!\n";
85 | }
86 | else if (player2 == 2) {
87 | std::cout << "Lizard eats Paper. You Win!\n";
88 | }
89 | else if (player2 == 3) {
90 | std::cout << "Scissors decapitate Lizard. Computer Wins!\n";
91 | }
92 | else if (player2 == 5) {
93 | std::cout << "Lizard poisons Spock. You Win!\n";
94 | }
95 |
96 | }
97 | else if (player1 == 5) {
98 |
99 | if (player2 == 1) {
100 | std::cout << "Spock vaporizes Rock. You Win!\n";
101 | }
102 | else if (player2 == 2) {
103 | std::cout << "Paper disproves Spock. Computer Wins!\n";
104 | }
105 | else if (player2 == 3) {
106 | std::cout << "Spock smashes Scissors. You Win!\n";
107 | }
108 | else if (player2 == 4) {
109 | std::cout << "Lizard poisons Spock. Computer Wins!\n";
110 | }
111 |
112 | }
113 |
114 | return 0;
115 |
116 | }
--------------------------------------------------------------------------------
/3-conditionals-and-logic/rock-paper-scissors-lizard-spock/RPSLS_switch.cpp:
--------------------------------------------------------------------------------
1 | /* As Sheldon explains, "Scissors cuts paper, paper covers rock,
2 | rock crushes lizard, lizard poisons Spock, Spock smashes scissors,
3 | scissors decapitates lizard, lizard eats paper, paper disproves Spock,
4 | Spock vaporizes rock, and as it always has, rock crushes scissors."
5 | */
6 |
7 | #include
8 | #include
9 | #include
10 |
11 | int main() {
12 |
13 | // Get computer selection
14 | srand (time(NULL));
15 | int computer = rand() % 5 + 1;
16 |
17 | int user;
18 |
19 | std::cout << "1) Rock\n";
20 | std::cout << "2) Paper\n";
21 | std::cout << "3) Scissors\n";
22 | std::cout << "4) Lizard\n";
23 | std::cout << "5) Spock\n";
24 | std::cout << "Choose your weapon: ";
25 | std::cin >> user;
26 |
27 | switch (user) {
28 | case 1: // Human chooses Rock
29 | switch (computer) {
30 | case 1: // Computer chooses Rock
31 | std::cout << "You tie! You both chose Rock!\n";
32 | break;
33 | case 2: // Computer chooses Paper
34 | std::cout << "Computer wins! Paper covers Rock!\n";
35 | break;
36 | case 3: // Computer chooses Scissors
37 | std::cout << "You win! Rock crushes Scissors!\n";
38 | break;
39 | case 4: // Computer chooses Lizard
40 | std::cout << "You win! Rock crushes Lizard!\n";
41 | break;
42 | case 5: // Computer chooses Spock
43 | std::cout << "Computer wins! Spock vaporizes Rock!\n";
44 | break;
45 | default: // Something went wrong with rand
46 | std::cout << "Computer tried to cheat!?!\n";
47 | break;
48 | }
49 | break;
50 | case 2: // Human chooses Paper
51 | switch (computer) {
52 | case 1: // Computer chooses Rock
53 | std::cout << "You win! Paper covers Rock!\n";
54 | break;
55 | case 2: // Computer chooses Paper
56 | std::cout << "You tie! You both chose Paper!\n";
57 | break;
58 | case 3: // Computer chooses Scissors
59 | std::cout << "Computer wins! Scissors cuts Paper!\n";
60 | break;
61 | case 4: // Computer chooses Lizard
62 | std::cout << "Computer wins! Lizard eats Paper!\n";
63 | break;
64 | case 5: // Computer chooses Spock
65 | std::cout << "You win! Paper disproves Spock!\n";
66 | break;
67 | default: // Something went wrong with rand
68 | std::cout << "Computer tried to cheat!?!\n";
69 | break;
70 | }
71 | break;
72 | case 3: // Human chooses Scissors
73 | switch (computer) {
74 | case 1: // Computer chooses Rock
75 | std::cout << "Computer wins! Rock crushes Scissors!\n";
76 | break;
77 | case 2: // Computer chooses Paper
78 | std::cout << "You win! Scissors cuts Paper!\n";
79 | break;
80 | case 3: // Computer chooses Scissors
81 | std::cout << "You tie! You both chose Scissors!\n";
82 | break;
83 | case 4: // Computer chooses Lizard
84 | std::cout << "You win! Scissors decapitates Lizard!\n";
85 | break;
86 | case 5: // Computer chooses Spock
87 | std::cout << "Computer wins! Spock smashes Scissors!\n";
88 | break;
89 | default: // Something went wrong with rand
90 | std::cout << "Computer tried to cheat!?!\n";
91 | break;
92 | }
93 | break;
94 | case 4: // Human chooses Lizard
95 | switch (computer) {
96 | case 1: // Computer chooses Rock
97 | std::cout << "Computer wins! Rock crushes Lizard!\n";
98 | break;
99 | case 2: // Computer chooses Paper
100 | std::cout << "You win! Lizard eats Paper!\n";
101 | break;
102 | case 3: // Computer chooses Scissors
103 | std::cout << "Computer wins! Scissors decapitates Lizard!\n";
104 | break;
105 | case 4: // Computer chooses Lizard
106 | std::cout << "You tie! You both chose Lizard!\n";
107 | break;
108 | case 5: // Computer chooses Spock
109 | std::cout << "You win! Lizard poisons Spock!\n";
110 | break;
111 | default: // Something went wrong with rand
112 | std::cout << "Computer tried to cheat!?!\n";
113 | break;
114 | }
115 | break;
116 | case 5: // Human chooses Vulcan
117 | switch (computer) {
118 | case 1: // Computer chooses Rock
119 | std::cout << "You win! Spock vaporizes Rock!\n";
120 | break;
121 | case 2: // Computer chooses Paper
122 | std::cout << "Computer wins! Paper disproves Spock!\n";
123 | break;
124 | case 3: // Computer chooses Scissors
125 | std::cout << "You win! Spock smashes Scissors!\n";
126 | break;
127 | case 4: // Computer chooses Lizard
128 | std::cout << "Computer wins! Lizard poisons Spock!\n";
129 | break;
130 | case 5: // Computer chooses Spock
131 | std::cout << "You tie! You both chose Spock!\n";
132 | break;
133 | default: // Something went wrong with rand
134 | std::cout << "Computer tried to cheat!?!\n";
135 | break;
136 | }
137 | break;
138 | default: // Human chose outside 1-5 range
139 | std::cout << "Did you try to cheat?!\n";
140 | break;
141 | }
142 |
143 | std::cout << "Thank you for playing. Put me in a loop to play more!\n";
144 |
145 | return 0;
146 |
147 | }
148 |
--------------------------------------------------------------------------------
/3-conditionals-and-logic/rock-paper-scissors-lizard-spock/RPSLS_switch_scores.cpp:
--------------------------------------------------------------------------------
1 | // Author: Ali Parandeh
2 | // GitHub: https://github.com/Ali-Parandeh
3 |
4 | /* GAME LOGIC:
5 |
6 | Scissors cut Paper
7 | Paper covers Rock
8 | Rock crushes Lizard
9 | Lizard poisons Spock
10 | Spock smashes Scissors
11 | Scissors decapitate Lizard
12 | Lizard eats Paper
13 | Paper disproves Spock
14 | Spock vaporizes Rock
15 | Rock crushes Scissors
16 |
17 | */
18 |
19 | #include
20 | #include
21 |
22 | // Defining structs for returning results
23 | struct Results {
24 | int user_score;
25 | int computer_score;
26 | std::string result;
27 | };
28 |
29 | // function declaration
30 | std::string TranslateChoice(int choice) {
31 | switch(choice) {
32 | case 1:
33 | return "✊";
34 | break;
35 | case 2:
36 | return "✋";
37 | break;
38 | case 3:
39 | return "✌️";
40 | break;
41 | case 4:
42 | return "👌";
43 | break;
44 | case 5:
45 | return "🖖";
46 | break;
47 | default:
48 | break;
49 | }
50 | }
51 |
52 | void AnnounceResults(int user, int computer, std::string result) {
53 | std::cout << "\nYou chose: " << TranslateChoice(user) << "\n";
54 | std::cout << "Computer chose: " << TranslateChoice(computer) << "\n";
55 | std::cout << "And the result is as follows: " << result << "\n";
56 | }
57 |
58 | Results PlayWithComputer(int user, int computer, int user_score, int computer_score) {
59 | if (user == computer) {
60 | return {user_score, computer_score, "It is a draw!"};
61 | }
62 |
63 | switch (user) {
64 | case 1: // Rock
65 | if (computer == 3 || computer == 4) // Scissors & Lizard
66 | {
67 | user_score++;
68 | return {user_score, computer_score, "You Win!"};
69 | }
70 | else
71 | {
72 | computer_score++;
73 | return {user_score, computer_score,"You Lose!"};
74 | }
75 | break;
76 |
77 | case 2: // Paper
78 | if (computer == 1 || computer == 5) // Rock & Spock
79 | {
80 | user_score++;
81 | return {user_score, computer_score,"You Win!"};
82 | }
83 | else
84 | {
85 | computer_score++;
86 | return {user_score, computer_score,"You Lose!"};
87 | }
88 | break;
89 |
90 | case 3: // Scissors
91 | if (computer == 2 || computer == 4) // Paper & Lizard
92 | {
93 | user_score++;
94 | return {user_score, computer_score,"You Win!"};
95 | }
96 | else
97 | {
98 | computer_score++;
99 | return {user_score, computer_score,"You Lose!"};
100 | }
101 | break;
102 |
103 | case 4: // Lizard
104 | if (computer == 2 || computer == 5) // Paper & Spock
105 | {
106 | user_score++;
107 | return {user_score, computer_score,"You Win!"};
108 | }
109 | else
110 | {
111 | computer_score++;
112 | return {user_score, computer_score,"You Lose!"};
113 | }
114 | break;
115 |
116 | case 5: // Spock
117 | if (computer == 1 || computer == 3) // Rock & Scissors
118 | {
119 | user_score++;
120 | return {user_score, computer_score,"You Win!"};
121 | }
122 | else
123 | {
124 | computer_score++;
125 | return {user_score, computer_score, "You Lose!"};
126 | }
127 | break;
128 |
129 | default:
130 | std::cout << "INVALID INPUT. TRY AGAIN.\n";
131 | return {user_score, computer_score,"0"};
132 | break;
133 | }
134 | }
135 |
136 | Results StartGame(int user_score, int computer_score) {
137 | srand (time(NULL));
138 | int user = 0, computer = rand() % 5 + 1;
139 |
140 | std::cout << "\nGame Starting.\n";
141 | std::cout << "1) ✊\n"; // Rock
142 | std::cout << "2) ✋\n"; // Paper
143 | std::cout << "3) ✌️\n"; // Scissors
144 | std::cout << "4) 👌\n"; // Lizard
145 | std::cout << "5) 🖖\n"; // Spock
146 | std::cout << "Shoot! ";
147 |
148 | std::cin >> user;
149 |
150 | if(user <= 0) {
151 |
152 | return {user_score, computer_score, "0"};
153 |
154 | }
155 |
156 | auto results = PlayWithComputer(user, computer, user_score, computer_score);
157 | AnnounceResults(user, computer, results.result);
158 |
159 | return results;
160 |
161 | }
162 |
163 | int main() {
164 |
165 | Results results;
166 | results.user_score = 0;
167 | results.computer_score = 0;
168 | int score_limit;
169 |
170 | std::cout << "=================================\n";
171 | std::cout << "Rock Paper Scissors Lizard Spock!\n";
172 | std::cout << "=================================\n\n";
173 |
174 | std::cout << "Set a winning target:\n";
175 | std::cin >> score_limit;
176 |
177 | if (score_limit <= 0 ) {
178 |
179 | std::cout << "INVALID INPUT. TRY AGAIN.\n";
180 | return 0;
181 |
182 | }
183 |
184 | while (results.user_score != score_limit && results.computer_score != score_limit) {
185 |
186 | results = StartGame(results.user_score, results.computer_score);
187 |
188 | if (results.result == "0") {
189 |
190 | std::cout << "INVALID INPUT. TRY AGAIN.\n";
191 | return 0;
192 |
193 | }
194 |
195 | std::cout << "\nGreat round! Here's the game status so far: \n";
196 | std::cout << "Your wins: " << results.user_score << " Computer wins: " << results.computer_score << "\n";
197 |
198 | }
199 |
200 | std::cout << "\nGAME OVER.\n";
201 |
202 | if (results.user_score > results.computer_score) {
203 | std::cout << "YOU WON!!! TO A COMPUTER - CONGRATULATIONS!\n";
204 | }
205 | else {
206 | std::cout << "YOU LOST!!! TO A COMPUTER - GO CRY NOW!\n";
207 | }
208 |
209 | return 0;
210 |
211 | }
--------------------------------------------------------------------------------
/3-conditionals-and-logic/rock-paper-scissors-lizard-spock/rpsls_new:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | int main() {
5 | srand(time(NULL));
6 | int compvar = std::rand() % 10;//0,1 - rock 2,3 - paper 4,5 - scissors 6,7 - lizard 8,9 - spock
7 | int playvar = 0;
8 | std::cout << "Choose one: \n 1)Rock \n 2)Paper \n 3)Scissors \n 4)Lizard \n 5)Spock \n";
9 | std::cin >> playvar;
10 | if(playvar == 1){
11 | std::cout << "Your choice is Rock \n";
12 | if(compvar == 0 or compvar == 1){
13 | std::cout << "Your opponents choice is Rock \n Draw. \n";
14 | }
15 | else if(compvar == 2 or compvar == 3){
16 | std::cout << "Your opponents choice is Paper \n You lose. \n";
17 | }
18 | else if(compvar == 4 or compvar == 5){
19 | std::cout << "Your opponents choice is Scissors \n You win. \n";
20 | }
21 | else if(compvar == 6 or compvar == 7){
22 | std::cout << "Your opponents choice is Lizard \n You win. \n";
23 | }
24 | if(compvar == 8 or compvar == 9){
25 | std::cout << "Your opponents choice is Spock \n You lose. \n";
26 | }
27 | }
28 | else if(playvar == 2){
29 | std::cout << "Your choice is Paper \n"; if(compvar == 0 or compvar == 1){
30 | std::cout << "Your opponents choice is Rock \n You win. \n";
31 | }
32 | else if(compvar == 2 or compvar == 3){
33 | std::cout << "Your opponents choice is Paper \n Draw. \n";
34 | }
35 | else if(compvar == 4 or compvar == 5){
36 | std::cout << "Your opponents choice is Scissors \n You lose. \n";
37 | }
38 | else if(compvar == 6 or compvar == 7){
39 | std::cout << "Your opponents choice is Lizard \n You lose. \n";
40 | }
41 | if(compvar == 8 or compvar == 9){
42 | std::cout << "Your opponents choice is Spock \n You win. \n";
43 | }
44 | }
45 | else if(playvar == 3){
46 | std::cout << "Your choice is Scissors \n";
47 | if(compvar == 0 or compvar == 1){
48 | std::cout << "Your opponents choice is Rock \n You lose. \n";
49 | }
50 | else if(compvar == 2 or compvar == 3){
51 | std::cout << "Your opponents choice is Paper \n You win. \n";
52 | }
53 | else if(compvar == 4 or compvar == 5){
54 | std::cout << "Your opponents choice is Scissors \n Draw. \n";
55 | }
56 | else if(compvar == 6 or compvar == 7){
57 | std::cout << "Your opponents choice is Lizard \n You win. \n";
58 | }
59 | if(compvar == 8 or compvar == 9){
60 | std::cout << "Your opponents choice is Spock \n You lose. \n";
61 | }
62 | }
63 | else if(playvar == 4){
64 | std::cout << "Your choice is Lizard \n";
65 | if(compvar == 0 or compvar == 1){
66 | std::cout << "Your opponents choice is Rock \n You lose. \n";
67 | }
68 | else if(compvar == 2 or compvar == 3){
69 | std::cout << "Your opponents choice is Paper \n You win. \n";
70 | }
71 | else if(compvar == 4 or compvar == 5){
72 | std::cout << "Your opponents choice is Scissors \n You lose. \n";
73 | }
74 | else if(compvar == 6 or compvar == 7){
75 | std::cout << "Your opponents choice is Lizard \n Draw. \n";
76 | }
77 | if(compvar == 8 or compvar == 9){
78 | std::cout << "Your opponents choice is Spock \n You win. \n";
79 | }
80 | }
81 | else if(playvar == 5){
82 | std::cout << "Your choice is Spock \n";
83 | if(compvar == 0 or compvar == 1){
84 | std::cout << "Your opponents choice is Rock \n You win. \n";
85 | }
86 | else if(compvar == 2 or compvar == 3){
87 | std::cout << "Your opponents choice is Paper \n You lose. \n";
88 | }
89 | else if(compvar == 4 or compvar == 5){
90 | std::cout << "Your opponents choice is Scissors \n You win. \n";
91 | }
92 | else if(compvar == 6 or compvar == 7){
93 | std::cout << "Your opponents choice is Lizard \n You lose. \n";
94 | }
95 | if(compvar == 8 or compvar == 9){
96 | std::cout << "Your opponents choice is Spock \n Draw. \n";
97 | }
98 | else{
99 | std::cout << "Invalid input \n";
100 | }
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/3-conditionals-and-logic/space.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 |
5 | double weight;
6 | int x;
7 |
8 | std::cout << "Please enter your current earth weight: ";
9 | std::cin >> weight;
10 |
11 | std::cout << "\nI have information for the following planets:\n\n";
12 | std::cout << " 1. Venus 2. Mars 3. Jupiter\n";
13 | std::cout << " 4. Saturn 5. Uranus 6. Neptune\n\n";
14 |
15 | std::cout << "Which planet are you visiting? ";
16 | std::cin >> x;
17 |
18 | if (x == 1) {
19 |
20 | weight = weight * 0.78;
21 |
22 | } else if (x == 2) {
23 |
24 | weight = weight * 0.39;
25 |
26 | } else if (x == 3) {
27 |
28 | weight = weight * 2.65;
29 |
30 | } else if (x == 4) {
31 |
32 | weight = weight * 1.17;
33 |
34 | } else if (x == 5) {
35 |
36 | weight = weight * 1.05;
37 |
38 | } else if (x == 6) {
39 |
40 | weight = weight * 1.23;
41 |
42 | }
43 |
44 | std::cout << "\nYour weight: " << weight << "\n";
45 |
46 | return 0;
47 |
48 | }
--------------------------------------------------------------------------------
/3-conditionals-and-logic/streetsign.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/3-conditionals-and-logic/streetsign.gif
--------------------------------------------------------------------------------
/4-loops/99bottles.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 |
5 | // Write a for loop here:
6 |
7 | for (int i = 99; i > 0; i--) {
8 |
9 | std::cout << i << " bottles of pop on the wall.\n";
10 | std::cout << "Take one down and pass it around.\n";
11 | std::cout << i - 1 << " bottles of pop on the wall.\n\n";
12 |
13 | }
14 |
15 | std::cout << "No more bottles of pop on the wall.\n";
16 | std::cout << "No more bottles of pop.\n";
17 | std::cout << "Go to the store and buy some more,\n";
18 | std::cout << "99 bottles of pop on the wall.\n";
19 |
20 | return 0;
21 |
22 | }
--------------------------------------------------------------------------------
/4-loops/art/bug.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/4-loops/art/bug.gif
--------------------------------------------------------------------------------
/4-loops/art/bug.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/4-loops/art/bug.jpg
--------------------------------------------------------------------------------
/4-loops/art/circle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/4-loops/art/circle.png
--------------------------------------------------------------------------------
/4-loops/art/compile-time-error-hint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/4-loops/art/compile-time-error-hint.png
--------------------------------------------------------------------------------
/4-loops/art/compile-time-error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/4-loops/art/compile-time-error.png
--------------------------------------------------------------------------------
/4-loops/art/link-time-error-hint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/4-loops/art/link-time-error-hint.png
--------------------------------------------------------------------------------
/4-loops/art/link-time-error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/4-loops/art/link-time-error.png
--------------------------------------------------------------------------------
/4-loops/art/run-time-error.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/4-loops/art/run-time-error.png
--------------------------------------------------------------------------------
/4-loops/art/troublemaker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/4-loops/art/troublemaker.png
--------------------------------------------------------------------------------
/4-loops/enter_pin.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 |
5 | int pin = 0;
6 | int tries = 0;
7 |
8 | std::cout << "BANK OF CODECADEMY\n";
9 |
10 | std::cout << "Enter your PIN: ";
11 | std::cin >> pin;
12 |
13 | while (pin != 1234) {
14 |
15 | std::cout << "Wrong PIN. Try again: ";
16 | std::cin >> pin;
17 | tries++;
18 |
19 | }
20 |
21 | std::cout << "PIN accepted!\n";
22 | std::cout << "You now have access.\n";
23 |
24 | return 0;
25 |
26 | }
--------------------------------------------------------------------------------
/4-loops/fizzbuzz/fizzbuzz.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 |
5 | for (int i = 1; i <= 100; i++) {
6 |
7 | if (i % 15 == 0) {
8 |
9 | std::cout << "FizzBuzz\n";
10 |
11 | } else if (i % 5 == 0) {
12 |
13 | std::cout << "Buzz\n";
14 |
15 | } else if (i % 3 == 0) {
16 |
17 | std::cout << "Fizz\n";
18 |
19 | } else {
20 |
21 | std::cout << i << "\n";
22 |
23 | }
24 |
25 | }
26 |
27 | return 0;
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/4-loops/fizzbuzz/fizzbuzz.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/4-loops/fizzbuzz/fizzbuzz.gif
--------------------------------------------------------------------------------
/4-loops/fizzbuzz/fizzbuzz3.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main(){
4 |
5 | bool fizzBuzzed = false;
6 |
7 | for (int i = 1; i <= 100; i++){
8 |
9 | if (i % 3 == 0){
10 | std::cout << "Fizz";
11 | fizzBuzzed = true;
12 | }
13 |
14 | if (i % 5 == 0){
15 | std::cout << "Buzz";
16 | fizzBuzzed = true;
17 | }
18 |
19 | if (!fizzBuzzed){
20 | std::cout << i;
21 | }
22 |
23 | std::cout << "\n";
24 | fizzBuzzed = false;
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/4-loops/guess.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 |
5 | int answer = 8;
6 |
7 | int guess;
8 |
9 | std::cout << "I have a number 1-10.\n";
10 | std::cout << "Please guess it: ";
11 | std::cin >> guess;
12 |
13 | // Write a while loop here:
14 |
15 | while (guess != 8) {
16 |
17 | std::cout << "Wrong guess, try again: ";
18 | std::cin >> guess;
19 |
20 | }
21 |
22 | std::cout << "You got it!\n";
23 |
24 | return 0;
25 |
26 | }
--------------------------------------------------------------------------------
/4-loops/square.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 |
5 | int i = 0;
6 | int square = 0;
7 |
8 | // Write a while loop here:
9 |
10 | while (i < 10) {
11 |
12 | square = i * i;
13 |
14 | std::cout << i << " " << square << "\n";
15 |
16 | i++;
17 |
18 | }
19 |
20 | return 0;
21 |
22 | }
--------------------------------------------------------------------------------
/4-loops/troublemaker.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 |
5 | for (int i = 0; i < 10; i++) {
6 |
7 | std::cout << "I will not throw paper airplanes in class.\n";
8 |
9 | }
10 |
11 | return 0;
12 |
13 | }
--------------------------------------------------------------------------------
/5-vectors/art/11235.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/5-vectors/art/11235.gif
--------------------------------------------------------------------------------
/5-vectors/art/size.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/5-vectors/art/size.png
--------------------------------------------------------------------------------
/5-vectors/oddeven.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | int main() {
5 |
6 | int total_even = 0;
7 | int product_odd = 1;
8 |
9 | std::vector vector = {2, 4, 3, 6, 1};
10 |
11 | for (int i = 0; i < vector.size(); i++) {
12 |
13 | if (vector[i] % 2 == 0) {
14 |
15 | total_even = total_even + vector[i];
16 |
17 | } else {
18 |
19 | product_odd = product_odd * vector[i];
20 |
21 | }
22 |
23 | }
24 |
25 | std::cout << "Sum of even numbers is " << total_even << "\n";
26 | std::cout << "Product of odd numbers is " << product_odd << "\n";
27 |
28 | return 0;
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/5-vectors/whale.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | int main() {
6 |
7 | std::string input = "Turpentine and turtles.";
8 |
9 | std::vector vowels;
10 |
11 | vowels.push_back('a');
12 | vowels.push_back('e');
13 | vowels.push_back('i');
14 | vowels.push_back('o');
15 | vowels.push_back('u');
16 |
17 | std::vector whale_talk;
18 |
19 | for (int i = 0; i < input.size(); i++) {
20 |
21 | for (int j = 0; j < vowels.size(); j++) {
22 |
23 | if (input[i] == vowels[j]) {
24 |
25 | whale_talk.push_back(input[i]);
26 |
27 | if (input[i] == 'e' || input [i] == 'u') {
28 |
29 | whale_talk.push_back(input[i]);
30 |
31 | }
32 |
33 | }
34 |
35 | }
36 |
37 | }
38 |
39 | for (int k = 0; k < whale_talk.size(); k++) {
40 |
41 | std::cout << whale_talk[k];
42 |
43 | }
44 |
45 | std::cout << "\n";
46 |
47 | }
--------------------------------------------------------------------------------
/6-functions/a.out:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/6-functions/a.out
--------------------------------------------------------------------------------
/6-functions/ufo.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "ufo_functions.hpp"
3 |
4 | int main() {
5 |
6 | greet();
7 |
8 | std::string codeword = "codecademy";
9 | std::string answer = "__________";
10 | int misses = 0;
11 | std::vector incorrect;
12 | bool guess = false;
13 | char letter;
14 |
15 | while (answer != codeword && misses < 7) {
16 |
17 | display_misses(misses);
18 | display_status(incorrect, answer);
19 |
20 | std::cout << "\n\nPlease enter your guess: ";
21 | std::cin >> letter;
22 |
23 | for (int i = 0; i < codeword.length(); i++) {
24 |
25 | if (letter == codeword[i]) {
26 |
27 | answer[i] = letter;
28 | guess = true;
29 |
30 | }
31 |
32 | }
33 |
34 | if (guess) {
35 |
36 | std::cout << "\nCorrect!\n";
37 |
38 | } else {
39 |
40 | std::cout << "\nIncorrect! The tractor beam pulls the person in further.\n";
41 | incorrect.push_back(letter);
42 | misses++;
43 |
44 | }
45 |
46 | guess = false;
47 |
48 | }
49 |
50 | end_game(answer, codeword);
51 |
52 | }
53 |
--------------------------------------------------------------------------------
/6-functions/ufo_functions.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | // Define functions
5 | void greet() {
6 |
7 | std::cout << "=============\n";
8 | std::cout << "UFO: The Game\n";
9 | std::cout << "=============\n";
10 | std::cout << "Instructions: save your friend from alien abduction by guessing the letters in the codeword.\n";
11 |
12 | }
13 |
14 | void display_status(std::vector incorrect, std::string answer) {
15 |
16 | std::cout << "\nIncorrect Guesses:\n";
17 |
18 | for (int i = 0; i < incorrect.size(); i++) {
19 | std::cout << incorrect[i] << ' ';
20 | }
21 |
22 | std::cout << "\nCodeword:\n";
23 |
24 | for (int i = 0; i < answer.length(); i++) {
25 | std::cout << answer[i] << ' ';
26 | }
27 |
28 | }
29 |
30 | void end_game(std::string answer, std::string codeword) {
31 |
32 | if (answer == codeword) {
33 |
34 | std::cout << "Hooray! You saved the person and earned a medal of honor!\n";
35 |
36 | } else {
37 |
38 | std::cout << "Oh no! The UFO just flew away with another person!\n";
39 |
40 | }
41 |
42 | }
43 |
44 | void display_misses(int misses) {
45 |
46 | if (misses == 0 || misses == 1) {
47 |
48 | std::cout << " . \n";
49 | std::cout << " | \n";
50 | std::cout << " .-\"^\"-. \n";
51 | std::cout << " /_....._\\ \n";
52 | std::cout << " .-\"` `\"-. \n";
53 | std::cout << " ( ooo ooo ooo ) \n";
54 | std::cout << " '-.,_________,.-' ,-----------. \n";
55 | std::cout << " / \\ ( Send help! ) \n";
56 | std::cout << " / 0 \\ / `-----------' \n";
57 | std::cout << " / --|-- \\ / \n";
58 | std::cout << " / | \\ \n";
59 | std::cout << " / / \\ \\ \n";
60 | std::cout << " / \\ \n";
61 |
62 | }
63 | else if (misses == 2) {
64 |
65 | std::cout << " . \n";
66 | std::cout << " | \n";
67 | std::cout << " .-\"^\"-. \n";
68 | std::cout << " /_....._\\ \n";
69 | std::cout << " .-\"` `\"-. \n";
70 | std::cout << " ( ooo ooo ooo ) \n";
71 | std::cout << " '-.,_________,.-' ,-----------. \n";
72 | std::cout << " / 0 \\ ( Send help! ) \n";
73 | std::cout << " / --|-- \\ / `-----------' \n";
74 | std::cout << " / | \\ / \n";
75 | std::cout << " / / \\ \\ \n";
76 | std::cout << " / \\ \n";
77 | std::cout << " / \\ \n";
78 |
79 | }
80 | else if (misses == 3) {
81 |
82 | std::cout << " . \n";
83 | std::cout << " | \n";
84 | std::cout << " .-\"^\"-. \n";
85 | std::cout << " /_....._\\ \n";
86 | std::cout << " .-\"` `\"-. \n";
87 | std::cout << " ( ooo ooo ooo ) \n";
88 | std::cout << " '-.,_________,.-' ,-----------. \n";
89 | std::cout << " /--|--\\ ( Send help! ) \n";
90 | std::cout << " / | \\ / `-----------' \n";
91 | std::cout << " / / \\ \\ / \n";
92 | std::cout << " / \\ \n";
93 | std::cout << " / \\ \n";
94 | std::cout << " / \\ \n";
95 |
96 | }
97 | else if (misses == 3) {
98 |
99 | std::cout << " . \n";
100 | std::cout << " | \n";
101 | std::cout << " .-\"^\"-. \n";
102 | std::cout << " /_....._\\ \n";
103 | std::cout << " .-\"` `\"-. \n";
104 | std::cout << " ( ooo ooo ooo ) \n";
105 | std::cout << " '-.,_________,.-' ,-----------. \n";
106 | std::cout << " /--|--\\ ( Send help! ) \n";
107 | std::cout << " / | \\ / `-----------' \n";
108 | std::cout << " / / \\ \\ / \n";
109 | std::cout << " / \\ \n";
110 | std::cout << " / \\ \n";
111 | std::cout << " / \\ \n";
112 |
113 | }
114 | else if (misses == 4) {
115 |
116 | std::cout << " . \n";
117 | std::cout << " | \n";
118 | std::cout << " .-\"^\"-. \n";
119 | std::cout << " /_....._\\ \n";
120 | std::cout << " .-\"` `\"-. \n";
121 | std::cout << " ( ooo ooo ooo ) \n";
122 | std::cout << " '-.,_________,.-' ,-----------. \n";
123 | std::cout << " / | \\ ( Send help! ) \n";
124 | std::cout << " / / \\ \\ / `-----------' \n";
125 | std::cout << " / \\ / \n";
126 | std::cout << " / \\ \n";
127 | std::cout << " / \\ \n";
128 | std::cout << " / \\ \n";
129 |
130 | }
131 | else if (misses == 5) {
132 |
133 | std::cout << " . \n";
134 | std::cout << " | \n";
135 | std::cout << " .-\"^\"-. \n";
136 | std::cout << " /_....._\\ \n";
137 | std::cout << " .-\"` `\"-. \n";
138 | std::cout << " ( ooo ooo ooo ) \n";
139 | std::cout << " '-.,_________,.-' ,-----------. \n";
140 | std::cout << " / / \\ \\ ( Send help! )\n";
141 | std::cout << " / \\ / `-----------' \n";
142 | std::cout << " / \\ / \n";
143 | std::cout << " / \\ \n";
144 | std::cout << " / \\ \n";
145 | std::cout << " / \\ \n";
146 |
147 | }
148 | else if (misses == 6) {
149 |
150 | std::cout << " . \n";
151 | std::cout << " | \n";
152 | std::cout << " .-\"^\"-. \n";
153 | std::cout << " /_....._\\ \n";
154 | std::cout << " .-\"` `\"-. \n";
155 | std::cout << " ( ooo ooo ooo ) \n";
156 | std::cout << " '-.,_________,.-' ,-----------. \n";
157 | std::cout << " / \\ ( Send help! ) \n";
158 | std::cout << " / \\ / `-----------' \n";
159 | std::cout << " / \\ / \n";
160 | std::cout << " / \\ \n";
161 | std::cout << " / \\ \n";
162 | std::cout << " / \\ \n";
163 |
164 | }
165 |
166 | }
167 |
168 |
--------------------------------------------------------------------------------
/6-functions/ufo_functions.hpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | void display_misses(int misses);
4 |
5 | // Declare functions
6 | void greet();
7 | void display_status(std::vector incorrect, std::string answer);
8 | void end_game(std::string answer, std::string codeword);
9 |
--------------------------------------------------------------------------------
/7-classes-and-objects/app.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "profile.hpp"
3 |
4 | int main() {
5 |
6 | Profile sam("Sam Drakkila", 30, "New York", "USA", "he/him");
7 | sam.add_hobby("listening to audiobooks and podcasts");
8 | sam.add_hobby("playing rec sports like bowling and kickball");
9 | sam.add_hobby("writing a speculative fiction novel");
10 | sam.add_hobby("reading advice columns");
11 | std::cout << sam.view_profile();
12 |
13 | }
--------------------------------------------------------------------------------
/7-classes-and-objects/profile.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "profile.hpp"
4 |
5 | Profile::Profile(std::string new_name, int new_age, std::string new_city, std::string new_country, std::string new_pronouns)
6 | : name(new_name), age(new_age), city(new_city), country(new_country), pronouns(new_pronouns) {
7 |
8 | if (new_age >= 18) {
9 | age = new_age;
10 | } else {
11 | age = 0;
12 | }
13 |
14 | }
15 |
16 | std::string Profile::view_profile() {
17 |
18 | std::string bio = "Name: " + name;
19 | bio += "\nAge: " + std::to_string(age);
20 | bio += "\nPronouns: " + pronouns;
21 | std::string hobby_string = "Hobbies:\n";
22 |
23 | for (std::string hobby : hobbies) {
24 |
25 | hobby_string += " - " + hobby + "\n";
26 |
27 | }
28 |
29 | return bio + "\n" + hobby_string;
30 |
31 | }
32 |
33 | void Profile::add_hobby(std::string new_hobby) {
34 |
35 | hobbies.push_back(new_hobby);
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/7-classes-and-objects/profile.hpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | class Profile {
4 | private:
5 | std::string name;
6 | int age;
7 | std::string city;
8 | std::string country;
9 | std::string pronouns;
10 | std::vector hobbies;
11 |
12 | public:
13 | Profile(std::string new_name, int new_age, std::string new_city, std::string new_country, std::string new_pronouns = "they/them");
14 | std::string view_profile();
15 | void add_hobby(std::string new_hobby);
16 |
17 | };
--------------------------------------------------------------------------------
/8-references-and-pointers/bleep/bleep.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include "functions.hpp"
5 |
6 | int main() {
7 |
8 | std::string word = "broccoli";
9 |
10 | std::string sentence = "I sometimes eat broccoli. The interesting thing about broccoli is that there are four interesting things about broccoli. Number One. Nobody knows how to spell it. Number Two. No matter how long you boil it, it's always cold by the time it reaches your plate. Number Three. It's green. #broccoli";
11 |
12 | bleep(word, sentence);
13 |
14 | for (int i = 0; i < sentence.size(); i++) {
15 |
16 | std::cout << sentence[i];
17 |
18 | }
19 |
20 | std::cout << "\n";
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/8-references-and-pointers/bleep/functions.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | void asterisk(std::string word, std::string &text, int i) {
4 |
5 | for (int k = 0; k < word.size(); ++k) {
6 |
7 | text[i+k] = '*';
8 |
9 | }
10 |
11 | }
12 |
13 | void bleep(std::string word, std::string &text) {
14 |
15 | for (int i = 0; i < text.size(); ++i) {
16 |
17 | int match = 0;
18 |
19 | for (int j = 0; j < word.size(); ++j) {
20 |
21 | if (text[i+j] == word[j]) {
22 |
23 | ++match;
24 |
25 | }
26 |
27 | }
28 |
29 | if (match == word.size()) {
30 |
31 | asterisk(word, text, i);
32 |
33 | }
34 |
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/8-references-and-pointers/bleep/functions.hpp:
--------------------------------------------------------------------------------
1 | void bleep(std::string word, std::string &text);
2 | void asterisk(std::string word, std::string &text, int i);
3 |
--------------------------------------------------------------------------------
/8-references-and-pointers/memory.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/8-references-and-pointers/memory.gif
--------------------------------------------------------------------------------
/8-references-and-pointers/pointers.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main() {
4 |
5 | int a = 54;
6 |
7 | std::cout << "a = " << a << "\n";
8 | std::cout << "address of a is at &a = " << &a << "\n";
9 |
10 | return 0;
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/8-references-and-pointers/pointers.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/8-references-and-pointers/pointers.png
--------------------------------------------------------------------------------
/8-references-and-pointers/pointers_big.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/8-references-and-pointers/pointers_big.png
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Learn C++
2 |
3 |
4 |
5 |
6 |
7 | **Curriculum Developer:** Sonny Li (sonny@codecademy.com) [![alt text][1]][1.1] [![alt text][6]][6.1]
8 |
9 |
10 |
11 |
12 |
13 | [1]: http://i.imgur.com/wWzX9uB.png (twitter icon without padding)
14 | [2]: http://i.imgur.com/fep1WsG.png (facebook icon without padding)
15 | [3]: http://i.imgur.com/VlgBKQ9.png (google plus icon without padding)
16 | [4]: http://i.imgur.com/jDRp47c.png (tumblr icon without padding)
17 | [5]: http://i.imgur.com/Vvy3Kru.png (dribbble icon without padding)
18 | [6]: http://i.imgur.com/9I6NRUm.png (github icon without padding)
19 |
20 |
21 |
22 | [1.1]: http://www.twitter.com/sonnynomnom
23 | [6.1]: http://www.github.com/sonnynomnom
24 |
25 | [1.2]: http://www.twitter.com/marielsmusings
26 | [6.2]: http://www.github.com/marielfrank
27 |
28 | **Curriculum Developer:** Mariel Frank (mariel@codecademy.com) [![alt text][1]][1.2] [![alt text][6]][6.2]
29 |
30 | **Artwork:** Jared Langel
31 |
32 | ## Course Link ##
33 |
34 | https://www.codecademy.com/learn/learn-c-plus-plus
35 |
36 | ### Textbook ###
37 |
38 | [Programming Principles and Practice Using C++](https://www.amazon.com/Programming-Principles-Practice-Using-C/dp/0321543726#customerReviews) (Bjarne Stroustrup)
39 |
40 | ## 1. Hello World ##
41 |
42 | ```
43 | $ g++ hello.cpp -o hello
44 | $ ./hello
45 | ```
46 |
47 | - [x] [`hello.cpp`](1-hello-world/hello.cpp)
48 | - [x] [`pattern.cpp`](1-hello-world/pattern.cpp)
49 | - [x] [`letter.cpp`](1-hello-world/letter.cpp)
50 | - [x] [`spell.cpp`](1-hello-world/spell.cpp)
51 |
52 | **Block Letters:**
53 |
54 | - [x] [`initials.cpp`](1-hello-world/block-letters/initials.cpp)
55 | - [x] [`snowman.cpp`](1-hello-world/block-letters/snowman.cpp)
56 | - [x] [`codecademy.cpp`](1-hello-world/block-letters/codecademy.cpp)
57 | - [x] [`daftpunk.cpp`](1-hello-world/block-letters/daftpunk.cpp)
58 |
59 | ## 2. Variables ##
60 |
61 | - [x] [`temperature1.cpp`](2-variables/temperature1.cpp)
62 | - [x] [`temperature2.cpp`](2-variables/temperature2.cpp)
63 | - [x] [`bmi.cpp`](2-variables/bmi.cpp)
64 |
65 | **Dog Years:**
66 |
67 |
68 | - [x] [`dog_years1.cpp`](2-variables/dog-years/dog_years1.cpp)
69 | - [x] [`dog_years2.cpp`](2-variables/dog-years/dog_years2.cpp)
70 | - [x] [`snoop_dog.cpp`](2-variables/dog-years/snoop_dog.cpp)
71 |
72 | **Quadratic Formula:**
73 |
74 |
75 | - [x] [`quadratic.cpp`](2-variables/quadratic-formula/quadratic.cpp)
76 |
77 | **Piggy Bank:**
78 |
79 |
80 | - [x] [`currency.cpp`](2-variables/piggy-bank/currency.cpp)
81 |
82 | ## 3. Conditionals & Logic ##
83 |
84 | - [x] [`coinflip.cpp`](3-conditionals-and-logic/coinflip.cpp)
85 | - [x] [`grade.cpp`](3-conditionals-and-logic/grade.cpp)
86 | - [x] [`pH.cpp`](3-conditionals-and-logic/pH.cpp)
87 | - [x] [`pokedex.cpp`](3-conditionals-and-logic/pokedex.cpp)
88 | - [x] [`space.cpp`](3-conditionals-and-logic/space.cpp)
89 | - [x] [`leap_year.cpp`](3-conditionals-and-logic/leap_year.cpp)
90 |
91 | **Magic 8-Ball:**
92 |
93 |
94 | - [x] [`magic8.cpp`](3-conditionals-and-logic/magic-8-ball/magic8.cpp)
95 |
96 | **Harry Potter Sorting Hat:**
97 |
98 |
99 | - [x] [`sortinghat.cpp`](3-conditionals-and-logic/harry-potter-sorting-hat/sortinghat.cpp)
100 |
101 | **Rock Paper Scissors Lizard Spock:**
102 |
103 |
104 | - [x] [`RPS.cpp`](3-conditionals-and-logic/rock-paper-scissors-lizard-spock/RPS.cpp)
105 | - [x] [`RPSLS.cpp`](3-conditionals-and-logic/rock-paper-scissors-lizard-spock/RPSLS.cpp)
106 | - [x] [`RPSLS_if.cpp`](3-conditionals-and-logic/rock-paper-scissors-lizard-spock/RPSLS_if.cpp)
107 | - [x] [`RPSLS_switch.cpp`](3-conditionals-and-logic/rock-paper-scissors-lizard-spock/RPSLS_switch.cpp)
108 |
109 | ## 4. Loops ##
110 |
111 | - [x] [`enter_pin.cpp`](4-loops/enter_pin.cpp)
112 | - [x] [`guess.cpp`](4-loops/guess.cpp)
113 | - [x] [`square.cpp`](4-loops/square.cpp)
114 | - [x] [`troublemaker.cpp`](4-loops/troublemaker.cpp)
115 | - [x] [`99bottles.cpp`](4-loops/99bottles.cpp)
116 |
117 | **Fizz Buzz:**
118 |
119 |
120 | - [x] [`fizzbuzz.cpp`](4-loops/fizzbuzz/fizzbuzz.cpp)
121 |
122 | ## 5. Vectors ##
123 |
124 | - [ ] `tokyo.cpp`
125 | - [x] [`oddeven.cpp`](5-vectors/oddeven.cpp)
126 |
127 | **Whale Talk:**
128 |
129 | - [x] [`whale.cpp`](5-vectors/whale.cpp)
130 |
131 | ## 6. Functions ##
132 |
133 | **UFO:**
134 |
135 | - [x] [UFO](6-functions)
136 |
137 | ## 7. Classes & Objects ##
138 |
139 | **The Object of Your Affection:**
140 |
141 | - [x] [The Object of Your Affection](7-classes-and-objects)
142 |
143 | ## 8. References & Pointers ##
144 |
145 | - [ ] `pointers.cpp`
146 |
147 | **Bleep:**
148 |
149 | - [x] [`bleep.cpp`](8-references-and-pointers/bleep/bleep.cpp) [`functions.cpp`](8-references-and-pointers/bleep/functions.cpp) [`functions.hpp`](8-references-and-pointers/bleep/functions.hpp)
150 |
151 | ---
152 |
153 | ### Cheatsheets ###
154 |
155 | 1. [Hello World](https://www.codecademy.com/learn/learn-c-plus-plus/modules/learn-cpp-hello-world/reference)
156 | 2. [Variables](https://www.codecademy.com/learn/learn-c-plus-plus/modules/learn-cpp-variables/reference)
157 | 3. [Conditionals & Logic](https://www.codecademy.com/learn/learn-c-plus-plus/modules/learn-cpp-conditionals-and-logic/reference)
158 | 4. [Loops](https://www.codecademy.com/learn/learn-c-plus-plus/modules/learn-cpp-loops/reference)
159 | 5. [Vectors](https://www.codecademy.com/learn/learn-c-plus-plus/modules/learn-cpp-vectors/reference)
160 | 6. [Functions](https://www.codecademy.com/learn/learn-c-plus-plus/modules/learn-cpp-functions/reference)
161 | 7. [Classes & Objects](https://www.codecademy.com/learn/learn-c-plus-plus/modules/learn-cpp-classes-and-objects/reference)
162 | 8. [References & Pointers](https://www.codecademy.com/learn/learn-c-plus-plus/modules/learn-cpp-references-and-pointers/reference)
163 |
164 | ### Talking C++ ###
165 |
166 | 1. [Talking C++: Interview with Simon Brand](https://dev.to/codecademy/talking-c-interview-with-simon-brand-3gma)
167 | 2. [Talking C++: Interview with Bjarne Stroustroup](https://news.codecademy.com/bjarne-stroustrup-interview/)
168 |
169 | ### Community Challenge ###
170 |
171 | * https://dev.to/codecademy/c-community-challenge-3l8m
172 |
173 | ### Style Guides ###
174 |
175 | * Codecademy C++ Style Guide
176 | * [Microsoft C++ Style Guide](https://github.com/Microsoft/AirSim/blob/master/docs/coding_guidelines.md)
177 | * [Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html)
178 |
179 | ### Hall of Fame ###
180 |
181 | * TBA
182 |
183 |
184 |
185 |
186 |
187 | ## Contribution Guidelines
188 |
189 | We'd love to have you contribute!
190 |
191 | Please note that this project is released with a [Contributor Covenant](https://www.contributor-covenant.org).
192 | By participating in this project you agree to abide by its terms.
193 |
--------------------------------------------------------------------------------
/blogs/belllabs.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/blogs/belllabs.jpeg
--------------------------------------------------------------------------------
/blogs/bjarne_stroustrup.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/blogs/bjarne_stroustrup.jpeg
--------------------------------------------------------------------------------
/blogs/simon_brand.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/blogs/simon_brand.png
--------------------------------------------------------------------------------
/blogs/simon_brand.sketch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/blogs/simon_brand.sketch
--------------------------------------------------------------------------------
/blogs/stackoverflow1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/blogs/stackoverflow1.png
--------------------------------------------------------------------------------
/blogs/stackoverflow2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/blogs/stackoverflow2.png
--------------------------------------------------------------------------------
/blogs/stackoverflow3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/blogs/stackoverflow3.png
--------------------------------------------------------------------------------
/blogs/stackoverflow4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/blogs/stackoverflow4.png
--------------------------------------------------------------------------------
/blogs/stackoverflow5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/blogs/stackoverflow5.png
--------------------------------------------------------------------------------
/challenge-projects/tic-tac-toe/play.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "play.hpp"
3 |
4 | std::string board[9] = {" ", " ", " ", " ", " ", " ", " ", " ", " "};
5 | int player = 1;
6 | int position = 0;
7 |
8 | void introduction() {
9 |
10 | std::cout << "Press [Enter] to begin: ";
11 | std::cin.ignore();
12 |
13 | std::cout << "\n";
14 |
15 | std::cout << "===========\n";
16 | std::cout << "Tic-Tac-Toe\n";
17 | std::cout << "===========\n\n";
18 |
19 | std::cout << "Player 1) ✖\n";
20 | std::cout << "Player 2) ⊙\n\n";
21 |
22 | std::cout << "Here's the 3 x 3 grid:\n\n";
23 |
24 | std::cout << " | | \n";
25 | std::cout << " 1 | 2 | 3 \n";
26 | std::cout << "_____|_____|_____ \n";
27 | std::cout << " | | \n";
28 | std::cout << " 4 | 5 | 6 \n";
29 | std::cout << "_____|_____|_____ \n";
30 | std::cout << " | | \n";
31 | std::cout << " 7 | 8 | 9 \n";
32 | std::cout << " | | \n\n";
33 |
34 | }
35 |
36 | bool is_winner() {
37 |
38 | bool winner = false;
39 | // rows
40 | if ((board[0] == board[1]) && (board[1] == board[2]) && board[0] != " ") {
41 | winner = true;
42 | } else if ((board[3] == board[4]) && (board[3] == board[5]) && board[3] != " ") {
43 | winner = true;
44 | } else if ((board[6] == board[7]) && (board[6] == board[8]) && board[6] != " ") {
45 | winner = true;
46 | }
47 | // columns
48 | else if ((board[0] == board[3]) && (board[0] == board[6]) && board[0] != " ") {
49 | winner = true;
50 | } else if ((board[1] == board[4]) && (board[1] == board[7]) && board[1] != " ") {
51 | winner = true;
52 | } else if ((board[2] == board[5]) && (board[2] == board[8]) && board[2] != " ") {
53 | winner = true;
54 | } // diagonals
55 | else if ((board[0] == board[4]) && (board[0] == board[8]) && board[0] != " ") {
56 | winner = true;
57 | }
58 | else if ((board[2] == board[4]) && (board[2] == board[6]) && board[2] != " ") {
59 | winner = true;
60 | }
61 |
62 | return winner;
63 |
64 | }
65 |
66 | bool filled_up() {
67 |
68 | bool filled = true;
69 |
70 | for (int i = 0; i < 9; i++) {
71 |
72 | if (board[i] == " ") {
73 |
74 | filled = false;
75 |
76 | }
77 |
78 | }
79 |
80 | return filled;
81 |
82 | }
83 | void draw() {
84 |
85 | std::cout << " | | \n";
86 |
87 | std::cout << " " << board[0] << " | " << board[1] << " | " << board[2] << "\n";
88 |
89 | std::cout << "_____|_____|_____ \n";
90 | std::cout << " | | \n";
91 |
92 | std::cout << " " << board[3] << " | " << board[4] << " | " << board[5] << "\n";
93 |
94 | std::cout << "_____|_____|_____ \n";
95 | std::cout << " | | \n";
96 |
97 | std::cout << " " << board[6] << " | " << board[7] << " | " << board[8] << "\n";
98 | std::cout << " | | \n";
99 |
100 | std::cout << "\n";
101 |
102 | }
103 |
104 | void set_position() {
105 |
106 | std::cout << "Player " << player << "'s Turn (Enter 1-9): ";
107 |
108 | while (!(std::cin >> position)) {
109 |
110 | std::cout << "Player " << player << ", please enter a valid number between 1 and 9: ";
111 | std::cin.clear();
112 | std::cin.ignore();
113 |
114 | }
115 |
116 | std::cout << "\n";
117 |
118 | while (board[position-1] != " ") {
119 |
120 | std::cout << "Oops, there's already something in that position!\n\n";
121 |
122 | std::cout << "Player " << player << "'s Turn (Enter 1-9): ";
123 | std::cin >> position;
124 |
125 | std::cout << "\n";
126 | }
127 |
128 | }
129 |
130 | void update_board() {
131 |
132 | if (player % 2 == 1) {
133 |
134 | board[position-1] = "✖";
135 |
136 | } else {
137 |
138 | board[position-1] = "⊙";
139 |
140 | }
141 |
142 | }
143 |
144 | void change_player() {
145 |
146 | if (player == 1) {
147 |
148 | player++;
149 |
150 | } else {
151 |
152 | player--;
153 |
154 | }
155 |
156 | }
157 |
158 | void take_turn() {
159 |
160 | while ( !is_winner() && !filled_up() ) {
161 |
162 | set_position();
163 |
164 | update_board();
165 |
166 | change_player();
167 |
168 | draw();
169 |
170 | }
171 |
172 | }
173 |
174 | void end_game() {
175 |
176 | if (is_winner()) {
177 | std::cout << "There's a winner!\n";
178 | }
179 | else if (filled_up()) {
180 | std::cout << "There's a tie!\n";
181 | }
182 |
183 | }
184 |
185 |
--------------------------------------------------------------------------------
/challenge-projects/tic-tac-toe/play.hpp:
--------------------------------------------------------------------------------
1 | bool is_winner();
2 | bool filled_up();
3 | void introduction();
4 | void take_turn();
5 | void set_position();
6 | void update_board();
7 | void change_player();
8 | void draw();
9 | void end_game();
--------------------------------------------------------------------------------
/challenge-projects/tic-tac-toe/ttt.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "play.hpp"
3 |
4 | int main() {
5 |
6 | introduction();
7 |
8 | take_turn();
9 |
10 | end_game();
11 |
12 | }
--------------------------------------------------------------------------------
/cheatsheets/cheatsheet1.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/cheatsheets/cheatsheet1.pdf
--------------------------------------------------------------------------------
/cheatsheets/cheatsheet2.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/cheatsheets/cheatsheet2.pdf
--------------------------------------------------------------------------------
/community-challenge/May-24-2019 11-28-25.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/community-challenge/May-24-2019 11-28-25.gif
--------------------------------------------------------------------------------
/community-challenge/README.md:
--------------------------------------------------------------------------------
1 | # C++ Community Challenge
2 |
3 | ## What is this this all about? ##
4 |
5 | Dear Pro learner,
6 |
7 | You have started learning the ABC's of C++. And now it's time to take your learning to the next level with the C++ Community Challenge.
8 |
9 | This is your opportunity to team up with other C++ learners, build something amazing together using vectors and functions, and show it off to the world. It is beginner-friendly and... you can win prizes!
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/community-challenge/gif.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/community-challenge/gif.gif
--------------------------------------------------------------------------------
/community-challenge/highfive.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/community-challenge/highfive.gif
--------------------------------------------------------------------------------
/community-challenge/prizes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/community-challenge/prizes.png
--------------------------------------------------------------------------------
/community-challenge/project-ideas.md:
--------------------------------------------------------------------------------
1 | # C++ Community Challenge
2 |
3 | ## Project Ideas ##
4 |
5 | **Terminal Programs:**
6 |
7 | - NYC MetroCard Calculator
8 | - [Tic-Tac-Toe](https://en.wikipedia.org/wiki/Tic-tac-toe)
9 | - [Battleship](https://en.wikipedia.org/wiki/Battleship_(game))
10 | - [Connect Four](https://en.wikipedia.org/wiki/Connect_Four)
11 | - [Blackjack](https://en.wikipedia.org/wiki/Blackjack)
12 | - [Minesweeper](https://en.wikipedia.org/wiki/Microsoft_Minesweeper)
13 | - [Who Wants to Be a Millionaire](https://en.wikipedia.org/wiki/Who_Wants_to_Be_a_Millionaire%3F)
14 | - Text-Based Adventure
15 | - [Tarot Reading](https://en.wikipedia.org/wiki/Tarot)
16 | - Horoscope
17 | - To-Do List
18 | - Bank Management System
19 | - Hardware project with Arduino
20 |
21 | **More Ambitious Ideas:**
22 |
23 | - [Tron](https://en.wikipedia.org/wiki/Tron_(video_game))
24 | - [Pong](https://en.wikipedia.org/wiki/Pong)
25 | - [Breakout](https://en.wikipedia.org/wiki/Breakout_(video_game))
26 | - [Snake](https://en.wikipedia.org/wiki/Snake_(video_game_genre))
27 | - [Space Invaders](https://en.wikipedia.org/wiki/Space_Invaders)
28 | - [2048](https://en.wikipedia.org/wiki/2048_(video_game))
29 | - [Tetris](https://en.wikipedia.org/wiki/Tetris)
30 | - [T-Rex Run!](https://elgoog.im/t-rex/)
31 |
32 | - If you are interested in hardware, try some beginner Arduino projects!
33 |
34 | **Example:**
35 |
36 |
37 |
--------------------------------------------------------------------------------
/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/logo.png
--------------------------------------------------------------------------------
/other/Screen Shot 2019-02-01 at 1.28.26 PM.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/other/Screen Shot 2019-02-01 at 1.28.26 PM.png
--------------------------------------------------------------------------------
/other/Screen Shot 2019-02-01 at 1.28.36 PM.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/other/Screen Shot 2019-02-01 at 1.28.36 PM.png
--------------------------------------------------------------------------------
/other/Screen Shot 2019-02-05 at 6.09.25 PM.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/other/Screen Shot 2019-02-05 at 6.09.25 PM.png
--------------------------------------------------------------------------------
/other/Screen Shot 2019-02-13 at 12.34.27 PM.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/other/Screen Shot 2019-02-13 at 12.34.27 PM.png
--------------------------------------------------------------------------------
/other/Screen Shot 2019-02-13 at 12.34.32 PM.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/other/Screen Shot 2019-02-13 at 12.34.32 PM.png
--------------------------------------------------------------------------------
/other/Screen Shot 2019-02-13 at 12.34.37 PM.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/other/Screen Shot 2019-02-13 at 12.34.37 PM.png
--------------------------------------------------------------------------------
/other/Screen Shot 2019-02-13 at 12.40.08 PM.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/other/Screen Shot 2019-02-13 at 12.40.08 PM.png
--------------------------------------------------------------------------------
/other/Screen Shot 2019-02-13 at 12.40.13 PM.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/other/Screen Shot 2019-02-13 at 12.40.13 PM.png
--------------------------------------------------------------------------------
/other/Screen Shot 2019-02-14 at 1.49.31 PM.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/other/Screen Shot 2019-02-14 at 1.49.31 PM.png
--------------------------------------------------------------------------------
/other/location.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Codecademy/learn-cpp/14d939c166383abf3ab793d1b6031a2157831fd1/other/location.png
--------------------------------------------------------------------------------