how do i let the user input with a loop?

Write your question here.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
void userinput(int& a_,int& b_,int& c_,int& d_,int& e_,int& f_)
{
	cout << "Enter a: ";
	cin >> a_;
	cout << "Enter b: ";
	cin >> b_;
	cout << "Enter c: ";
	cin >> c_;
	cout << "Enter d: ";
	cin >> d_;
	cout << "Enter e: ";
	cin >> e_;
	cout << "Enter f: ";
	cin >> f_;
}

//after user enters a move on to b
//i want to use a loop for this
//a is at a certain location
//how do i position the address to b after a is done 
Last edited on
I guess I don't understand, you don't need a loop for input like the above.

If you still want to use a loop, i'd suggest looking at arrays.
//how do i position the address to b after a is done

the name of a variable will automatically link to its memory address and if you want the various input variables to be in some sort or arranged order then you could use a C-style array or std::vector<int>, both are guaranteed contiguous memory by the standard
Topic archived. No new replies allowed.