Input/Output file

Hello there, I am still new in this whole programming language. Can you assist me regarding on Input/Output file question as below?

Write a program that tabulates results of an opinion poll on banning smoking in public places. The results are contained in a file name smoke.dat as below.

1 19 25

2 23 24

3 6 5

Each record consists of a single opinion: 1 indicates “agreed”, 2 for “not agreed”, and 3 for “not sure”. Then the results are displayed on the screen as below:

Opinion Male Female Total


Agreed 19 25 44

Not agreed 23 24 47

Not sure 6 5 11


Total 48 54 102

So basically, how to call a file from 'smoke.dat' and translate them into the output above?
Do you already know about data file handling in C++? I'd suggest that you take a look at this :
Topic archived. No new replies allowed.