Question about Max and Min program

Hey guys so I'm writing this program for my class and it asks for us to somehow be able to allow the user to input a number with a weight behind it. "You will need to handle the user inputting a weight either with grams (g) or with kilograms (kg). So user input for any weight value, including the maximum, should operate under the assumption (number)(space)(unit)for example
10 kg
or
400 g". I'm not sure if he is asking for just a variable where it shows up behind the input or is he asking for us to be able to have it distinguish what form of weight it is. Im very new to this so any and all help is much appreciated!

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

int main() {
double Min_Dollar;
double Max_Weight;
double OneDV;
double OneW;
double TwoDV;
double TwoW;
double ThreeDV;
double ThreeW;
double FourDV;
double FourW;
double minprice;
double maxweight;

	cout <<endl << "Enter Minimum Dollar Value:";
	cin >> Min_Dollar; 
	
	cout <<endl << "Enter Maximum Weight:";
	cin >> Max_Weight;
        cout << "kg";
	
	cout <<endl << "Enter Item One Dollar Value:";
	cin >> OneDV; 
	
	cout <<endl << "Enter Item One Weight:";
	cin >> OneW;
	cout << " g";
	
	cout <<endl << "Enter Item Two Dollar Value:";
	cin >> TwoDV;
	
	cout <<endl << "Enter Item Two Weight:";
	cin >> TwoW;
	cout << " g";

	
	cout <<endl << "Enter Item Three Dollar Value:";
	cin >> ThreeDV;
	
	cout <<endl << "Enter Item Three Weight:";
	cin >> ThreeW;
	cout << " g";

	cout <<endl << "Enter Item Four Dollar Value:";
	cin >> FourDV;
	
	cout <<endl << "Enter Item Four Weight:";
	cin >> FourW;
	cout <<endl;
Can't get too much from description. But I think he/she wants your program to accept the user input in the following format:
10 g
10 kg
My apologies, yes that is what they want to be inputed. My question is how would I set the variable g or kg to say that its in units of kilograms or grams? We were given the choice between the two so I have my the output set to print in kg.
Topic archived. No new replies allowed.