I wish that when entering an age number, I would detect if you press ENTER as a whole number to exit the program.
I know that ENTER = '\ n' but it is compared with char variables and what I use is an entire variable.
How would you do? I already tried with scanf, getchar (), fgets (), they all treat ENTER as char, but I can not use it since I will use inequalities with integers when entering the number age
#include <stdio.h>
#include <math.h>
#include <conio.h>
int main()
{
int edad;
printf("INGRESAR TU EDAD (entero mayor que cero) : \n");
scanf("%d",&edad);
fflush(stdin);
if ( edad<18)
printf("No puedes votar eres menor de edad\n");
else if ( edad >=18)
printf(" Si puedes Votar , eres mayor de edad 18\n");
else ( edad = '\n')
printf(" Pulsaste ENTER , saliendo ..\n");
system("pause");
return 0;
}