I was wondering if someone could tell me how to subtract two string arrays. I use getline() that is why the array is a string. It is in my main, but the below code is my function.
Also the data inside the array is just numbers such as: 88 91 100 etc, Just want to subtract those numbers
I Get the errors from these two lines of code.
Code:
HUFFMAN[i] = dataCASE1[i] - dataCASE1[i-16];
Code:
HUFFMAN[i] = dataCASE1[i] - dataCASE1[i-1];
Code:
void algor1(int sizeCASE1, int columnCASE1, string dataCASE1[]){
string HUFFMAN[256];
ofstream outStream;
outStream.open("outfile.txt");
if(outStream.fail())
{
cout << "Output file opening failed.\n";
exit(1);
}
HUFFMAN[0] = dataCASE1[0];
for(int i = 1; i < sizeCASE1; i++)
{
if(i == columnCASE1)
{
HUFFMAN[i] = dataCASE1[i] - dataCASE1[i-16];
}
else
HUFFMAN[i] = dataCASE1[i] - dataCASE1[i-1];
}
for(int j = 0; j < sizeCASE1; j++)
{
outStream << HUFFMAN[j];
}
outStream.close();
}
Thanks