I'm doing a USACO prompt and when I print out the variable i it keeps on outputting a memory location(i think?). Each time I run it, it outputs something different at the end. I'm not sure if there is an uninitialized value since I'm not sure what variable it could be. `
#include <fstream>
#include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <map>
#include <initializer_list>
#include <unordered_map>
using namespace std;
int main()
{
ifstream fin("blocks.in");
ofstream fout("blocks.out");
int n = 0;
fin >> n;
cout << n;
vector<int> alphab(26);
vector<int> usedA(26);
char foo[26] = { 'a', 'b', 'c' , 'd' , 'e' , 'f' , 'g' , 'h' , 'i' , 'j' , 'k' , 'l' , 'm' , 'n' , 'o' , 'p' , 'q' , 'r' , 's' , 't' , 'u' , 'v' , 'w' , 'x' , 'y' , 'z' };
int doo[26] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
string stringA = "d";
string stringB = "d";
for (int i = 0; i < n; i++)
{
fin >> stringA >> stringB;
stringA += stringB;
sort(begin(stringA), end(stringA));
auto last = unique(begin(stringA), end(stringA));
stringA.erase(last, end(stringA));
cout << i << "\n";
/*
for (int i = 0; i < stringA.length(); i++)
{
for (int j = 0; j < 26; i++)
{
if (stringA[i] == foo[j])
{
doo[j] += 1;
}
}
}
*/
}
cout << doo;
}
`
I made sure to give all the variables I have values prior to the loop but it didnt work :(