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 52 53 54
|
#include <iostream>
using namespace std;
int main ()
{
int distancias[5][5] = {102,414,705,96,0,75,332,555,0,96,578,446,0,555,705,437,0,446,332,414,0,437,578,75,102}; //Array including the distances
int Ita_Ouro=distancias[0][3];
int Ita_SP=distancias[0][2];
int Ita_RJ=distancias[0][1];
int Ita_BH=distancias[0][0];
int Ouro_Ita=distancias[1][4];
int Ouro_sp=distancias[1][2];
int Ouro_RJ=distancias[1][1];
int Ouro_BH=distancias[1][0];
int SP_ITA=distancias[2][4];
int SP_Ouro=distancias[2][3];
int SP_RJ=distancias[2][1];
int SP_BH=distancias[2][0];
int RJ_ITA=distancias[3][4];
int RJ_Ouro=distancias[3][3];
int RJ_SP=distancias[3][2];
int RJ_BH=distancias[3][0];
int BH_ITA=distancias[4][4];
int BH_Ouro=distancias[4][3];
int BH_SP=distancias[4][2];
int BH_RJ=distancias[4][1];
cout<<"As Distancias entre um destino e outro sao:"<<endl; //Shows the distances from a city to another
cout<<"Ita_Ouro = "<<Ita_Ouro<<endl;
cout<<"Ita_SP = "<<Ita_SP<<endl;
cout<<"Ita_RJ = "<<Ita_RJ<<endl;
cout<<"Ita_BH = "<<Ita_BH<<endl;
cout<<"Ouro_Ita = "<<Ouro_Ita<<endl;
cout<<"Ouro_sp = "<<Ouro_sp<<endl;
cout<<"Ouro_RJ = "<<Ouro_RJ<<endl;
cout<<"Ouro_BH = "<<Ouro_BH<<endl;
cout<<"SP_ITA = "<<SP_ITA<<endl;
cout<<"SP_Ouro = "<<SP_Ouro<<endl;
cout<<"SP_RJ = "<<SP_RJ<<endl;
cout<<"SP_BH = "<<SP_BH<<endl;
cout<<"RJ_ITA = "<<RJ_ITA<<endl;
cout<<"RJ_Ouro = "<<RJ_Ouro<<endl;
cout<<"RJ_SP = "<<RJ_SP<<endl;
cout<<"RJ_BH = "<<RJ_BH<<endl;
cout<<"BH_ITA = "<<BH_ITA<<endl;
cout<<"BH_Ouro = "<<BH_Ouro<<endl;
cout<<"BH_SP = "<<BH_SP<<endl;
cout<<"BH_RJ = "<<BH_RJ<<endl;
for (int i,i>0) /*This is where I'm stuck. I need to get the values from above (which the user will enter BH_ITA or whichever he wants to calculate, then he'll continue entering until he decides to terminate the program, and that's where the sum needs to occurr*/
{
cout<<"Digite a rota que deseja calcular";
}
|