Hi, I am having issues figuring out what I did wrong with my code. I am being told that there are expected ";" and I am not sure how to fix the expected declarations. I would like assistance so I can learn how to fix it.
https://imgur.com/a/50IVZsy for a more in-depth view
[#include <iostream>
#include <fstream>
//defining max file size
#define MAX_FISHERS 25
using namespace std;
//main
int main()
{
//initializing variables
string line;
string fisher[MAX_FISHERS]; //storing fishers' names
int fish[MAX_FISHERS]; //storing number of fishes caught
//opening text file
ifstream infile("pgm5.txt");
int count = 0
if (infile.is_open())
{
int index1 = 0, index2 = 0;
while (getline(infile, line))
{
//token1 stores the fisher name and token 2 will store fish count as string
std::string token1 = line.substr(0, line.find(" "));
std::string token2 = line.substr(line.find("") + 1, line.size() - 1);
//storing token1 to the fisher array
fisher[index1++] = token1;
//converting string to integer using the stringstream class
stringstream temp(token2);
int num = 0;
temp >> num;
//storing integer to fish array
//using ab() to change the negative sign
fish[index2++] abs(num);
//increasing count by 1
count++
}
infile.close(); //closing input file
}
else
{
cout << "Unable to open file";
}
//declare variables for additional operations
int maxFish = 0, minFish = 99999, totalFish = 0, minPos = 0, maxPos = 0;
//running loop to find the winner, least scorer and the total
for (int = i = 0;i < count;i++)
{
//display name and count for each fisher
cout << "Fisher " << (i + 1) << " who named " << fisher[i] << " caught " << fish[i] << " fish\n";
//find max scorer
if (fish[i] > maxFish)
{
maxFish = fish[i];
maxPos = i + 1;
}
//find min scorer
if(fish[i] < minFish)
{
minFish = fish[1];
minPos = i + 1;
}
//find total
totalFish += fish[1];
}
//display output for format
cout << "The winner is Fisher " << maxPos << " who named " << fisher[maxPos - 1] << " by catching " << maxFish << " fish." << endl;
cout << "Fisher" << minPos << " who named " << fisher[minPos - 1] << " caught the least number of fish: " << minFish << "." << endl;
cout << "And in total all the fishers caught " << totalFish << " fish." << endl;
cout << "Press any key to continue..." << endl;
return 0;
}
}