Simple calculator should take 2 seconds to fix its like 10 lines

Well your first problem is your ‘main’ method

int main()
{
    int getFirstInteger(int userInput)
    return 0;
}

The syntax is incorrect (should be lined ended with a semi-colon). And you should be passing an int. So it could be modified to this

int main()
{
    int j = 1;
    getFirstInteger(j)
    return 0;
}

But it’s worth looking at the implementation here. You’re getting the user input within that method, so no need to pass in anything. And you’re not using the output, so no need to return anything.

Also you’ve double included #include<iostream> This won’t be a big issue in a small program but it’s a waste and bad practice. Only include this where it’s needed (which is in CalculationsFunctions.cpp). Don’t think you need #include "stdafx.h" at all.

Leave a Comment