I have a file info.txt like below

NAME ID=karan PLACE=Mumbai AGE=23-
PHONE=1234 HANDICAP=No-
OCCUPATION=Student
NAME ID=Ravi PLACE=Goa AGE=25-
PHONE=4567 HANDICAP=Yes-
OCCUPATION=Employee

I want to read the file with make them into record strings as below
"NAME ID=karan PLACE=Mumbai AGE=23 PHONE=1234 HANDICAP=No OCCUPATION=Student"
"NAME ID=Ravi PLACE=Goa AGE=25 PHONE=4567 HANDICAP=Yes OCCUPATION=Employee"

Please suggest how to write a program in C++?

Thanks in advance.

Recommended Answers

All 3 Replies

Write a console based C++ program that reads student information from a text file, build an array of objects of type class StudentInfo, and provide the following set of operations:
1) Display all student Info
2) Display all Student First Name & GPA
3) Display a specific student grades based on his/her ID
4) Display all Passed Student Names & GPAs; (Pass means GPA >= 50)
5) Display the student name with the maximum GPA
6) Display the student name with the minimum GPA
7) Display Student GPAs as Letter Grades (A, B, C, D, E, and F).
Note: the Student Info File contains the following set of columns:
ID: int
FirstName: string
SecondName: string
FirstExam: int
SecondExam: int
ThirdExam: int
FinalExam: int
ID
First Name
Last Name
First Exam/20
Second Exam/20
Third Exam/20
Final Exam/40
10
aaa
AAA
10
15
9
23
20
bbb
BBBB
12
18
15
32
30
ccc
CCC
8
14
20
35
40
ddd
DDD
18
19
17
33
50
eee
EEE
12
13
11
20

Write a console based C++ program that reads student information from a text file, build an array of objects of type class StudentInfo, and provide the following set of operations:
1) Display all student Info
2) Display all Student First Name & GPA
3) Display a specific student grades based on his/her ID
4) Display all Passed Student Names & GPAs; (Pass means GPA >= 50)
5) Display the student name with the maximum GPA
6) Display the student name with the minimum GPA
7) Display Student GPAs as Letter Grades (A, B, C, D, E, and F).
Note: the Student Info File contains the following set of columns:
ID: int
FirstName: string
SecondName: string
FirstExam: int
SecondExam: int
ThirdExam: int
FinalExam: int
ID
First Name
Last Name
First Exam/20
Second Exam/20
Third Exam/20
Final Exam/40
10

Archuom: there are plenty examples on the forum, just type file i/o in the search box.
laith al hamed what is your business here? If you do have some questions please make a thread of your own in which you explain your needs and struggles.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.