We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,939 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

write a program in C++ to read a .txt file with string as a delimeter?

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.

3
Contributors
3
Replies
1 Day
Discussion Span
10 Months Ago
Last Updated
4
Views
Archuom
Newbie Poster
1 post since Jun 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

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

laith al hamed
Newbie Poster
2 posts since Jun 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

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

laith al hamed
Newbie Poster
2 posts since Jun 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

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.

Lucaci Andrew
Practically a Master Poster
649 posts since Jan 2012
Reputation Points: 91
Solved Threads: 91
Skill Endorsements: 12

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0674 seconds using 2.73MB