Skip to content
Snippets Groups Projects
Commit bb578673 authored by T.Wadi's avatar T.Wadi
Browse files

getNumber function implimented

parent 1cd06197
No related branches found
No related tags found
No related merge requests found
......@@ -124,4 +124,22 @@ int getText(char* prompt, unsigned int maxLength, char** pointerToString, int st
return -1;
}
else return 0;
}
/*******************************************************************************************************************************************/
/* function receives a prompt as a string,, a pointer to an integer, two unsigned integers to define the ***********************************/
/* max and min, a pointer to an integer,****************************************************************************************************/
/* and delevers a boolen value as return ***************************************************************************************************/
/*******************************************************************************************************************************************/
int getNumber(char* prompt, int* pointerToInteger, unsigned int min, unsigned int max){
int input;
if(!pointerToInteger) return 0;
do
{
puts(prompt);
scanf("%i",&input);
clearBuffer();
*pointerToInteger = input;
} while ((input < min) || (input > max));
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ void clearBuffer();
void waitForEnter();
int askYesOrNo(char*);
void printLogo ();
void delay(unsigned int number_of_seconds);
void delay(unsigned int );
void printLine(char, unsigned int);
int getText(char*,unsigned int,char **,int);
int getNumber(char* , int* , unsigned int , unsigned int );
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment