Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
467 views
in Computer by (50.9k points)
closed by

Find the output of the following C++ code considering that the binary file sp.dat already exists on the hard disk with 2 records in it. 

class sports 

int id;

char sname[20]; 

char coach[20];

public:

void entry();

void show(); 

void writing(); 

void reading(); 

}s; 

void sports::reading() 

ifstream i;

i.open("sp.dat");

while 

{

i.read((char*)&s, sizeof(s)); 

if(i.eof()) break; 

else 

cout<<"\n" <<i.tellg();

i.close(); 

}

void main() 

{

s.reading(); 

}

1 Answer

+1 vote
by (45.3k points)
selected by
 
Best answer

Output

42

84

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...