I have an assignment in which I ask the user to input a file, which has 2 differ
ID: 3629547 • Letter: I
Question
I have an assignment in which I ask the user to input a file, which has 2 different columns. Then I take those values and output them to a different file. The output file has two columns, one X and Y. From the X and Y values, I have to find the min and max and make sure that min and max are places at the end of the program. I'm not sure how to do the last part. I know how to find min and max from a list that the user inputs but not from a file which I don't even know the data for. Any help is greatly appreciated.Explanation / Answer
first you have to read the data form the file. then read the data and inset them into an array to sort them find min and max. #include #include using namespace std; int main () { ifstream inStream;//1. Declaring the Input stream objects. int a[100]; //size will depend on the data in the file int count; inStream.open("c:\first.txt"); //2. Connecting the Input stream objects to files. if(inStream.fail()) //3. Checking if the files are connected. { coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.