Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #define array 4
- float dividieren(float,float);
- float dividieren(float u,float r)
- {
- return u/r ;
- }
- int main()
- {
- float u=0;
- float r=0;
- int y=0;
- char c='c';
- float Ergebnis[array]= {0};
- while(1)
- {
- if(y>=array)
- {
- y=0;
- }
- printf("Ee zum abbrechen Rr zum rechnen:\n");
- fflush(stdin);
- scanf("%c",&c);
- if(c!='e'&&c!='E'&&c!='r'&&c!='R')
- {
- printf("BAKA!\n");
- }
- if(c=='r'||c=='R')
- {
- printf("(1)WIDERSTAND\n");
- printf("(L)ERGEBNISS\n");
- fflush(stdin);
- scanf("%c",&c);
- switch(c)
- {
- case '1':
- printf("WIDERSTAND BERECHNEN\nBitte zwei Zahlen eingeben:\n");
- scanf("%f%f",&u,&r);
- Ergebnis[y] = dividieren(u,r);
- printf("%f\n",dividieren(u,r));
- y++;
- break;
- case 'L':
- {
- for(int i=0; i<array; i++)
- {
- printf("%d.-->%f.\n",i+1,Ergebnis[i]);
- }
- break;
- }
- }
- if(c=='e'||c=='E')
- {
- printf("PROGRAMM ABBRUCH\n");
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement