Basic calculator program in C++
This program is just for two variables to be added up and display the results, but when I run it and input 2 and 2, it gives me 3.21412e-039.
Code:
#include <iostream>
using namespace std;
float calc(float a, float b, float c) {
c = a + b;
cin.get();
return c;
}
int main() {
float a;
float b;
float c;
cout << "Input a number: ";
cin >> a;
cout << "Input a second number: ";
cin >> b;
calc(a, b, c);
cout << a << " plus " << b << " equals " << c << " .\n";
cin.get();
}