Displaying a text file

Hey guys, im having trouble with this code. Basically i have a text file with employee id numbers and their names next to them (ex: 8379192 Sean). I am asked to create the following:

Write a program to that allows the user to input a name from the keyboard. The program should then read from the file and search for matching name among the employees. If a match is found it should output the name/names with the ID/IDs and the total number of employee/employees in you program. The program should also indicate if there is no match (see Figure4).
You program also must account for the following scenarios:
• Your program cannot open the data file. Figure1 illustrates the expected behavior.
• Your program should also display the total number of employee(s) found after searching.
• If there is only one employee found, your program should display “There is only 1
employee found from the employee list.”; If there are x (x>1) employees found, your program should display “There are x employees found from the employee list.”. Figure 2 & 3 illustrate the expected behaviors.

Can anybody help?
Please and thank you!
Hello npat7,

Here is the answer to your code problem:
1
2
3
4
5
6
7
8
9
10
11
12
13













Or 42 https://www.youtube.com/watch?v=aboZctrHfK8

Since you did not post any code that you are referring to It is hard to say what is wrong.

Also since there is a file to be read from you need to include the file, or a fair sample to test the program with.

Your instructions refer to "figure 4", but only you know what this look like and what it refers to. The same goes for figures 2 and 3.

When you get to posting code this should help:

PLEASE ALWAYS USE CODE TAGS (the <> formatting button), to the right of this box, when posting code.

Along with the proper indenting it makes it easier to read your code and also easier to respond to your post.

http://www.cplusplus.com/articles/jEywvCM9/
http://www.cplusplus.com/articles/z13hAqkS/

Hint: You can edit your post, highlight your code and press the <> formatting button.
You can use the preview button at the bottom to see how it looks.

I found the second link to be the most help.



Do not edit your OP with updates. Post them in a new message.

When you post the code that you have you can get a better answer.

Hope that helps,

Andy
Hello npat7,

I did not mean to scare you off, but when the first line of your OP starts with:
Hey guys, im having trouble with this code.
and you do not post any code that is a problem.

Can not work on something that is not there.

Andy
Topic archived. No new replies allowed.