//08 09 //A1 #include using namespace std; int main() { long int zahl; cout << "Bitte eine Zahl größer 0 eingeben: " << endl; cin >> zahl; if (zahl==0){return 0;} int i; int teilersumme=0; for (i=1;i<=zahl;i++) { if (zahl%i == 0) { teilersumme += i; cout << i << endl; } } cout << "teilersumme: " << teilersumme << endl; if ((teilersumme-zahl)==1) { cout << "Die eingegebene Zahl ist sogar eine Primzahl" << endl; } return 0; } //a2 #include using namespace std; bool fehler(int x[], int y[], int n) { int i=0; for (i=0;i> n; int a[n]; int b[n]; int i; for (i=0;i> a[i]; cin >> b[i]; } fehler(a,b,n); return 0; } //A3 #include #include using namespace std; class polar2d { private: double radius, winkel; public: polar2d(double r, double w); void operator *= (double faktor); void rotate(double w); friend double get_x(polar2d); }; polar2d::polar2d(double r, double w) { radius = r; winkel = w; } void polar2d::operator*=(double faktor) { radius *= faktor; } void polar2d::rotate(double w) { winkel += w; } double get_x(polar2d pinkeln) { double x; x = pinkeln.radius*cos(pinkeln.winkel); return x; } int main() { const double pi=3.141592654; polar2d p1 (1.0, pi/2); // vereinbare einen Punkt durch Radius und Winkel p1 *= 2.0; // aendere Radius von p1 um angegebenen Faktor; p1.rotate(-pi/6); // rotiere p1 um das Winkelargument; cout << "Kartesische X-Koordinate: " << get_x(p1) << endl; return 0; } //A4 double trapez(double(*f)(double),double a, double b) {   double trapezflaeche ;   trapezflaeche=(0.5*(b-a)* ( (*f) (b)- (*f) (a) ) );   return trapezfläche; } //A5 #include using namespace std; void f(int* q) { int i7 =*q; (*q) += 3; i7 += 2; cout << "Fkt1: " << i7 << endl; } void f(int &q) { q += 1; cout << "Fkt2: " << q << endl; } int f(int r, int s) { if ( r<=s) return 0; return (r-s) + f(r-1,s+1); } int main() { int i1; cin >> i1; int i2 = i1; f(i1); cout << "Main1: " << i1 << endl; f(&i2); cout << "Main2: " << i2 << endl; cout << "Main3: " << f(7,3) << endl; return 0; } //A6 #include #include using namespace std; bool prim(int u) { bool a; a=true; for(int i=2;i using namespace std; void f(int p, int q) { q+=2; cout << "Fkt1: " << q << endl; if (p>0) { f(p-1,q); } return; } void f(int p, double &q) { q += p; cout << "Fkt2: " << q << endl; return ; } int main() { int a1; cin >> a1; double a2 = a1 + 0.2; f(1,a2); cout << "Main1: " << a2 << endl; f(1,a1); cout << "Main2: " << a1 << endl; return 0; }