You can read the text file into a string and search this string for occurence of substring like "rule, ".
If str is the string containing the text file:
1 2 3 4 5 6 7
int myarray[N];
i = 0;
size_t pos = 0, fpos;
while((fpos = str.find("rule, "), pos) != npos){
fpos += 6; //to go to the position where the numbers starts
myarray[i++] = atoi(str.substr(fpos,fpos+2)); //to get an int from a substring
pos = fpos;}
I can't check if I have some error in the above so be careful.
By the way why do you want to strore it to an array and not a vector?
It's for a priority queue using a heap structure and my teacher wants us to use an array. Is there anyway to just get the int without searching for the "rule, " part? I'm not sure if the input will be identical to the one I mentioned originally.