Commit e2971c13 authored by Michael's avatar Michael

michael.davityan:exercise_07_35v4

parent 56b8c36f
......@@ -2,7 +2,7 @@ progname=exercise_07_35
CC=g++
CFLAGS=-Wall -Wextra -Werror -g3
all: test1
all: test1 test2
debug/$(progname): debug/$(progname).o
$(CC) $(CFLAGS) $< -o $@
......
......@@ -36,29 +36,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 than 10.\n";
return 1;
}
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: ";
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 than 10.\n";
return 1;
}
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: ";
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 than 10.\n";
return 1;
}
char charactersArray[charactersArraySize];
inputCharArray(charactersArray, charactersArraySize);
printArray(charactersArray, charactersArraySize - 1);
......
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