Commit 56b8c36f authored by Michael's avatar Michael

exercise_07_35v4

parent aeec71fc
......@@ -6,16 +6,10 @@ template <typename T>
void
printArray(const T array[], const size_t sizeOfArray, const size_t firstIdx = 0)
{
if (1 == sizeof(T) && firstIdx == sizeOfArray - 1) {
std::cout << std::endl;
return;
}
if (firstIdx < sizeOfArray) {
std::cout << array[firstIdx];
std::cout << (sizeof(T) > 1 ? " " : "");
std::cout << array[firstIdx] << " ";
return printArray(array, sizeOfArray, firstIdx + 1);
}
std::cout << std::endl;
}
template <typename T>
......@@ -50,6 +44,7 @@ main()
int integersArray[integersArraySize];
inputNumericArray(integersArray, integersArraySize);
printArray(integersArray, integersArraySize);
std::cout << std::endl;
if (::isatty(STDIN_FILENO)) {
std::cout << "Insert floating numbers array size and elements.\n" << "size: ";
}
......@@ -58,6 +53,7 @@ main()
double floatingArray[floatingArraySize];
inputNumericArray(floatingArray, floatingArraySize);
printArray(floatingArray, floatingArraySize);
std::cout << std::endl;
if (::isatty(STDIN_FILENO)) {
std::cout << "Insert characters array size and elements.\n" << "size: ";
}
......@@ -65,6 +61,7 @@ main()
std::cin >> charactersArraySize;
char charactersArray[charactersArraySize];
inputCharArray(charactersArray, charactersArraySize);
printArray(charactersArray, charactersArraySize);
printArray(charactersArray, charactersArraySize - 1);
std::cout << std::endl;
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment