Tenho que criar um programa em C++ que leia dois ficheiro txt.
Um deles denominado Encom.txt outro local.txt
No ficheiro Encom.txt - Tenho: (Loja; IDEncomenda; Produto; Quantidade) em cada linha
No ficheiro Local.txt - Tenho: (Produto; Local) em cada linha
O objetivo final será identicar os produtos pedidos em cada encomenda (no ficheiro encom.txt) e depois identifcar o local dos produtos da encomenda (no ficheiro local.txt).
Por forma a finalmente calcular a distância percorrida, pelo picker, em cada encomenda, que será sempre dada pelo: [máximo do nº local do produto i na encomenda j] - [minimo do nº do local do produto i na encomenda j].
(O nº local é dado pelo ficheiro Local.txt)
No fim, somam-se todas as distâncias.
Alguém me consegue ajudar?
Please note that this is not a homework site. We won't do your homework for you. The purpose of homework is that you learn by doing. However we are always willing to help solve problems you encountered, correct mistakes you made in your code and answer your questions.
We didn't see your attempts to solve this problem yourself and so we cannot correct mistakes you didn't made and answer questions you didn't ask. To get help you should do something yourself and get real problems with something. If your problem is "I don't understand a thing", then you should go back to basics and study again.
Sadly, I can't go back to basics of your language, for I have never had them in the first place. Please use english.
The correct term is compile the code, not run the code.
Yes, error and suggestion:
138:71: error: invalid operands of types 'double' and '<unresolved overloaded function type>' to binary 'operator<<'
138:41: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
They do refer to: total = total+ mapEncomendasDist[i].max - mapEncomendasDist[i].min << endl;
The error says: invalid operands to binary 'operator<<'
Where is that? total = total+ mapEncomendasDist[i].max - mapEncomendasDist[i].min << endl;
Lets try something simpler: total = total << endl;
Yes, same error.
The total (and total+ mapEncomendasDist[i].max - mapEncomendasDist[i].min) are double
The endl (probably std::endl) has a type too.
(For some reason the compiler is not sure what and says <unresolved overloaded function type>.)