I'm working on a final project for my computer programming in C++ class, I know nothing about programming, and I think I bit off more than I could chew with this project.
My proposed project idea was to set up a scenario where if you were on a beach and set your stuff down at a certain distance from the shore, you could use this program to find out how long it would take the tidal water to reach your stuff and get it wet.
I was thinking about doing something like calling the time and water level(which I translated from height to distance up the shore) data in a loop that would essentially let me set a time and increment the time until the translated water height hits a certain value.
My teacher helped me write a bit of code but I am very stuck still. Any help?
I'm just having trouble getting it to print out the corresponding time with each distance. Right now I have it set to print the value for m (minutes) but it is staying at a constant 54. How would I get it to print out the corresponding hour and minute values with each distance?
int main(int argc, char** argv) {
{
double *water = newdouble[2000];
double *timer = newdouble[2000];
double *distance = newdouble [2000]; //
ifstream f;
string d; //date
int h; //hour
int m; //minute
int y;
string w; //water
int i;
int z = 0;
f.open("p2.txt");
while (!f.eof()) {
f >> d; //date
f >> h; //hour
f >> m; //minute
f >> w; //water level
timer[z] = (double) z;
water[z] = atof(w.c_str());
distance[z] = water[z] / sin(0.0872664626);
z++;
// cout << z << " Time: " << h << ":" << m << " " << atof(w.c_str()) << endl;
}
cout << "end of reading" << endl;
int n = z;
for (i = 0; i < n; i++) {
if (distance[i] > 20.00){
cout << "Your feet will be wet until " << m << endl;
cout << " The tide is standing at " << distance[i] << " feet from the shore." << endl;
}
else{
cout << "Your feet are just fine." << endl;
}
}
cout << endl;
}
return 0;
}