This is just a log of my progress while learning C++. From basic data types to pointers and more.
- Code Wars: Sum of Digits / Digital Root 🚧
- Given n, take the sum of the digits of n. If that value has more than one digit, continue reducing in this way until a single-digit number is produced. The input will be a non-negative integer.
- Franks Carpet Cleaning Console Application
- Used: Function Declaration and Call, Constant Definitions, Arithmetic Operators, Read Input from istream and stored values, printed data to ostream.
- Transportation Problem (Sololearn)
-
You are making a program for a bus service. A bus can transport 50 passengers at once. Given the number of passengers waiting in the bus station as input, you need to calculate and output how many empty seats the last bus will have.
- Vector Section Challenge
-
Practice Initializing and manipulating vectors.
Used: Vector Object Methods, size(), at(), push_back().
- HackerRank String
- Given 2 strings, string a and b:
- In the first line print two space-separated integers, representing the length of a and b respectively.
- In the second line print the string produced by concatenating a and b.
- In the third line print two strings separated by a space, a2 and b2 , and are the same as a and b, respectively, except that their first characters are swapped.
- HackerRank Arrays Introduction
- You will be given an array of N integers and you have to print the integers in the reverse order.
- Cent Converter
-
Write a program that asks the user to enter the following: an integer representing the number of cents. The Program should then display how to provide that change to the user. My denominations are in USD where:
- 100 cents = 1 dollar
- 25 cents = 1 quarter
- 10 cents = 1 dime
- 5 cents = 1 nickel
- HackerRank Basic Datatypes
- Given user input separated by spaces, read in each: int, long, char, float, double. Next output the data on a separate line.
- HackerRank Conditional Statements
- Take user data and use conditional statements to test for specific value.
- HackerRank For Loop
-
You will be given 2 positive integers: a, b. Where (a <= b) separated by a new line.
For each integer n between [a,b] inclusive interval:- if n >= 1 and n <= 9: print the english representation of the number. (ex. 8 -> "eight")
- else if n > 9 and even: print even.
- else if n > 9 and odd: print odd.
- HackerRank Functions Problem
- Given 4 inputs of type int: write a function that will return the greatest value.
- While Loop Exercise
- Given a vector of integers, determine how many integers are present before you see the value -99. Note, it's possible -99 is not in the vector! If -99 is not in the vector then the result will be equal to the number of elements in the vector. The final result should be stored in an integer named count.
- HackerRank Pointer
- Manipulate 2 pointers to have the requested values.
- HackerRank Class
- Define a Student class that has specific Modifiers and Accessors. The class will be given several types of input to assign to its private members.
- Vector Console Menu Appication
-
Users can manipulate values of a Vector Int Array using a console menu. The menu takes the input of the user and performs the corresponding operation on the vector. Upper and Lower cases for each choice are supported. These include :
- "P" - Print All Values in array
- "A" - Add Int to array
- "M" - Print Mean of array
- "S" - Print Smallest int of array
- "L - Print Largest int of array
- "Q" - Quit program
- String Reverse Function
- Program requests user input, and returns the reversed version of the string.
- Text Pyramid
- Write a C++ program that displays a Letter Pyramid from a user-provided std::string. Prompt the user to enter a std::string and then from that string display a Letter Pyramid as follows: If the user enters the string "ABC", then your program should display: A ABA ABCBA -> Each on a separate line with centered spacing
- Classes and Objects
-
Create a class named Student with the following specifications:
- An instance variable named scores to hold a student's exam scores.
- A void input() function that reads 5 integers and saves them to scores
- An int calculateTotalScore() function that returns the sum of the student's scores.