Beginning Vectors/ need help with subtracting choices

Hello all!! So i'm learning c++. Im having an issue with vectors. I have an assignment that requires me to do the following.
I have to have the user select 2 of 5 vehicles and then it will subtract the yearly average of mileage for each vehicle and give the difference and which one comes out on top. I'm trying to branch out and seek some better help as the tutors at school are not the very best. Any and all help here would be great. I have the general layout I used with example code and plugged in most of my stuff. But im missing the vector part for subtracting and stuff.
Help would be great!

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
60
61
#include <iostream>		//for cout and cin
#include <vector>		//for vector 
#include <iomanip>		//for setw()
#include <string>

using namespace std;

int main()
{
	vector<int> vNums;	//vector of ints
	vector<string> vNames;	//vector of strings
	int numChoice;
	//string nameChoice;

	cout <<"Difference of milage between there vehicles. ";

	//use the push_back() function to add 5 integers to the vector
	// milage per each car
	vNums.push_back(23);
	vNums.push_back(19);
	vNums.push_back(20);
	vNums.push_back(14);
	vNums.push_back(13);

	//use the push_back() function to add 5 strings to the vector
	// name of each car
	vNames.push_back("Jeep Cherokee");
	vNames.push_back("Toyota 4Runner");
	vNames.push_back("Porsch 911");
	vNames.push_back("Ferrari Spider");
	vNames.push_back("Lamborghini Aventador");

	//use size() function to see how many numbers are in the vector
	cout << "\nThere are " << vNames.size()  << " cars to choose from.";
    cout << "\n List of Vehicles" << endl;

	cout << "\n MPG         Vehicle         Number"<< endl; 

	cout << "\n 23       Jeep Cherokee       1    "; 
	cout << "\n 19       Toyata 4Runner      2    ";
	cout << "\n 20       Porsch 911          3    ";
	cout << "\n 14       Ferrari Spider      4    ";
	cout << "\n 13       Lamborghini         5    ";
 	//use the at() function to obtain the values from the vector
	//first element is at(0)

	cout << "\nEnter a number between 1 and 5\n";
	/*for(int i = 0; i < vNums.size(); ++i)
	{
		cout << setw(5) << vNums.at(i);
	}
	*/
	
	cin>>numChoice;
	numChoice --;
	cout << setw(5) << vNames.at(numChoice) << " has " ;
	cout << vNums.at(numChoice) << " Miles Per Gallon." ;

	cout << endl;
	return 0;
}
Topic archived. No new replies allowed.