This is because the condition of the while loop immediately evalautes to false, and thus, execution of its compound statement never occurs. You likely meant to write !show.eof() to reiterate until true is returned.
In any case, it's not a good idea to test for eof() in a while loop. Instead, put the actual input statement in the condition. Then the body of the loop is executed only after a successful input was read.
1 2 3 4 5 6 7 8 9 10 11 12
// whatever you want here
cout << "rn: " << rn
<< " name: " << name
<< " ma: " << ma
<< " ne: " << ne
<< " prf: " << prf
cout<<"Your profit is "<<prf << endl;
Well then, you need to add a test, use an if statement to check for the required details. I only showed how to read the file, I assumed you could at least have a go at the rest.
Note that at present the variable rn is used to get the user input, and then the same variable is used to read from the file, thus the user input is lost. You will need a separate variable to keep track of both pieces of information.
Give it a try, if you get stuck, post your updated code so we can see what the problem is.
As mentioned previously, the value for rn entered by the user will be replaced by the one which is read from the file. you need to use two completely separate variables for this.
Also within the while loop, on the first pass, the file has not yet been accessed, so the various data items contain uninitialised (garbage) values. It is better to not use eof() in the loop condition. Instead put the file input code there. This way, the body of the loop will be entered only after a successful input operation.
1 2 3 4 5
// we get to here only after the file input was successful
// put whatever code is needed here...
Now within the loop, all of your if statements perform the same action, so there is no way to tell which one was executed. But I don't think this is what you really need. I presume (am I wrong?) that you want to take the value of Registered ID which was entered by the user and compare that with the value which has been read from the file. If that's the case, then your code might look something like this:
1 2 3 4 5 6 7 8 9
if ( user_rn == file_rn )