Multiple inputs

I have an exercise in my book that requires me to get five different inputs as reference variables in a function, and I will have to pass them to a different function. The only way I know to get the function to ask for five different numbers is with a for loop. We haven't learned arrays yet, so I can't use that. How do I get the loop to store five variables when it can only define one?
Don't use a loop. Define 5 separate variables.
1
2
  int v1, v2, v3, v4, v5;
  cin >> v1 >> v2 >> v3 >> v4 >> v5;

I am required to use a function that asks for a number. I'll have to make that function repeat five times to get all five numbers. Can I store each input from each iteration of the loop in a different variable?
Can I store each input from each iteration of the loop in a different variable?

Sure. You can use a series of if statements or a switch statement.
1
2
3
4
5
6
7
  for (int i=1; i<=5; i++)
  {  if i==1)
        cin >> v1;
     if (i== 2)
        cin >> v2; 
    ... etc 
  }


Or:
1
2
3
4
5
6
7
8
  for (int i=1; i<=5; i++)
  { switch (i)
     case 1: cin >> v1;
                 break;
     case 2: cin >> v2;
                 break;
    ... etc
  }

Thankyou
In the same program, I have to create another funtion that dictates the lowest of the five numbers. I know how to do that. But, the funtion that that function resides in is supposed to drop the lowest of the numbers. I'm not sure how to make the function drop the lowest number. I have to average the remaining four after the lowest is dropped.
I worded that wrong. The secondary function is supposed to identify the lowest number, and return that number to the function that it resides in. So the bigger function will have to drop the lowest number.
Here is what I have so far, to give a general idea of what functions there are.

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
62
63
64
65
66
 #include <iostream>

using namespace std;


void getScore(int &, int &, int &, int &, int &);
void calcAverage();
int findLowest(int);

int score1, score2, score3, score4, score5, count;

int main ()

{
     cout<<"Welcome. The intent of this program is to intake five test scores from the \n";
     cout<<"user, take out the lowest score, and average them together. \n";
     cout<<"When asked to input a score, please do not enter a number less than 0 or higher than 100.\n";
     
     for (count=1; count<=5; count++)
         {
              getScore(score1, score2, score3, score4, score5);
              }
              
         calcAverage;
         
}

void getScore(int &sc1,int &sc2,int &sc3,int &sc4,int &sc5)

{
    int test;
     
     cout<<"Please enter test score " <<count <<":\n";
     cin>>test ;
     while (test>100||<0)
        {cout<<"Your entry is invalid, please try again: ";
        cin>>test;
        
        
     switch (count)
     case 1: test=sc1;
          break
     case 2: test=sc2;
          break
     case 3: test=sc3;
          break
     case 4: test=sc4;
          break
     case 5: test=sc5;
}

     calcAverage
{
     
     
     
     
     findlowest(int lowest);
}

int find lowest(int lowest)

{     
 
 
        
Topic archived. No new replies allowed.