I am writing a program to take in data into a file, close the file. Then re open the file, ask for terminal number person wants to see, program needs to display all information entered for that terminal number.

Here is my problem , no matter what terminal number I enter the last information entered is what is displayed.

how do I make this work. Thanks in advance for your suggestions and help.

Code:
#include <iostream>
#include <fstream>
#include <string>
#include <iomanip>
#include<cassert>
#include <math.h>
using namespace std;


void main()
{
	string bldg;
	char accessCode;
	int transRate;
	string termType;
	int serviceDay;
	int serviceMonth;
	int serviceYear;
	int TermNumber;
	int TotalTerm;

	
	ofstream outStream;
	outStream.open("OutputFile.TXT");

	cout << "Enter total number of Terminals to store " << "\n";
	cin >> TotalTerm;

    
	for (int i=0; i < TotalTerm; i++)
	{
		cout << "Enter Terminal Number:  "  << "\n";
		cin >> TermNumber;
		cout << "Enter Transmission rate:  " << "\n";
		cin >> transRate;
		cout << "Enter terminal type:  " << "\n";
		cin >> termType;
		cout << "Enter building terminal is located:  " << "\n";
		cin >> bldg;
		cout << "Enter access code to terminal:  " << "\n";
		cin >> accessCode;
		cout << "Enter day of last servicing date (dd):  " << "\n";
		cin >> serviceDay;
		cout << "Enter month of last servicing date (mm):  " << "\n";
		cin >> serviceMonth;
		cout << "Enter year of the last servicing date (YYYY):  " << "\n";
		cin >> serviceYear;
	}
	outStream.close();

	/* This section gets value from the closed file  */

	ifstream inFile("OutputFile.TXT", ios::end);
	
	if(!inFile)
	{
		cerr << "File could not be opened!" << "\n";
		exit (1);
	}


	cout << "Enter Terminal number to search for:  " << "\n";
	int search;
	cin >> search;
    char ch;
	ch = inFile.get();
	if (search = TermNumber)

		
		cout << TotalTerm << "    " << bldg << "     "  << accessCode << "\n"; 
	    cout << transRate << "     " << termType << "     " << serviceDay << "\n";
	    cout << serviceMonth << "    " << serviceYear << "\n";
}