Zum Inhalt springen

suppenkasper61194

Mitglieder
  • Gesamte Inhalte

    4
  • Benutzer seit

  • Letzter Besuch

  1. Hallo Leute, Ich möchte ein Programm schreiben, welches den IQ ermittelt habe aber an einer stelle Probleme: Hier erstmal der Code: #include <iostream> #include <cmath> #include <string> using namespace std; int main() { char Antwort_01[100]; cout << "IQ Test" << endl << endl ; cout << "Beantworten Sie die folgenden Fragen, um ihren IQ zu bestimmen!" << endl << endl; cout << "Zum Starten EINGABE druecken!" << endl << endl << endl; getchar(); cout << "Erste Frage: Wie heisst die Hauptstadt von Polen?" << endl; cout << "Ihre Antwort: " ; cin >> Antwort_01[100]; if (Antwort_01[100] == 'warschau') { cout << "Richtig!" << endl; } else { cout << "Falsch" << endl << endl; } system ("Pause"); return 0; } Ich möchte, dass das Programm in dem Falle ausgibt, ob die vom Benutzer eingegebene Antwort richtig oder Falsch ist. Leider gibt das Programm auch bei richtiger Eingabe (hier "Warschau") "Falsch" aus. Wie bekomme ich nun hin, dass das Programm die Antwort mit richtig bzw. falsch ausgibt? Viele Grüße und Danke im Voraus, suppenkasper:)
  2. ich hatte das Programm nicht ausführbar gemacht. Der Compiler zeigt nun folgende Fehlermeldungen: ma.cpp:1:21: error: ionstream: Datei oder Verzeichnis nicht gefunden ma.cpp:58:13: warning: missing terminating " character ma.cpp:58: error: missing terminating " character ma.cpp:79:13: warning: missing terminating " character ma.cpp:79: error: missing terminating " character ma.cpp:2: error: expected nested-name-specifier before ‘namspace’ ma.cpp:2: error: ‘namspace’ has not been declared ma.cpp:2: error: expected ‘;’ before ‘std’ ma.cpp:2: error: expected constructor, destructor, or type conversion before ‘;’ token ma.cpp: In function ‘int main()’: ma.cpp:6: error: ‘cout’ was not declared in this scope ma.cpp:7: error: ‘cin’ was not declared in this scope ma.cpp:7: error: expected ‘;’ before ‘Eingabe’ ma.cpp:8: error: ‘add’ was not declared in this scope ma.cpp:10: error: expected initializer before ‘eins’ ma.cpp:11: error: expected initializer before ‘zwei’ ma.cpp:14: error: ‘Eingabe’ was not declared in this scope ma.cpp:14: error: expected ‘;’ before ‘eins’ ma.cpp:15: error: expected ‘;’ before ‘zwei’ ma.cpp:16: error: expected ‘;’ before ‘eins’ ma.cpp:17: error: ‘endl’ was not declared in this scope ma.cpp:21: error: expected primary-expression before ‘;’ token ma.cpp:21: error: expected ‘)’ before ‘;’ token ma.cpp:23: error: ‘sub’ was not declared in this scope ma.cpp:25: error: expected initializer before ‘eins’ ma.cpp:26: error: expected initializer before ‘zwei’ ma.cpp:29: error: ‘Eingabe’ was not declared in this scope ma.cpp:29: error: expected ‘;’ before ‘eins’ ma.cpp:30: error: expected ‘;’ before ‘zwei’ ma.cpp:31: error: expected ‘;’ before ‘eins’ ma.cpp:32: error: ‘endl’ was not declared in this scope ma.cpp:36: error: expected primary-expression before ‘;’ token ma.cpp:38: error: ‘mul’ was not declared in this scope ma.cpp:40: error: expected initializer before ‘eins’ ma.cpp:41: error: expected initializer before ‘zwei’ ma.cpp:44: error: ‘Eingabe’ was not declared in this scope ma.cpp:44: error: expected ‘;’ before ‘eins’ ma.cpp:45: error: expected ‘;’ before ‘zwei’ ma.cpp:46: error: ‘Differenz’ was not declared in this scope ma.cpp:46: error: expected ‘;’ before ‘eins’ ma.cpp:47: error: ‘endl’ was not declared in this scope ma.cpp:51: error: ‘endl’ was not declared in this scope ma.cpp:53: error: ‘dif’ was not declared in this scope ma.cpp:55: error: expected initializer before ‘eins’ ma.cpp:56: error: expected initializer before ‘zwei’ ma.cpp:59: error: ‘Eingabe’ was not declared in this scope ma.cpp:59: error: expected ‘;’ before ‘eins’ ma.cpp:60: error: expected ‘;’ before ‘zwei’ ma.cpp:61: error: expected ‘;’ before ‘eins’ ma.cpp:62: error: ‘endl’ was not declared in this scope ma.cpp:66: error: ‘endl’ was not declared in this scope ma.cpp:68: error: ‘qua’ was not declared in this scope ma.cpp:75: error: ‘endl’ was not declared in this scope ma.cpp:80: error: expected primary-expression before ‘}’ token ma.cpp:80: error: expected ‘;’ before ‘}’ token ma.cpp:80: error: expected ‘}’ at end of input Also was hab ich da falsch gemacht?
  3. es kommt immer: max@linux-graw:~> g++ ma.cpp g++: ma.cpp: Datei oder Verzeichnis nicht gefunden g++: no input files
  4. Hallo, Ich habe einen Quelltext in C++ geschrieben, aber es kommen immer Fehler beim compilieren. Hier der Fehlerhafte Quelltext #include <ionstream> using namspace std; int main() cout << "Rechner -geben Sie add für Addition, sub für Subtraktion, mul für Multiplikation, dif für Division oder qua für Quadrierung ein! [Copyright by Max Petter.]"; cin Eingabe; if (add) { int Eingabe eins; int Eingabe zwei; int Summand; cout << "Addition -gebe Sie 2 Zahlen ein!" ; cin >> Eingabe eins; cin >> Eingabe zwei; Summand = Eingabe eins + Eingabe zwei; cout << "Das Ergebnis lautet:" << Summand << endl; } else { (cout << "Error -falsche Eingabe" <<; } if (sub) { int Eingabe eins; int Eingabe zwei; int Differenz; cout << "Subtraktion -geben Sie 2 Zahlen ein!"; cin >> Eingabe eins; cin >> Eingabe zwei; Differenz = Eingabe eins - Eingabe zwei; cout << "Das Ergebnis lautet:" << Differenz << endl; } else { cout << "Error -falsche Eingabe" <<; } if (mul) { int Eingabe eins; int Eingabe zwei; int Produkt; cout << "Geben Sie 2 Zahlen ein!"; cin >> Eingabe eins; cin >> Eingabe zwei; Differenz = Eingabe eins * Eingabe zwei; cout << "Das Ergebnis lautet:" << Produkt << endl; } else { cout << "Error -falsche Eingabe!" << endl; } if (dif) { int Eingabe eins; int Eingabe zwei; int Differenz; cout << "Geben Sie 2 Zahlen ein!; cin >> Eingabe eins; cin >> Eingabe zwei; Differenz = Eingabe eins / Eingabe zwei; cout << "Das Ergebnis lautet:" << Differenz << endl; } else { cout << "Error -falsche Eingabe" << endl; } if (qua) { int Eingabe; int Quadrat; cout << "Quadrierung -Geben sie eine Zahl ein!"; cin >> Eingabe; Quadrat = Eingabe * Eingabe; cout << "Die Quadratzahl lautet:" << Quadrat << endl; } else { cout << "Error -falsche Eingabe << endl; Wie ist dieser Quelltext richtig??? Viele Grüße und Danke im Voraus, suppenkasper

Fachinformatiker.de, 2024 by SE Internet Services

fidelogo_small.png

Schicke uns eine Nachricht!

Fachinformatiker.de ist die größte IT-Community
rund um Ausbildung, Job, Weiterbildung für IT-Fachkräfte.

Fachinformatiker.de App

Download on the App Store
Get it on Google Play

Kontakt

Hier werben?
Oder sende eine E-Mail an

Social media u. feeds

Jobboard für Fachinformatiker und IT-Fachkräfte

×
×
  • Neu erstellen...