You will code, build, and execute a program that simulates the dialing of a phon
ID: 3560909 • Letter: Y
Question
You will code, build, and execute a program that simulates the dialing of a phone using functions. in C++
Explanation / Answer
#include #include #include using namespace std; int readDials(); void toDigit(); void acknowledgeCall(); int main() { // Declaring variables string num; char one, two, three, four, five, six, seven, eight; cout > num; two = num[1]; three = num[2]; four = num[3]; five = num[4]; six = num[5]; seven = num[6]; eight = num[7]; readDials(one, two, three, four, five, six, seven, eight); return; int readDials(char &one, char &two, char &three, char &four, char &five, char &six, char &seven, char &eight) { if(one == 0) return -2; else if (one == 5 && two == 5 && three == 5) return -3; else if (four != '-') return - 4; else toDigit(); } void toDigit(int & d) { toupper(d); switch(d) { case 'A': case 'B': case 'C': d = '2'; break; case 'D': case 'E': case 'F': d = '3'; break; case 'G': case 'H': case 'I': d = '4'; break; case 'J': case 'K': case 'L': d = '5'; break; case 'M': case 'N': case 'O': d = '6'; break; case 'P': case 'Q': case 'R': case 'S': d = '7'; break; case 'T': case 'U': case 'V': d = '8'; break; case 'W': case 'X': case 'Y': case 'Z': d = '9'; break; } void acknowledgeCall(); { char phoneNumber; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.