Hello:
I am having a bit of problem with logic in a segment (marked in blue) of this code: the indicated code should simply update the variable upon each pass of the function as it runs; the variable value maxes out at 456-- it will not increase by 228 beyond this point of the function's run.
I have not been able to determine why this is.
Any help is very appreciated. Thank-you in advance.
sharky_machine
Look.cpp
#include <cstdlib>
#include <iostream>
#include "Look.h"
using namespace std;
int currPos = 0;
int checkFlag = 0;
static int shipPos1 = 0; // default start position (pos 0)
int shipPos2 = 228;
// 3.80 minutes (228 seconds)
Look::Look() {
}
Look::~Look() {
}
void Look::printShipPos()
{
[B][B] if (checkFlag > 1) {
shipPos = shipPos2 + 228;
cout << shipPos << endl;[/B][/B]
}
{
if (shipPos = 228) {
std::cout << "French Polynesia [Out of Transmission Range]"<< endl;
}
else if ((shipPos > 228) && (shipPos < 456)){
std::cout << "Maui, Hawaii [Out of Transmission Range]"<< endl;
}
else if ((shipPos >= 456) && (shipPos < 684)){
std::cout << "Pacific Ocean (open waters) [Out of Transmission Range] 4320 miles from Tampa, Florida"<< endl;
}
[B].
.
.[/B]
//---------------------counter for fly-over access
checkFlag++;
cout <<checkFlag<< endl;
return;
}
}