Commit 35b1bafb authored by Michael's avatar Michael

michael.davityan:exercise_07_37v3

parent 718e90bd
......@@ -2,7 +2,7 @@ progname=exercise_07_37
CC=g++
CFLAGS=-Wall -Wextra -Werror -g3
all: test1
all: test1 test2
debug/$(progname): debug/$(progname).o
$(CC) $(CFLAGS) $< -o $@
......
......@@ -39,29 +39,42 @@ inputCharArray(char array[], const size_t sizeOfArray)
int
main()
{
const int BUFFER_SIZE = 10;
if (::isatty(STDIN_FILENO)) {
std::cout << "Insert integers array size and elements.\n" << "size: ";
std::cout << "Insert integers array size and elements(size must be <= 10).\n" << "size: ";
}
size_t integersArraySize;
std::cin >> integersArraySize;
if (integersArraySize > BUFFER_SIZE) {
std::cerr << "Error 1: size must be less or equal to 10.\n";
return 1;
}
int integersArray[integersArraySize];
inputNumericArray(integersArray, integersArraySize);
std::cout << "Minimum is: " << recursiveMinimum(integersArray, integersArraySize - 1);
std::cout << std::endl;
if (::isatty(STDIN_FILENO)) {
std::cout << "Insert floating numbers array size and elements.\n" << "size: ";
std::cout << "Insert floating numbers array size and elements(size must be <= 10).\n" << "size: ";
}
size_t floatingArraySize;
std::cin >> floatingArraySize;
if (integersArraySize > BUFFER_SIZE) {
std::cerr << "Error 1: size must be less or equal to 10.\n";
return 1;
}
double floatingArray[floatingArraySize];
inputNumericArray(floatingArray, floatingArraySize);
std::cout << "Minimum is: " << recursiveMinimum(floatingArray, floatingArraySize - 1);
std::cout << std::endl;
if (::isatty(STDIN_FILENO)) {
std::cout << "Insert characters array size and elements.\n" << "size: ";
std::cout << "Insert characters array size and elements(size must be <= 10).\n" << "size: ";
}
size_t charactersArraySize;
std::cin >> charactersArraySize;
if (integersArraySize > BUFFER_SIZE) {
std::cerr << "Error 1: size must be less or equal to 10.\n";
return 1;
}
char charactersArray[charactersArraySize];
inputCharArray(charactersArray, charactersArraySize);
std::cout << "Minimum is: " << recursiveMinimum(charactersArray, charactersArraySize - 2);
......
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