How do you getline and int variable?

So we have a text file with the following data:
Year - Make - Model - Price
2011 Chevrolet Tahoe $30588
There is only 1 space between everything. There is a Dollar Sign ($) in front of the price. How would I go about getting this information from a text file?

I have tried a bunch of methods, and none of them seem to work.

Here is the code that grabs the information:
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
45
46
47
48
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
#include <ctime>
#include "car.h"
using namespace std;

const int number=3;
const int maxPrice=25000;

int main()
{
	int a;
	string b; string c;
	float d; 
	float e;

	car cars [number];
	int i, j;
	float temp; //Price
	int temp2; //Year
	string temp3; //Make
	string temp4; //Model
	float temp5; //Miles

	ifstream inFile; //declaring the File
	inFile.open("carData.txt");
		
	for(i=0; i<number; i++)
	{
		cout << "Enter the YEAR of the car: ";
		getline(cin,a);
		cars[i].setYear(a);
		cout << "Enter the MAKE of the car: ";
		getline(cin,b);
		cars[i].setMake(b);
		cout << "Enter the MODEL of the car: ";
		getline(cin,b);
		cars[i].setModel(c);
		cout << "Enter the number of MILES on the car: ";
		cin >> d; 
		cars[i].setMiles(d);
		cout << "Enter the PRICE of the car: ";
		getline(cin,e);
		cars[i].setPrice(e);
		cout << " " << endl;
	}	


The main continues much further than that, this is just to getline all of the data.
Topic archived. No new replies allowed.