here is the code:
// CS 200 Lab 11 Problem 3 - phone.cpp
// Test program for the keyToTones function.
#include <iostream>
using namespace::std;
// Definition of the PhoneTones struct
struct phoneTones
{
int rowTone, // Frequencies of the tones generated by a key press
colTone;
};
// Function prototype
phoneTones keyToTones ( char key );
//--------------------------------------------------------------------
void main()
{
char inputKey; // Input key
phoneTones keyFreqs; // Frequencies of the corresponding tones
// Read in a series of keys and output the corresponding tones.
for ( int i = 1; i <= 12 ; i++)
{
cout << endl << "Enter key pressed (0-9, *, or #): ";
cin >> inputKey;
keyFreqs = keyToTones(inpu tKey);
cout << "Tones produced at " << keyFreqs.rowTon e << " and "
<< keyFreqs.colTon e << " Hz" << endl;
}
}
//--------------------------------------------------------------------
// Insert your keyToTones function here.
phoneTones keyToTones ( char key )
{
//int rowTone, colTone;
//phoneTones rowTone, colTone;
switch ( key )
{
case '1': case '2': case '3': rowTone = 697;
break;
case '4': case '5': case '6': rowTone = 770;
break;
case '7': case '8': case '9': rowTone = 852;
break;
case '*': case '0': case '#': rowTone = 941;
break;
}
switch( key )
{
case '1': case '4': case '7': case '*': colTone = 1209;
break;
case '2': case '5': case '8': case '0': colTone = 1336;
break;
case '3': case '6': case '9': case '#': colTone = 1447;
break;
}
// what do i need to return to make this work?
// return colTone, rowTone
}
//--------------------------------------------------------------------
i need to know what to return to the calling function. the things i have tried are in the program under "what do i need to return to make this work?". and how do i need to define those in the function is my main problem returning should be the easy part.