Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #define array 4
  4. float dividieren(float,float);
  5.  
  6.  
  7.  
  8.  
  9. float dividieren(float u,float r)
  10. {
  11. return u/r ;
  12. }
  13.  
  14.  
  15. int main()
  16. {
  17. float u=0;
  18. float r=0;
  19. int y=0;
  20. char c='c';
  21. float Ergebnis[array]= {0};
  22.  
  23. while(1)
  24. {
  25. if(y>=array)
  26. {
  27. y=0;
  28. }
  29. printf("Ee zum abbrechen Rr zum rechnen:\n");
  30. fflush(stdin);
  31. scanf("%c",&c);
  32.  
  33. if(c!='e'&&c!='E'&&c!='r'&&c!='R')
  34. {
  35. printf("BAKA!\n");
  36. }
  37.  
  38. if(c=='r'||c=='R')
  39. {
  40. printf("(1)WIDERSTAND\n");
  41.  
  42. printf("(L)ERGEBNISS\n");
  43.  
  44. fflush(stdin);
  45. scanf("%c",&c);
  46.  
  47. switch(c)
  48. {
  49. case '1':
  50. printf("WIDERSTAND BERECHNEN\nBitte zwei Zahlen eingeben:\n");
  51. scanf("%f%f",&u,&r);
  52.  
  53. Ergebnis[y] = dividieren(u,r);
  54. printf("%f\n",dividieren(u,r));
  55. y++;
  56. break;
  57.  
  58. case 'L':
  59. {
  60. for(int i=0; i<array; i++)
  61. {
  62. printf("%d.-->%f.\n",i+1,Ergebnis[i]);
  63. }
  64. break;
  65. }
  66. }
  67. if(c=='e'||c=='E')
  68. {
  69. printf("PROGRAMM ABBRUCH\n");
  70. break;
  71. }
  72. }
  73. }
  74.  
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement