Advertisement
Guest User

Untitled

a guest
Apr 25th, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. #include "stdafx.h"
  2. #define _USE_MATH_DEFINES
  3. #include "info2_core.h"
  4. #include "DiagramValues.h"
  5. #include "plotter.h"
  6. #include "windows.h"
  7. #include <string.h>
  8. #include <stdlib.h>
  9. #include <iostream>
  10. #include <math.h>
  11. #include "time.h"
  12. extern char acOutput[ciMaxText];
  13. using namespace Informatik;
  14.  
  15.  
  16. //Prototyp
  17. double nullstellen (double,double,double);
  18.  
  19. //Struktur 1
  20. struct Extrema{
  21. double NST1;
  22. double NST2;
  23. int ERG;
  24. };
  25. //Struktur 2
  26. struct PolySrc{
  27.  
  28.  
  29. };
  30. struct PolyDst{
  31.  
  32. };
  33. //Hauptprogramm
  34. void Info2::Uebungen11(){
  35.  
  36. double a=4;
  37. double b=2;
  38. double c=-2;
  39. Extrema ExtremaH ={};
  40.  
  41. ExtremaH = nullstellen(ExtremaH);
  42.  
  43.  
  44. nullstellen(a,b,c);
  45.  
  46.  
  47.  
  48. /*sprintf(acOutput, "%.2f ,%.2f",NS1,NS2);
  49. WriteText(200,200,acOutput);
  50. */
  51. return;
  52.  
  53. }
  54.  
  55. //Unterprogramme 1
  56.  
  57. double nullstellen(double a, double b, double c){
  58.  
  59. double NS1=0;
  60. double NS2=0;
  61. double D=0;
  62. int erg=0;
  63.  
  64. D=(b*b)-(4*a*c);
  65.  
  66. if(D>0 && a!=0){
  67.  
  68. NS1=(-b+sqrt(D))/(2*a);
  69. NS2=(-b-sqrt(D))/(2*a);
  70. erg=2;
  71. }
  72. else if(D==0 && a!=0){
  73.  
  74. NS1=-b/(2*a);
  75. erg=1;
  76. }
  77. else if(D<0 && a!=0){
  78. erg=0;
  79. }
  80. else if(a==0 && b!=0 && c!=0){
  81.  
  82. NS1=(-c)/b;
  83. erg=1;
  84. }
  85. else erg=0;
  86.  
  87. return;
  88. }
  89. //Unterprogramm 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement