like the title says, how can I change two ints with a single input? In my program there's two types of vehicles and they have different prices, each vehicle has a different rate added per foot if it's length exceeds 20 ft.
I was thinking it would go something like this but it only changes x's value
1 2 3 4 5
int x
int y
cout << "What is the length of the vehicle in feet?";
cin >> x & y;
#include <iostream>
int main()
{
int c{ 0 };
int& x{ c }; int& y{ c };
std::cout << "What is the length of the vehicle in feet?\n";
std::cin >> c;
std::cout << "x = " << x << "\ty = " << y << "\n";
}
What is the length of the vehicle in feet?
12
x = 12 y = 12