Advertisement
hendgo12

Source

Oct 11th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <fstream>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. int Xcord, Ycord, Xdivpt, Ydivpt, repeat;
  10.  
  11. ifstream infile;
  12. ofstream outfile;
  13. infile.open("Infile3.txt");
  14. outfile.open("Outfile3.txt");
  15.  
  16. infile >> Xdivpt >> Ydivpt;
  17.  
  18. outfile << "My Name \n \n";
  19.  
  20. outfile << "This division point is " << Xdivpt << ',' << Ydivpt << " \n";
  21.  
  22. while(infile)
  23. {
  24. infile >> Xcord >> Ycord;
  25.  
  26. if (Xcord == Xdivpt && Ycord == Ydivpt)
  27. {
  28. outfile << setw(6) << Xcord << setw(8) << Ycord << setw(14)
  29. << " Division Point \n";
  30. }
  31. else if (Xcord == Xdivpt && Ycord > Ydivpt)
  32. {
  33. outfile << setw(6) << Xcord << setw(8) << Ycord << setw(14)
  34. << " Between Kiowa and Tepee \n";
  35. }
  36. else if (Xcord > Xdivpt && Ycord == Ydivpt)
  37. {
  38. outfile << setw(6) << Xcord << setw(8) << Ycord << setw(14)
  39. << " Between Comanche and Kiowa \n";
  40. }
  41. else if (Xcord == Xdivpt && Ycord < Ydivpt)
  42. {
  43. outfile << setw(6) << Xcord << setw(8) << Ycord << setw(14)
  44. << " Between Comanche and Nocona \n";
  45. }
  46. else if (Xcord < Xdivpt && Ycord == Ydivpt)
  47. {
  48. outfile << setw(6) << Xcord << setw(8) << Ycord << setw(14)
  49. << " Between Nocona and Tepee \n";
  50. }
  51. else if (Xcord > Xdivpt && Ycord > Ydivpt)
  52. {
  53. outfile << setw(6) << Xcord << setw(8) << Ycord << setw(14)
  54. << " Kiowa \n";
  55. }
  56. else if (Xcord > Xdivpt && Ycord < Ydivpt)
  57. {
  58. outfile << setw(6) << Xcord << setw(8) << Ycord << setw(14)
  59. << " Comanche \n";
  60. }
  61. else if (Xcord < Xdivpt && Ycord < Ydivpt)
  62. {
  63. outfile << setw(6) << Xcord << setw(8) << Ycord << setw(14)
  64. << " Nocona \n";
  65. }
  66. else if (Xcord < Xdivpt && Ycord > Ydivpt)
  67. {
  68. outfile << setw(6) << Xcord << setw(8) << Ycord << setw(14)
  69. << " Tepee \n";
  70. }
  71.  
  72. }
  73.  
  74. infile.close();
  75. outfile.close();
  76. return 0;
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement