I'm trying to get a problem to work. I simplified it to the sum of 2 numbers so that maybe it'd be easy to figure out. I want to create a class, functions, but I want to input the variables in main and then use them in those functions. I made this a 2 variable summation for simplification.
sum.h
1 2 3 4 5 6 7 8
#include <string>
usingnamespace std;
class SummingVariables
{
public:
int get_sum(int, int);
};
sum.cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include <iostream>
#include <iomanip>
#include <cstdlib>
usingnamespace std;
#include "sum.h"
int SummingVariables::get_sum(int a, int b)
{
int sum = a+b;
return sum;
cout << sum;
}