Advertisement
DrMikeMorgan

110ct Lab 11

Feb 4th, 2013
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1. #include "Headers/Lib110ct.h"
  2. #include <string>
  3. using namespace std;
  4. int main(int argc, char** argv)
  5. {
  6.     Win110ct win;
  7.  
  8.     double distances[5][5] = {{0,102,290,111,129},
  9.                             {102,0,373,150,231},
  10.                             {290,373,0,372,186},
  11.                             {111,150,372,0,194},
  12.                             {129,231,186,194,0}};
  13.     string cities[] = {"Birmingham","Edinburgh","London","Cardiff","York"};
  14.     int choices[2];
  15.  
  16.     //task 1 code goes here...
  17.  
  18.     for(int i=0; i<2; ++i)
  19.     {
  20.         win << "Enter city " << i+1 << "\n";
  21.         for(int j=0; j<5; ++j)
  22.             win << j << ". " << cities[j] << "\n";
  23.         win >> choices [i];
  24.         win.clear();
  25.         win.setPosition(0,0);
  26.     }
  27.  
  28.     win << "The distance between the cities is: " << distances[choices[0]][choices[1]] << "miles";
  29.  
  30.     win.getchar();
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement