ambiguous overload for 'operator>>' (operand types are 'std::istream {aka std::basic_istream<char>}' and 'int')
-
#include <iostream> int main () { int Summand1, Summand2, Ergebnis; // Variabeln std::cin >> 5 >> 7; // Die Zahlen (inhalt) Ergebnis = Summand1 + Summand2; std::cout << Summand1 << "+"<< Summand2 << "=" << Summand1 + Summand2; }
Kann mir bitte jemand sagen was hier falsch ist? Fehlercode oben
-
Philipp0 schrieb:
std::cin >> 5 >> 7; // Die Zahlen (inhalt)
Da sollten die Variablen stehen, in die du einlesen willst, keine festen Werte.
Wenn du feste Werte für Summand1 und Summand2 hast, brauchst du std::cin nicht.
-
Philipp0 schrieb:
Ergebnis = Summand1 + Summand2; //... << Summand1 + Summand2; }
Außerdem berechnest du das Ergebnis zweimal. Funktioniert zwar ist aber überflüssig.