Also habe ich einen einfachen Rechner für Studienzwecke geschrieben. Aber ich kann es nicht funktionieren, weil ich einen seltsamen Fehler bekomme. Ich habe alles versucht, was ich konnte, aber ich konnte den Fehler nicht beheben. Bitte sieh es dir an und sag es mir.Seltsame Fehler in C++ Programm
#include <iostream>
#include <cstdlib>
#include <string>
using namespace std;
double add (double x, double y)
{
double addition = x+y;
return addition;
}
double sub (double x ,double y)
{
double subtraction = x-y;
return subtraction;
}
double mul (double x , double y)
{
double multiplication = x*y;
return multiplication;
}
double div (double x, double y)
{
double division = x/y;
return division;
}
int main()
{
int x; int y; int op;
cout << "Enter a number: ";
cin >> x;
cout << "Enter second number: ";
cin >> y;
cout << "1: Addition, 2: Subtraction, 3: Multiplication, 4: Division" << endl;
cout << "What operation you want: ";
cin >> op;
switch (op)
{
case 1:
cout << x << " + " << y << " = " << add(x, y);`enter code here`
break;
case 2:
cout << x << " - " << y << " = " << sub(x,y);
break;
case 3:
cout << x << " * " << y << " = " << mul (x,y);
break;
case 4:
cout << x << "/" << y << " = " << div (x,y);
break;
default:
cout << "Invalid operation"
}
}
Welcher seltsame Fehler? Meine Gedankenlesefähigkeiten sind nicht so gut. – drescherjm
http://coliru.stacked-crooked.com/a/46e15a9f289d4d5c –
Wie @ πάνταῥεῖ mit dem Online-C++ - Compiler hingewiesen haben Sie *** \ 'Code hier am Ende einer Ihrer Zeilen eingeben von Code. Fix das zuerst. – drescherjm