Here\'s a hw question about the cost analysis of traveling on a toll-based highw
ID: 643932 • Letter: H
Question
Here's a hw question about the cost analysis of traveling on a toll-based highway. Our professor hasn't offered much help and I'm super confused on how to even start. Can anyone help me get on the right path please? Thank you!!
I included a pic of the original problem so the formulas would still look right.
1. On the east coast of the U.S. there are many toll roads such as the Pennsylvania Turnpike and the Garden State Expressway. When you enter the toll road you get handed a ticket denoting your starting location (the terminology used is that you got on the highway at exit blah). Then when you exit the toll road you pay an amount based on where you entered and exited. To be precise, each segment (from exit i to exit i + 1) has a cost Ci,i+1 and the cost of entering at exit j and exiting at exit k (for jExplanation / Answer
#include
#include
#include
#include
using std::cout;
using std::endl;
struct tollDetails
{
int id;
char tollname[30];
float cost;
};
int main()
{
struct tollDetails record[10];
int i;
record[0].id=01;
strcpy(record[0].tollname,"Pennsylvania Turnpike");
record[0].cost=50;
record[1].id=02;
strcpy(record[1].tollname,"Garden State Expressway");
record[1].cost=100;
for(i=0;i<2;i++)
{
cout<<"Id:"< cout<<"Toll Name:"< cout<<"Toll Cost:"< }
getch();
return 0;
}