Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Modify program and change the \"for\" loop into a \"while\" loop. #include<iostr

ID: 3640471 • Letter: M

Question

Modify program and change the "for" loop into a "while" loop.


#include<iostream>
#include<cfloat>
using namespace std;

int main ()
{
const double C(299792458.0);
const int NUMBER_OF_SATELITES(4);
int satID, minID;
double tTime, pRange, minPRange(DBL_MAX);

cout<<"Enter id and transit time for"
<<NUMBER_OF_SATELITES << "satelites: "
<<"Use whitespace to seperate the values(ie: 25 0.00257) "
<<endl;

for(int i=1;i<=NUMBER_OF_SATELITES; ++i)
{
cin >> satID >> tTime;
pRange = tTime*C;

if(pRange < minPRange)

{

minPRange = pRange;
minID = satID;

}
cout << "Satelite" << satID << "has a pseudorange of"
<< pRange << "m " << endl;
}

cout << " Satelite " << minID
<< "is closest to GPS reciever." << endl;

system ("pause");
return 0;
}

Explanation / Answer

#include #include using namespace std; int main () { const double C(299792458.0); const int NUMBER_OF_SATELITES(4); int satID, minID; double tTime, pRange, minPRange(DBL_MAX); cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote