Program Not Reading .txt File

So My Problem I have a program that makes a .txt file and I am trying to read it and it won't so I would like to know why my code is directly the same as the file maker so whatever the problem is just show me the code fixed so I can input into VS 2013 Pro and use it because I am inexperienced at C++

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include <iostream>
#include <string>
#include <fstream>


using namespace std;

int main()
{
	string fershizzle;
	getline(cin, fershizzle);

	ifstream theFile (fershizzle);

	int idNumber;
	string firstname;
	string lastname;
	string Address;
	int age;
	string height;
	int weight;

	while (theFile >> idNumber >> firstname >> lastname >> Address >> age >> height >> weight)
	{

		cout << "ID Number - " << idNumber << endl;
		cout << "First Name - " << firstname << endl;
		cout << "Last Name - " << lastname << endl;
		cout << "Address - " << Address << endl;
		cout << "Age - " << age << endl;
		cout << "Heigth - " << height << endl;
		cout << "Weight - " << weight << " LBS" << endl;
		cout << "" << endl;
		cout << "" << endl;
	}
	

	cout << "" << endl;
	cout << "" << endl;
	cout << "UANSoftware Made 2014" << endl;

	return 0;

}
What is the content of the file?
It's the same code for the filemaker That works i used same stuff the couts with the idnumber in all is for this address book program I'm working on files contain address entries
The >> operator will read the strings and numbers as if they were separated by whitespace characters (like space and newline). If you have all that "ID Number", "First Name", etc. in the file you will have to handle that when you read the file. Easiest is to simply leave it out and only have the actual variable values in the file.
Can you show me how to right the code correctly ave a explanation
If you have questions we will try to answer them but we will not do the your homework for you.
How can i make the information show instead of not showing anything i have spot on according to the newboston videos
Try

ifstream theFile ("fershizzle");
It didnt work
You'll need to give us the contents of the file.

For instance, when I give it this text file:
14 Bob Jones 123FakeStreet 47 5'3" 142

then the program works perfectly fine:
ID Number - 14
First Name - Bob
Last Name - Jones
Address - 123FakeStreet
Age - 47
Heigth - 5'3"
Weight - 142 LBS




UANSoftware Made 2014
That's what I type in but the file doesn't read if i say make a file with the entry maker where it is complimentary of the code you see here but when i add that text file it doesn't work
Entry maker?
What's that?

Try adding this after line 13:
14
15
16
17
18
if (!theFile)
{
    cout << "Couldn't open file for reading!";
    return 0;
}

Also, make sure that the file is in the same directory as the program.
You may be putting in the wrong filepath in the console. Also @SamuelAdams he is using a variable named fershizzle as his filename it's an awful variable name but it's the one he uses to input the filename.
Awkward. Not working in any sense.
Topic archived. No new replies allowed.