Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Készítsen menüt, amelyben a menüpontok a következők:
- 1. Tomb feltoltese
- 2. Legnagyobb ertek meghatarozasa
- 3. Kilepes (q)
- A tömb 5 int szám.
- */
- #include <conio.h>
- #define ESC 0X1B
- void bekeres (int*);
- int maximum (int *p1);
- int tmb[5];
- int main ()
- {
- int x;
- while (1)
- {
- system("cls");
- printf("Press a key. Escape to EXIT\n");
- printf ("1. Tomb feltoltese\n");
- printf ("2. Legnagyobb ertek meghatarozasa\n");
- printf ("3. Kilepes (ESC)\n");
- x=getch ();
- switch (x)
- {case '1': bekeres(tmb); break;
- case '2': maximum (tmb); break;
- }
- if (x==ESC) break;
- }
- return 0;
- }
- void bekeres (int* p)
- {
- int i;
- system("cls");
- printf ("Kerem az elso erteket\n");
- scanf ("%i",p);
- p++;
- printf ("Kerem a masodik erteket\n");
- scanf ("%i",p);
- p++;
- printf ("Kerem a harmadik erteket\n");
- scanf ("%i",p);
- p++;
- printf ("Kerem a negyedik erteket\n");
- scanf ("%i",p);
- p++;
- printf ("Kerem az otodik erteket\n");
- scanf ("%i",p);
- p++;
- getch();
- }
- int maximum (int *p2)
- {
- system("cls");
- int max=-2e9,i;
- for (i=0;i<5;i++,p2++)
- if (max<*p2) max=*p2;
- printf("A maximum ertek: %i",max);
- getch(); // vár
- return max;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement