fork download
  1. #include <stdio.h>
  2. enum jeniskelamin
  3. {
  4. laki_laki,
  5. perempuan
  6. };
  7. main()
  8. {
  9. char nama[60],jawab;
  10. int qtygender ;
  11. lagi :
  12. system("cls");
  13. printf("Masukkan Nama Anda : ");scanf("%s",&nama);
  14. printf("Kelamin \n");
  15. printf("1. Laki-laki \n");
  16. printf("2. Perempuan \n");
  17. printf("3. Keluar dari Program \n");
  18. printf("Pilihan Anda : ");
  19. scanf("%d",&qtygender);
  20. if(qtygender==3) exit(1);
  21. printf("\nNama Anda : %s\n", nama);
  22. if(qtygender==laki_laki+1)
  23. {
  24. printf("Kelamin Anda : Laki-Laki\n");
  25. } else
  26. if(qtygender==perempuan+1)
  27. {
  28. printf("Kelamin Anda : Perempuan\n");
  29. } else
  30. {
  31. printf("Pilihan hanya 1 - 3, silahkan coba lagi.\n");
  32. }
  33. printf("\nMau Coba Lagi [Y/T] :");
  34. jawab=getche();
  35. if(jawab=='Y'||jawab=='y') goto lagi ;
  36. return 0;
  37. }
  38.  
  39.  
Compilation error #stdin compilation error #stdout 0s 9432KB
stdin
Standard input is empty
compilation info
prog.c:7:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
 main()
 ^~~~
prog.c: In function ‘main’:
prog.c:12:5: warning: implicit declaration of function ‘system’ [-Wimplicit-function-declaration]
     system("cls");
     ^~~~~~
prog.c:13:45: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[60]’ [-Wformat=]
     printf("Masukkan Nama Anda : ");scanf("%s",&nama);
                                             ^
prog.c:20:22: warning: implicit declaration of function ‘exit’ [-Wimplicit-function-declaration]
     if(qtygender==3) exit(1);
                      ^~~~
prog.c:20:22: warning: incompatible implicit declaration of built-in function ‘exit’
prog.c:20:22: note: include ‘<stdlib.h>’ or provide a declaration of ‘exit’
prog.c:34:11: warning: implicit declaration of function ‘getche’ [-Wimplicit-function-declaration]
     jawab=getche();
           ^~~~~~
/home/D5rXA9/cc8w0WoB.o: In function `main':
prog.c:(.text.startup+0x3d): undefined reference to `getche'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty