/***************************************************************/ /* Verfasser: Prof. Dr. Gregor Büchel */ /* Source : MessSpann.c */ /* Zweck : Verarbeitung einer Messreihe (Spannungsmessung) */ /* Stand : 15.11.2013 */ /***************************************************************/ #include /* Prototypen */ int einNat(); void einSpannFolge(double u[],int n); double mittel(double x[],int n); void minmax(double x[], int n, double mima[]); void ohmschGesetz(double x[], int n, double rohm, double y[]); void wFolgeAus(double x[], int n); int main () {int n; double mima[2], amw, rohm; printf("Wieviele Spannungswerte erwarten Sie?\n"); n=einNat(); double messw[n], strom[n]; einSpannFolge(messw,n); printf("Die Folge der Spannungswerte:\n"); wFolgeAus(messw,n); amw=mittel(messw,n); printf("Das arithmetische Mittel: %lf\n",amw); minmax(messw,n,mima); printf("Minimum: %lf Maximum: %lf \n",mima[0],mima[1]); printf("Welcher Widerstand liegt vor?\n"); scanf("%lf",&rohm); ohmschGesetz(messw,n,rohm,strom); printf("Die Folge der Stromstaerken:\n"); wFolgeAus(strom,n); } int einNat() {int k; do { printf("Bitte geben Sie eine natuerliche Zahl ein:\n"); scanf("%d",&k); if (k<1) { printf("%d ist keine natuerliche Zahl. Neueingabe!\n",k); } } while(k<1); return k; } void einSpannFolge(double u[],int n) {int i; for(i=0; imima[1]) mima[1]=x[i]; } } void ohmschGesetz(double x[], int n, double rohm, double y[]) {int i; for (i=0; i