I've a text file : Random.txt which comprises of
Now in my program i've a class
Now I've to write a code in c++, where i've to read the given data and store this into 3 objects of stud class(array of objects) ...then further i've to manipulate the above stored data...
I think i'm getting error while storing...variables are showing random characters...
Please give me the code.for this program..in C++
This is a class, so all of the members are private by default. You do not appear to have a constructor or any other member functions that would fill in the data so I imagine that you are trying to access the members directly. Either:
A.) Make the members public.
B.) Change the class to a struct.
or C.) Add a public function that will allow you to access these data members from outside of the class.
Any one of the above will fix your issue.
EDIT: The constructor has to be public to be of any use to you.