HELP START READING FROM DIFFERENT STRING IN FILE!

Right so I managed to read the first lines I neeeded but I need to create a new loop and start reading the file from about the 12th line how do i do this? keep it basic talk dumb to me if you have to! here is my code.. I have read the first ship details and outputted it to a different text file.

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
49
50
51
52
53
54
55
56
57
58
59
#include <iostream>
#include <fstream>
#include <string>

using namespace std;

int main(int argc, char *argv[]) {

	ifstream text("Input.txt");
	
    double recmax;
	string shipid;
	string journid;
	int lengthjourn;
	int numcrewmonarch;
	int hourratemonarch;
	double wage1m;
	double wage2m;
	double wage3m;
	double wage4m;
	double wage5m;
	double wage6m;
	double wage1;
	double wage2;
	double wage3;
	double wage4;
	double totalwagemonarch;
	double totalwageprincess;
	double totalwageempire;
	double totalwagecrown;
	double totalwagebootle;

	text >> shipid >> journid >> lengthjourn >> numcrewmonarch >> wage1m >> wage2m >> wage3m >> wage4m >> wage5m >> wage6m;

	hourratemonarch = wage1m+wage2m+wage3m+wage4m+wage5m+wage6m;
	totalwagemonarch = numcrewmonarch * hourratemonarch;
	
    cout << "Please enter the recommended max journey cost as a numeric value" << endl;
	cin >> recmax;

	if (totalwagemonarch <= recmax) {
    cout << "The total cost for this crew is less than or equal to the Recommended Max Cost" << endl;
	ofstream output;
	output.open("Output.txt");
	output << "Your total for ship " << shipid << " is " << totalwagemonarch << " this is less than or equal your recommended max " << recmax << endl;
	}
	else {
	cout << "Your limit exceeds the recommended max!" << endl;
	}



	text.close();

	cin.get();
	cin.ignore();
	return 0;

}


here is the data of the text file im reading from below!

Monarch
M141
16
6
10.5
10.5
20
20
20
30

Princess
P103
18
5
40
45
45
60
80

Empire
E77
24
7
20
20
20
20
20
20
50

Crown
C110
14
10
10
15
15
15
15
16.3
16.3
15
30
32

Bootle
B2618
4
1
9
I would suggest starting with a vector of a class/structure that holds the individual fields. And it looks like the "wage" should be a vector within that class/structure.



Topic archived. No new replies allowed.