Ich muss für die uni ein Programm schreiben für einen poti widerstand und die berechnung des spannungsverältnisses soll in einer seperaten .cpp datei durchgeführt werden, dass heisst ich muss die main.cpp und uteiler.cpp verbinden über eine header datei soweit ich weis.
Ich poste mal meine verschiedenen Codes:
Von meiner main.cpp:
#include <iostream>
#include "uteiler.h" //header vom uteiler
using namespace std;
int main (void)
{
float UzuUq, x, RpzuRL=0;
cout << "Geben Sie das Widerstandverhältnis Rp/RL ein:" << endl;
cin >> RpzuRL;
cout << endl << "x | U/Uq";
for (x=0.0;x<1.1;x=x+0.1)
{
cout << endl << "----+----------";
UzuUq = uteiler (x, RpzuRL); // Verweis auf die ausgegliederte Funktion
cout << endl << x;
(x<0.1)? cout<< " " : cout;
(x>1)? cout<< " |" : cout << " |";
cout << " " << UzuUq;
}
system ("pause");
}
Uteiler.cpp:
#include <iostream>
#include "uteiler.h"
using namespace std;
float uteiler (float a, float b)
{
return a/(a*(1-a)*b+1);
}
uteiler.h:
#ifndef __uteiler_H
#define __uteiler_H
float uteiler (float, float);
#endif
wenn sich jemand mit c++ auskennt und weiss wies geht würde ich mich freuen wenns jemand schreibt
gerne auch über skype für bildschirmübertragung