It's be awhile since I touched C++, but I'm writing inside my main I have a function called "solution" and right now that line is giving me the error: "a function definition is not allowed here before '{'"
Afterwards I thought I was supposed to write my funciton definitions after my main(), but that led to another slue of errors.
Also, as my code stands, I get the error of "invalid arguments" when I call my function solution and pass it to my outfile.
I also get the error on the final '{' of "expected '{' at end of input."
#include <iostream>
#include <fstream>
#include <vector>
#include <sstream>
using namespace std;
int main(int argc, char** argv) {
    ifstream infile("TEST.txt", std::ifstream::in);
    string line;
    vector<string> inputLines;
    if(infile.is_open()){
        while(getline(infile, line)){
            cout << line << '\n';
            inputLines.push_back(line);
        }
    }
    infile.close();
    ofstream outfile("output.txt", std::ofstream::out);
    for(unsigned int i = 1; i < inputLines.size(); i+= 3){
        int credit = inputLines[i];
        int numofItems = inputLines[i+1];
        int numofItemscopy = inputLines[i+1];
        vector<int> items;
        stringstream ssin(inputLines[i+2]);
        int x = 0;
        while(ssin.good() && x < numofItems){
            ssin >> items[x];
            ++x;
        }
        outfile << solution(credit,
                            numofItems,
                            numofItemscopy,
                            items.size());
        outfile << inputLines[i] << '\n';
    }
    outfile.close();
    return 0;
}
string solution(int cred, vector<int> original, vector<int> copy, int size){
        for(int i = 0; i < size; i++ ){
            for (int ii = 0; ii < size; ii++){
                if(original[i] + copy[ii] == cred){
                    return std::string(i) + std::string(ii);
                }
            }
        }
        return "";
    }
EDIT:
I put my solution function after my main, now I am getting the following errors:
On all three lines of :
        int credit = inputLines[i];
        int numofItems = inputLines[i+1];
        int numofItemscopy = inputLines[i+1];
I get the error: "cannot convert ‘std::basic_string’ to ‘int’ initialization"
Also when I call my "solution" function:
outfile << solution(credit,
                numofItems,
                numofItemscopy,
                items.size());
I get the error that "Solution was not declared in this scope."
 
     
     
    