//--------------------------------------------------------------------------- #include #include #include #pragma hdrstop //--------------------------------------------------------------------------- #pragma argsused int main(int argc, char* argv[]) { start:float x1=0, x2=0, y1=0, y2=0; char arf, qorr; std::cout << "Distance Finder" << std::endl; std::cout << "Define: X1, Y1, X2, Y2 (seperate with an enter in that order)" << std::endl; std::cin >> x1 >> y1 >> x2 >> y2; float d = sqrt (((x1-x2)*(x1-x2))+((y1-y2)*(y1-y2))); std::cout << "The distance between (" << x1 << "," << y1 << ") and (" << x2 << "," << y2 << ") is " << d << std::endl; qorrprompt:std::cout << "Press Q to Quit, R to Reset." << std::endl; std::cin >> qorr; if (qorr == 0x52) { goto start; } if (qorr == 0x72) { goto start; } if (qorr == 0x51) { goto end; } if (qorr == 0x71) { goto end; } else { arfprompt:std::cout << "Oh shoot, looks like your fouled up the program! \n"; std::cout << "Press \"A\" to reset the program, press \"R\" continue anyway, or press \"F\" to abandon all hope and just quit.\n"; std::cin >> arf; if (arf == 0x41) { goto start; } if (arf == 0x61) { goto start; } if (arf == 0x51) { goto qorrprompt; } if (arf == 0x71) { goto qorrprompt; } if (arf == 0x46) { goto end; } if (arf == 0x66) { goto end; } else { goto arfprompt; } } end:std::cout <<""; return 0; } //---------------------------------------------------------------------------