Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program that asks for both a file and name of a student. Then: If you cannot open the file, display File does

Write a C++ program that asks for both a file and name of a student. Then: If you cannot open the file, display File does not exist. and stop the program. If the student is not in the file, display No student with that name. If the student is in the file, show their grade. You may assume the format of the file is the same as the given example grades.txt. You cannot make any assumptions on the number of students in the file. You can assume each students name in the file is unique.

Example 1 (user input is bold):

What file?

iDontExist.txt

Whose name?

Jacob

File does not exist.

Example 2 (user input is underlined):

What file?

grades.txt

Whose name?

Jacob

No student with that name.

Example 3 (user input is underlined):

What file?

grades.txt

Whose name?

Anisha

Grade:

C

grades.txt is below:

James : 67.34 : D+ : Senior Maximilian : 93.23 : A : Junior Gal : 85.94 : B : Sophomore Fox : 23.10 : F : Senior Baldo : 99.99 : A : Freshman Emyr : 94.33 : A : Senior Grigorii : 75.29 : C : Junior Ibb : 88.41 : B+ : Freshman Gerardo : 71.93 : C- : Freshman Sonam : 84.11 : B : Freshman Fabiana : 91.49 : A- : Junior Shams : 83.83 : B : Senior Filip : 13.45 : F : Sophomore Anisha : 74.12 : C : Senior Kilian : 63.41 : D : Sophomore Tamatoa : 95.00 : A : Junior Gurmeet : 74.20 : C : Sophomore Aminda : 83.13 : B : Senior Lubomir : 81.30 : B- : Freshman Miguela : 74.20 : C : Senior Bernard : 89.58 : B+ : Junior

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

XML Data Management Native XML And XML Enabled Database Systems

Authors: Akmal Chaudhri, Awais Rashid, Roberto Zicari, John Fuller

1st Edition

0201844524, 978-0201844528

More Books

Students also viewed these Databases questions