Click here to Skip to main content
16,005,038 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Creating 2 Class
1.Find the lenght of data, no. of character, no. of numerical value from file
2.All the above is done with object of your own class

What I have tried:

please solve this. how we use file in class?
create 2 class
Posted
Updated 13-Apr-18 3:38am
Comments
Richard MacCutchan 13-Apr-18 11:32am    
That question makes very little sense. You need to talk to your teacher.

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think - this isn't complicated, and you do need the practice.

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
 
Share this answer
 
You create a class that can read a file and provides methods to get the desired data. Use one of the file access methods like C++ istream, C fopen / fread or C open / read to open and read the file. Upon reading (e.g. line by line with text files) process (parse) the content to get / count the data of interest. How to do that depends on the file type (I assume text files) and the data stored in the file.

For text files, you have to identify numerival values. In most cases it should be sufficient to split the content (usually line wise) into words (separated by white spaces) and check if a word is a number. But your assignment is too vague to be more precise.

For non-text files you have to know the exact format of the file.
 
Share this answer
 
Comments
Member 13778005 13-Apr-18 11:23am    
please solve this
Jochen Arndt 13-Apr-18 11:33am    
I provided some hints which should let you got started.

But as mentioned in solution 1 this looks like a homework assignment. For such you will not get the work done for you. Even if not, we are not a code upon request site. We will help if you got stuck at some point with your already done work.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900