Guest User

Untitled

a guest
Jan 23rd, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.80 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <ctype.h>
  3. #include <stdlib.h>
  4. #define TRUE 1
  5. #define FALSE 0
  6.  
  7.  
  8. void FinDatos(int* continua)
  9. {
  10.     char respuesta;
  11.    
  12.     do {
  13.         if(respuesta != 10)
  14.             printf("¿Desea ingresar datos?  s: Si   n:No: ");
  15.         respuesta=fgetc(stdin);
  16.     } while ((tolower(respuesta) !='s') && (tolower(respuesta) !='n'));
  17.  
  18.     *continua=0;
  19.  
  20.     if (tolower(respuesta) =='s')
  21.         *continua=1;
  22.    
  23. }
  24.  
  25. int main()
  26. {
  27.     int sigue;
  28.     FinDatos(&sigue);                                           //Pregunto si desea ingresar el primer par de datos.
  29.     if (sigue)                                              //Si ingresó los primeros datos proceso.
  30.         {
  31.             printf("dentro del if de main\n");
  32.             while (sigue)
  33.             {
  34.                 printf("Ingrese un par de numeros enteros: \n");
  35.                 FinDatos(&sigue);
  36.  
  37.             }
  38.         }
  39.     else
  40.         printf("No se ingresaron datos\n");
  41.        
  42.     return EXIT_SUCCESS;
  43.  
  44. }
Add Comment
Please, Sign In to add comment