# CategoryChapter 04 – Principles and Practice Using C++

## prime number generator

Bjarne Stroustrup “Programming Principles and Practice Using C++” Chapter 4 Exercise 11 Using std_lib_facilities.h by Bjarne Stroustrup. [code language=”cpp”] // Philipp Siedler // Bjarne Stroustrup’s PP // Chapter 4 Exercise 11 #include "std_lib_facilities.h" int main() { int max = 100; vector<int> seriesNum;…

## rock, paper, scissors game

Bjarne Stroustrup “Programming Principles and Practice Using C++” Chapter 4 Exercise 10 Using std_lib_facilities.h by Bjarne Stroustrup. [code language=”cpp”] // Philipp Siedler // Bjarne Stroustrup’s PP // Chapter 4 Exercise 10 #include "std_lib_facilities.h" int main() try { int rndNum; string illegalRndInput; string…

## chess board grain counter [int and double]

Bjarne Stroustrup “Programming Principles and Practice Using C++” Chapter 4 Exercise 9 Using std_lib_facilities.h by Bjarne Stroustrup. [code language=”cpp”] // Philipp Siedler // Bjarne Stroustrup’s PP // Chapter 4 Exercise 9 #include "std_lib_facilities.h" int main() { cout << "Grains on chess board…

## chess board grain number calculator

Bjarne Stroustrup “Programming Principles and Practice Using C++” Chapter 4 Exercise 8 Using std_lib_facilities.h by Bjarne Stroustrup. [code language=”cpp”] // Philipp Siedler // Bjarne Stroustrup’s PP // Chapter 4 Exercise 8 #include "std_lib_facilities.h" int main() { int squareNum = 1; int grainCount…

## spelled out number calculator

Bjarne Stroustrup “Programming Principles and Practice Using C++” Chapter 4 Exercise 7 Using std_lib_facilities.h by Bjarne Stroustrup. [code language=”cpp”] // Philipp Siedler // Bjarne Stroustrup’s PP // Chapter 4 Exercise 7 #include "std_lib_facilities.h" vector<string> numbers; void initNumbers() { numbers.push_back("zero"); numbers.push_back("one"); numbers.push_back("two"); numbers.push_back("three");…

## digit and spelled out integers

Bjarne Stroustrup “Programming Principles and Practice Using C++” Chapter 4 Exercise 6 Using std_lib_facilities.h by Bjarne Stroustrup. [code language=”cpp”] // Philipp Siedler // Bjarne Stroustrup’s PP // Chapter 4 Exercise 6 #include "std_lib_facilities.h" vector<string> numbers; void initNumbers(){ numbers.push_back("zero"); numbers.push_back("one"); numbers.push_back("two"); numbers.push_back("three"); numbers.push_back("four");…

## simple calculator

Bjarne Stroustrup “Programming Principles and Practice Using C++” Chapter 4 Exercise 5 Using std_lib_facilities.h by Bjarne Stroustrup. [code language=”cpp”] // Philipp Siedler // Bjarne Stroustrup’s PP // Chapter 4 Exercise 5 #include "std_lib_facilities.h" int main() { double value1 = 0.0; double value2…

## numbers guessing game

Bjarne Stroustrup “Programming Principles and Practice Using C++” Chapter 4 Exercise 4 Using std_lib_facilities.h by Bjarne Stroustrup. [code language=”cpp”] // Philipp Siedler // Bjarne Stroustrup’s PP // Chapter 4 Exercise 4 #include "std_lib_facilities.h" int main() { int max = 100; int min…

## mean using a vector

Bjarne Stroustrup “Programming Principles and Practice Using C++” Chapter 4 Exercise 3 Using std_lib_facilities.h by Bjarne Stroustrup. [code language=”cpp”] // Philipp Siedler // Bjarne Stroustrup’s PP // Chapter 4 Exercise 3 #include "std_lib_facilities.h" int main() { vector<double> distances; double distance; cout <<…

## median using a vector

Bjarne Stroustrup “Programming Principles and Practice Using C++” Chapter 4 Exercise 2 Using std_lib_facilities.h by Bjarne Stroustrup. [code language=”cpp”] // Philipp Siedler // Bjarne Stroustrup’s PP // Chapter 4 Exercise 2 #include "std_lib_facilities.h" int main() { vector<double> temps; double temp; cout <<…