Advertisement
kijato

c menü

Mar 13th, 2018
419
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.95 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include <ctype.h>
  6. #define SZ 20
  7. #define M 10
  8. char menu_pontok[5][15]={"Első pont","Második pont","Harmadik pont","Negyedik
  9. pont","V É G E"};
  10. char cim[]=" M E N Ü P O N T O K ";
  11. char ala[]="-----------------------";
  12. char val[]="Kérem válasszon: ";
  13. main()
  14. {
  15. char c;
  16. int xj,yj,xb,yb;
  17. int i;
  18. char valasz;
  19. struct text_info info;
  20. gettextinfo(&info);
  21. textbackground(BLACK);
  22.  
  23. clrscr();
  24. xb=info.screenwidth/2-SZ;
  25. yb=info.screenheight/2-M;
  26. xj=xb+2*SZ;
  27. yj=yb+2*M;
  28. window(xb,yb,xj,yj);
  29. textbackground(YELLOW);
  30. textcolor(BLUE);
  31. clrscr();
  32. gotoxy(20-strlen(cim)/2,2);
  33. cprintf(cim);
  34. gotoxy(20-strlen(cim)/2,3);
  35. cputs(ala);
  36. for (i=0;i<5;i++)
  37. {
  38. gotoxy(12,2*i+6);
  39. cprintf("%2d. %s",i+1,menu_pontok[i]);
  40. }
  41. do
  42. {
  43. gotoxy(12,2*M-3);
  44. cprintf(val);
  45. valasz=getche();
  46. clreol();
  47. }
  48. while(!isdigit(valasz) || valasz>'5' || valasz<'1' );
  49. while ((c=getch()) !=13);
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement