C/stdlib.h/exit — различия между версиями

Материал из C\C++ эксперт
Перейти к: навигация, поиск
м (1 версия: Импорт контента...)
 
м (1 версия: Импорт контента...)
 
(нет различий)

Текущая версия на 10:23, 25 мая 2010

exit: causes immediate, normal termination of a program

    
//Declaration: void exit(int exit_code); 
  #include <stdlib.h>
  #include <stdio.h>
  int main(void)
  {
    char choice;
    do {
      printf("Enter names (E)\n");
      printf("Delete name (D)\n");
      printf("Print (P)\n");
      printf("Quit (Q)\n");
      choice = getchar();
    } while(!strchr("EDPQ", toupper(choice)));
    if(choice=="Q") exit(0);
    return choice;
  }