Elysia try the code first !!
iostream should not be included as fstream is inherited from iostream only!!
So for your kind information when fstream is included there's no need to include iostream
http://www.cplusplus.com/reference/iostream/fstream/
Secondly do you mean to say!!if i have 20 members in class i should take input of 20 members in main 1 by 1??and then write a function which takes 20 arguments and copies 1 by 1 to class members?!!!??? That's pretty funny isn't it?