I'm working on my traveling sales program(without the use of the STL)
I know this shouldn't be giving me the correct answer. I'm trying to make sure my matrix is being loaded correctly first.
Can anyone see the problem here? I always get 0 for the total cost no matter what I put in.
On a side note: how do I read more than one character from a line. I actually need the characters starting at spot 6.
//method for getting the minimum cost of the given routes.
void getCost(){
for(int i = 0; i <50; i++){
for(int j = 0; j <50; j++){
if (graph[i][j]>0)
totalCost == totalCost + graph[i][j];
}
}
}
switch (line[0]) {
case 'c':
cCount++;
cout << "Added City: " << line << "\n";
break;
case 'a':
aCount++;
c1 = line[2];
c2 = line[4];
cost = line[6];
cout << "Added Route: " << line << "\n";
graph[c1][c2] == cost;
break;
default:
getCost();
cout << totalCost;
stop = true;
break;
}