An open API service indexing awesome lists of open source software.

https://github.com/haimonmon/cpp-practice-hub

learning C++ with short simple exercises
https://github.com/haimonmon/cpp-practice-hub

cpp learn-to-code learning-exercise practice-programming programming-language

Last synced: 11 months ago
JSON representation

learning C++ with short simple exercises

Awesome Lists containing this project

README

          


C++ Practice Hub

Written on C plus plus badge


This repository presents a collection of small exercises to help me become familiar with C++ programming.




## Contents
* [ Water Consumption Calculator ](#water-consumption-calculator)
* [ Basic Arithmetic Calculator ](#basic-arithmetic-calculator)
* [ Palindrome ](#palindrome)
* [ Piggy Bank ](#piggy-bank)
* [ First Three Multiple ](#first-three-multiple)
* [ Tenth Power ](#tenth-power)
* [ Dog Years ](#dog-years)
* [ Quadratic Formula ](#quadratic-formula)

## Water Consumption Calculator


## Basic Arithmetic Calculator


## Palindrome
Define a function is_palindrome() that takes:

An std::string parameter text.
The function should return:

true if text is a palindrome.

false if text is not a palindrome.

(A palindrome is any text that has the same characters backwards as it does forwards. For example, “hannah” and “racecar” are palindromes, while “menu” and “aardvark” are not.)

We will not test for edge cases such as capitalization or spaces.

### Example Output
```cpp

int main()
{

std::cout << is_palindrome("madam") << "\n"; // 1
std::cout << is_palindrome("ada") << "\n"; // 1
std::cout << is_palindrome("lovelace") << "\n"; // 0

}

```
##


## Piggy Bank


## First Three Multiple
Write a function named first_three_multiples() that has:

An int parameter named num.
The function should return an std::vector of the first three multiples of num in ascending order.

### Example Output
```cpp

int main()
{
for (int num: first_three_multiples(7))
{
std::cout << num << std::endl; // 7, 14, 21
}
}

```
##


## Tenth Power
Write a function named tenth_power() that has:

An int parameter named num.

The function should return num raised to the 10th power.

### Example Output
```cpp

int main()
{
std::cout << tenth_power(0) << "\n"; // 0
std::cout << tenth_power(1) << "\n"; // 1
std::cout << tenth_power(2) << "\n"; // 32
}

```

## Dog Years


## Quadratic Formula