From fcf1aa65f47b0afb202aa23512e4579e79d2880d Mon Sep 17 00:00:00 2001 From: Reshief Luminon <reshief@gmx.net> Date: Tue, 22 Oct 2019 04:24:21 +0200 Subject: [PATCH] Add tasks to train understanding of c++ --- src/task_1.cpp | 8 ++++++++ src/task_2.cpp | 9 +++++++++ src/task_3.cpp | 11 +++++++++++ src/task_4.cpp | 10 ++++++++++ src/task_5.cpp | 11 +++++++++++ 5 files changed, 49 insertions(+) create mode 100644 src/task_1.cpp create mode 100644 src/task_2.cpp create mode 100644 src/task_3.cpp create mode 100644 src/task_4.cpp create mode 100644 src/task_5.cpp diff --git a/src/task_1.cpp b/src/task_1.cpp new file mode 100644 index 0000000..bbb3620 --- /dev/null +++ b/src/task_1.cpp @@ -0,0 +1,8 @@ +#include <iostream> + +/* + For this task, read in a number n on cin and print out the first n square numbers each in their own line +*/ +int main(int argc, char **argv) { + return 0; +} \ No newline at end of file diff --git a/src/task_2.cpp b/src/task_2.cpp new file mode 100644 index 0000000..6999b59 --- /dev/null +++ b/src/task_2.cpp @@ -0,0 +1,9 @@ +#include <iostream> + +/* + For this task, read in an integer n on cin and determine whether it is a prime number or not. + Print out "Prime!" (without the apostrophes) if it is a prime number or "Worthless..." (without the apostrophes) otherwise. +*/ +int main(int argc, char **argv) { + return 0; +} \ No newline at end of file diff --git a/src/task_3.cpp b/src/task_3.cpp new file mode 100644 index 0000000..6d43968 --- /dev/null +++ b/src/task_3.cpp @@ -0,0 +1,11 @@ +#include <iostream> + +/* +For this task, read in a number n on cin and print out the first n numbers of the fibonacci series each in their own line. +The first Fibonacci number is chosen to be 0. +The second Fibonacci number is chosen to be 1. +The i+2'nd Fibonacci number is calculated recursively as the sum of the i'th and the i+1'st Fibonacci numbers. +*/ +int main(int argc, char **argv) { + return 0; +} \ No newline at end of file diff --git a/src/task_4.cpp b/src/task_4.cpp new file mode 100644 index 0000000..f7ae931 --- /dev/null +++ b/src/task_4.cpp @@ -0,0 +1,10 @@ +#include <iostream> + +/* +For this task, read in a number n which will be given as a string of arbitrary length (an integer may not be large enough to store it). +Determine whether the number is a palindrome (the same when read forward or backward) or not. +If so, print out "A man, a plan, a canal -- Panama.", if not print out "Pitiful!" +*/ +int main(int argc, char **argv) { + return 0; +} \ No newline at end of file diff --git a/src/task_5.cpp b/src/task_5.cpp new file mode 100644 index 0000000..c769104 --- /dev/null +++ b/src/task_5.cpp @@ -0,0 +1,11 @@ +#include <iostream> + +/* +For this task, read in a number n on cin. +Following that there will be n distinct integers to be read from stdin. +Once these numbers have been read, one more integer k between 0 and n (at most n-1) will be provided. +Print out the k'th largest of the n numbers previously read from stdin +*/ +int main(int argc, char **argv) { + return 0; +} \ No newline at end of file -- GitLab