We were tasked on using non void functions to create a mini calculator where a user can input an arithmetic operation of their own choice, however I am getting a weird answer on my output here is my code so far
#include <iomanip>
#include <iostream>
using namespace std;
double ArithmeticOperation(float x, float y, string opt, double result)
{
    if (opt == "+") {
        result = x + y;
    } else if (opt == "-") {
        result = x - y;
    } else if (opt == "*") {
        result = x * y;
    } else if (opt == "/") {
        result = x / y;
    }
    return result;
}
int main()
{
    string opt;
    float x, y;
    double result;
    cout << "Enter an Arithmetic Operator (+,-,*,/): ";
    cin >> opt;
    cout << "Input first number: ";
    cin >> x;
    cout << "Input second number: ";
    cin >> y;
    ArithmeticOperation(x, y, opt, result);
    cout << "The answer is: " << result;
    return 0;
}
I inputted 1+2 on my user input program and got 4.68151e-310 as the answer this also occurs wheter its subtraction, multiplication and division and whatever number I input as x and y.
 
    