OMG...you are right. i deleted ios::in and i replaced it by ios::ate to append the input to the end of the file, now it is writting some non sence staff to the file.
ok firstly it does not append the new input to the previous input, secondly i mean for example when i write jafar as patient name, it writes this to the file: 慪慦r