My Functions are not passing their references

I am only able to get one reference passed back to the main function however it is causing an indefinate loop could someone please help!!!

#include <iostream>
#include <iomanip>
#include <string>

using namespace std;



int readDials(int&, int&, int&, int&, int&, int&, int&, int&);
int ToDigit (int&, int&, int&, int&, int&, int&, int&, int&);
void AcknowledgeCall (int, int, int, int, int, int, int, int);


int main()
{
int d1 =-6, d2 =-6, d3 = -6, d4 =-6, d5 = -6, d6 = -6, d7 = -6, d8 = -6;
int result = -6;
while (result != -5)
{
result = readDials(d1, d2, d3, d4, d5, d6, d7, d8);
switch(result)
{
case -1: cout << "ERROR - An invalid character was entered" << endl; break;
case -2: cout << "ERROR - Phone number cannot begin with 0" << endl; break;
case -3: cout << "ERROR - Phone number cannot begin with 555" << endl; break;
case -4: cout << "ERROR - Hyphen is not in the correct position" << endl; break;
case -5: return 0; break;
default: AcknowledgeCall(d1, d2, d3, d4, d5, d6, d7, d8);
}
}
return 0;
}
int readDials(int &d1, int &d2, int &d3, int &d4, int &d5, int &d6, int &d7, int &d8)
{

cout << "Enter the first digit of the phone number or Q to quit. " << endl;
cin >> d1;
char q =0, Q=0;
if (d1 == q || d1 == Q)
return -5;
cout << "Please enter the entire number " << endl;
cin >> d1 >> d2 >> d3 >> d4 >> d5 >> d6 >> d7 >> d8;
int result = ToDigit(d1, d2, d3, d4, d5, d6, d7, d8);
if(result == -1)
return -1;
if(result == -2)
return -2;
if(result == -3)
return -3;
if(result == -4)
return -4;
else if ( result != -1 || result != -2 || result != -3 || result != -4)
return -5;
return result;

}
int ToDigit(int &d1, int &d2, int &d3, int &d4, int &d5, int &d6, int &d7, int &d8)

{

if(d1 == 5 && d2 == 5 && d3 == 5)
return -3;
if (d1 == 0)
return -2;
if (d4 != '-')
return -4;

switch (d1, d2, d3, d5, d6, d7, d8)
{
case 'a':
cout << "2";
break;
case 'A':
cout << "2";
break;
case 'b':
cout << "2";
break;
case 'B':
cout << "2";
break;
case 'c':
cout << "2";
break;
case 'C':
cout << "2";
break;
case 'd':
cout << "3";
break;
case 'D':
cout << "3";
break;
case 'f':
cout << "3";
break;
case 'F':
cout << "3";
break;
case 'g':
cout << "4";
break;
case 'G':
cout << "4";
break;
case 'h':
cout << "4";
break;
case 'H':
cout << "2";
break;
case 'i':
cout << "4";
break;
case 'I':
cout << "4";
break;
case 'j':
cout << "5";
break;
case 'J':
cout << "5";
break;
case 'k':
cout << "5";
break;
case 'K':
cout << "5";
break;
case 'l':
cout << "5";
break;
case 'L':
cout << "5";
break;
case 'M':
cout << "6";
break;
case 'm':
cout << "6";
break;
case 'o':
cout << "6";
break;
case 'O':
cout << "6";
break;
case 'p':
cout << "7";
break;
case 'P':
cout << "7";
break;
case 'q':
cout << "7";
break;
case 'Q':
cout << "7";
break;
case 'r':
cout << "7";
break;
case 'R':
cout << "7";
break;
case 's':
cout << "7";
break;
case 'S':
cout << "7";
break;
case 't':
cout << "8";
break;
case 'T':
cout << "8";
break;
case 'u':
cout << "8";
break;
case 'U':
cout << "8";
break;
case 'v':
cout << "8";
break;
case 'w':
cout << "9";
break;
case 'W':
cout << "9";
break;
case 'x':
cout << "9";
break;
case 'X':
cout << "9";
break;
case 'y':
cout << "9";
break;
case 'Y':
cout << "9";
break;
case 'z':
cout << "9";
break;
case 'Z':
cout << "9";
break;
return 0;

}
return d1, d2, d3, d5, d6, d7, d8;
}
void AcknowledgeCall(int d1, int d2, int d3, int d4, int d5, int d6,int d7, int d8)
{

cout << " The number is " << d1 << d2 << d3 << d4 << d5 << d6 << d7 << d8 << endl;

}
Topic archived. No new replies allowed.