#include<stdlib.h> #include<conio.h> #include<stdio.h> #include<string.h> void main(void) { int i,j,x,y=0; int tab[50][2]; char eingabe; do { clrscr(); gotoxy(33,5);printf("M E N U E"); gotoxy(32,6);printf("-----------"); gotoxy(24,10);printf("Eingabe der Spannungswerte <e> "); gotoxy(24,11);printf("Ausgabe der Spannungswerte <a> "); gotoxy(24,12);printf("Maximale Spannungswert <m> "); gotoxy(24,13);printf("Programmende <x> "); gotoxy(24,14);printf("Eingabe: "); eingabe=getche(); switch (eingabe) { case 'e': clrscr(); do { gotoxy(16,2); printf("E I N G A B E D E R S P A N N U N G S W E R T E "); gotoxy(17,10); printf("Gib den %i. Spannungswert ein (max. 50) (ende=0) ",y+1); scanf("%i",&tab[y][0]); tab[y][1]=tab[y][0]; y=y+1; clrscr(); } while ((y<20) && (tab[y-1][0]!=0)); if (y==20) y=y+1; gotoxy(17,20); printf("Die Werte wurden in das Array eingelesen"); getche(); clrscr(); break; case 'a': clrscr(); gotoxy(16,2); printf("A U S G A B E D E R S P A N N U N G S W E R T E \n\n\n"); for(x=0;x<=y-2;x++) printf("\n\t\t\t\t\t%i V ",tab[x][0]); getche(); break; case 'm': clrscr(); for (x=0;x<=y-2;x++) { for (i=0;i<=y-2;i++) { if (tab[i][1]<tab[i+1][1]) { j=tab[i][1]; tab[i][1]=tab[i+1][1]; tab[i+1][1]=j; } } } gotoxy(16,2); printf("A U S G A B E D E S M A X I M A L W E R T E S"); gotoxy(25,10); printf("Der gráte Spannungswert ist %i V" ,tab[0][1]); getche(); break; case 'x': x=0; clrscr(); } } while (x!=0); }