0% found this document useful (0 votes)
10 views3 pages

Lab 3

The document outlines a lab focused on C++ strings and basic file writing, emphasizing the use of arrays and file I/O. It includes several tasks such as finding keywords in text, storing marks and ratings in files, and analyzing grades. Each task involves practical applications of file handling and data storage techniques in programming.

Uploaded by

hirrah21
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

Lab 3

The document outlines a lab focused on C++ strings and basic file writing, emphasizing the use of arrays and file I/O. It includes several tasks such as finding keywords in text, storing marks and ratings in files, and analyzing grades. Each task involves practical applications of file handling and data storage techniques in programming.

Uploaded by

hirrah21
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Programming Fundamentals

Lab 03
Topic C++ String and Basic File Writing

• Array
o Integer, Character, C-String
o Different input methods
o Problem solving using Arrays.

Objective • File I/O (Text File Writing)


o Need and importance of File Output.
o Different modes of output file stream (out, app).
o Opening/Closing a text file stream.
o Writing formatted/un-formatted data to file.
o Problem solving involving files (ofstream).

1
Lab Tasks
Task 1: Find a word problem:
Book reading is a good practice. Almost all type of books is available in soft form as well. We often need
to find some keywords in order to read about it from books. It is quite difficult to find a keyword from
hard copy. But on other hand we can easily find any keyword form a soft copy.

A. Find a keyword:
In order to find a keyword let’s try to find a character first. Compare the entered character with each
character of array.

B. Display Keyword:
Now apply same logic which we discussed above and try to find a keyword from a character array.

C. Count keyword:
After successful attempt of finding key word let’s try to count that how many times that keyword is found.

Task 2: Marks problem:


As we solve a problem of identify the position holders in previous lab. We need to store the position
holder information in a file. Store each record on each line of file.

Task 3: Uber stars problem:


After every ride a passenger assign stars as their satisfaction with the ride. Uber wants to store this
information for further processing. Store each record as comma separated value.

Task 4: Movie rating problem:


We have multiple videos on YouTube. Each video has some likes and dislikes. YouTube wants to store this
information for later use. Store this information in a file. We can store each record on each line.

Task 5: Grade analysis problem:


In your Programming Fundamentals class all student scores some grade in Introduction to Computing. We
need to perform an analysis on the grades of ITC in order to determine the performance of class.

Task 6: Calculate the grade count:


We have multiple grades (A, B, C, D, F) in a character array so, calculate the count of each grade and store
it into a file.

2
Task 7: Admission form problem:
Thousands of students got admission in UCP. It is difficult to store their admission form. So, UCP want to
store the record of their student in soft form for later use. Each entity of form is stored as comma
separated value and each line stores record of each student.

You might also like