Why wont my read file open?

For some reason this code goes directly to the else statement. I have tried using the absolute path but fr some reason i get an error window pop up that crashes visual studio.

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
#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main()
{
	ifstream inputFile;
	double number = 0;
	int count = 0;
	string name;
	inputFile.open("Rainfall.txt");
	if (inputFile)
	{
		while (inputFile >> name >> number)
		{

			cout << name << number << endl;
		}
		inputFile.close();
	}
	else
	{
		cout << "Error \n";
	}
	return 0;
}

Nevermind sorry how can i delete this post
Topic archived. No new replies allowed.