1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
const int F15 = 8, S16 = 4, F16 = 2, S17 = 1;
std::ifstream inFile;
std::string path = "C:\\Users\\Lord Brebo\\Desktop\\BCS-courses.txt";
std::vector<string> course; //course ID
std::vector<int> value; //value of semester EX:8,4,2,1 for f15,s16,f16,s17
int codes[] = { F15,S16,F16,S17 };
std::string a, b, c, d, e, BCS, num, title;
std::string X = "X";
int rcd, i, sum;
inFile.open(path);
if (!inFile)
{
cout << "file not found:" << path << endl;
return -1;
}
i = 0;
rcd = 0;
getline(inFile, e);
inFile >> a;
while (inFile.getline)
{
sum = 0;
inFile >> b >> c >> d >> BCS >> num >> title;
BCS = num + " " + title;
//course[i] = BCS;
if (a == X)
{
sum += F15;
}
if (b == X)
{
sum += S16;
}
if (c == X)
{
sum += F16;
}
if (d == X)
{
sum += S17;
}
std::cout << sum << " " << BCS << std::endl;
inFile >> a;
++i;
++rcd;
}
inFile.close();
return 0;
}
|