From ce3db91d5778466b4e74a6e985d18ffbe61fcc29 Mon Sep 17 00:00:00 2001 From: fdai7057 Date: Sun, 22 Jan 2023 10:01:41 +0100 Subject: [PATCH] Implementation of function error(). --- src/Error.c | 23 +++++++++++++++++++++++ src/Error.h | 2 ++ 2 files changed, 25 insertions(+) create mode 100644 src/Error.c create mode 100644 src/Error.h diff --git a/src/Error.c b/src/Error.c new file mode 100644 index 0000000..ba552a2 --- /dev/null +++ b/src/Error.c @@ -0,0 +1,23 @@ +#include "Error.h" + +int error(int errorCode) +{ + int returnValue=0; + switch(errorCode){ + case -1: + puts("Login not successful."); + returnValue = -1; + break; + case -2: + puts("Maximum number of attempts reached."); + returnValue = -2; + break; + case -3: + puts("No menu entry available for this number."); + returnValue = -3; + break; + default: + puts("Error code unknown."); + } + return returnValue; +} diff --git a/src/Error.h b/src/Error.h new file mode 100644 index 0000000..5e83c4d --- /dev/null +++ b/src/Error.h @@ -0,0 +1,2 @@ +#include +int error(int);