T

@thomascutler

5.3 BUILD | Unit 5 Project: Marking Runs

C++
5 months ago
#include <iostream> #include <vector> #include <cstdlib> #include <ctime> #include <random> using namespace std; int main() { const int SIZE = 20;

5.2c Remove Odd Numbers

C++
5 months ago
#include <iostream> using namespace std; int main() { int a[] = {24, 98, 35, 46, 37, 53, 60, 24, 11, 19}; int size_before = 10; int size_after = 0; for (int i = 0; i < size_before; i++)

5.2b Fill an Array

C++
5 months ago
#include <iostream> using namespace std; int main() { const int SIZE = 18; int a[SIZE]; for (int i = 0; i < SIZE; i++) {

5.2a First & Last of Array

C++
5 months ago
#include <iostream> #include <iomanip> using namespace std; int main() { const int LENGTH = 100; double prices[LENGTH]; int number_of_prices = 0;

5.2 DESCRIBE | Arrays in C++

C++
5 months ago
#include <iostream> #include <numeric> int main() { int ages[5] = {21, 19, 35, 42, 28}; std::cout << "Initial Array Values" << std::endl; std::cout << "The first person's age is: " << ages[0] << std::endl; std::cout << "The last person's age is: " << ages[4] << std::endl;

5.1d Remove Odd Numbers From Vector

C++
5 months ago
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { vector<int> my_nums = {22, 98, 95, 46, 31, 53, 82, 24, 11, 19}; my_nums.erase(remove_if(my_nums.begin(), my_nums.end(), [](int num) {

5.1c Fill a Vector

C++
5 months ago
#include <iostream> #include <vector> using namespace std; int main() { vector<int> my_nums; for (int i = 0; i < 18; ++i) {

5.1b First & Last of Vector

C++
5 months ago
#include <iostream> #include <iomanip> #include <vector> using namespace std; int main() { const int LENGTH = 100; vector<double> prices;

5.1a Vector of Vowels

C++
5 months ago
#include <iostream> #include <string> #include <vector> using namespace std; int main() { vector<string> vowels = {"a", "e", "i", "o", "u"}; cout << "vowels: [" << vowels[0];

5.1 Describe | Vectors

C++
5 months ago
#include <iostream> #include <vector> #include <string> int main() { std::vector<std::string> shopping_list; shopping_list.push_back("Apples"); shopping_list.push_back("Milk"); shopping_list.push_back("Bread");

4.3 BUILD | Unit 4 Project: Rolling Dice

C++
5 months ago
#include <iostream> #include <cstdlib> #include <ctime> int simulateExperiment1(int numSimulations, int numRolls) { int wins = 0; int losses = 0; for (int i = 0; i < numSimulations; ++i) { bool win = false;

4.2d Nested Loops: Print Diamond Pattern

C++
5 months ago
#include <iostream> #include <cstdlib> using namespace std; int main() { int number; cin >> number;

4.2c Unique Characters

C++
5 months ago
#include <iostream> #include <string> #include <unordered_map> using namespace std; int main() { cout << "Enter a word: " << endl; string word; cin >> word;

4.2b Last Vowel

C++
5 months ago
#include <iostream> #include <string> using namespace std; int main() { string word; cin >> word; int position = -1;

4.2a First Vowel

C++
5 months ago
#include <iostream> #include <string> #include <cctype> using namespace std; int main() { string word; cin >> word; bool found = false;

4.1d Missing Letters

C++
5 months ago
#include <iostream> #include <string> using namespace std; int main() { string word; cin >> word; cout << "word: " << word << endl;

4.1c How Many Numbers

C++
6 months ago
#include <iostream> using namespace std; int main() { int a; cin >> a; cout << "a: " << a << endl; int b; cin >> b; cout << "b: " << b << endl; int n; cin >> n;

4.1b Reverse Digits

C++
6 months ago
#include <iostream> using namespace std; int main() { cout << "Enter a positive integer: "; int n; cin >> n; while(n > 0){

4.1a Powers of 2 Loop

C++
6 months ago
#include <iostream> using namespace std; int main() { int n; cin >> n; cout << "n: " << n << endl; int power = 1;

4.1 DESCRIBE | Looping Basics

C++
6 months ago
#include <iostream> #include <limits> int main() { int user_number = 0; std::cout << "Please enter a positive whole number (e.g., 5, 10): "; while (!(std::cin >> user_number) || user_number <= 0) { std::cout << "Invalid input! Please enter a POSITIVE whole number: ";