Using the pseudo code below, write the code that will meet the requirements:
Main Function
D...
Computers and Technology, 22.04.2021 22:00 aarionna8
Using the pseudo code below, write the code that will meet the requirements:
Main Function
Declare the char variables for the 8 digits of the phone number
while true
Call the ReadDials function passing the 8 digits
by reference. ReadDials returns an error code by
value.
If the return value is -5, exit the do while loop
If the error code is -1, display the
error message "ERROR - An invalid character was entered".
If the error code is -2, display the
error message "ERROR - Phone number cannot begin with 0".
If the error code is -3, display the
error message "ERROR - Phone number cannot begin with 555".
If the error code is -4, display the
error message "ERROR - Hyphen is not in the correct position".
Otherwise, call the AcknowledgeCall function
End-While
ReadDials function
Input the first digit
If a Q was entered, return -5.
Input the rest of the phone number
Call the ToDigit function for each of the 7 digits
not for digit 4
If ToDigit returns -1, return -1
If digit 4 is not a hyphen, return -4.
If digit 1 is 0, return -2.
If digits 1 - 3 are 5, return -3
Otherwise, return 0
ToDigit function
Convert the digit to upper case
Use a switch statement to determine if the digit is valid
and convert the letters to digits
If the digit is invalid, return -1.
If the digit is valid, return 0.
AcknowledgeCall function
Display the Phone Number
this is what I got so far:
#include
using namespace std;
char ReadDials(char d1,char d2,char d3,char d4,char d5,char d6,char d7,char d8);//function prototype
ToDigit() function prototype
AcknowledgeCall() function prototype
int main()
{
char d1=0,d2=0,d3=0,d4=0,d5=0,d6=0,d7=0, d8=0;//declare variables for digits
cout<<"Enter digits, separated by a space.";
cin >> d1 >> d2 >> d3 >> d4 >> d5 >> d6 >> d7 >> d8;
while true
// Call the ReadDials function passing the 8 digits by reference. ReadDials returns an error code by value.
char ReadDials(d1,d2, d3, d4, d5, d6, d7, d8);//call ReadDials
char ReadDials(char d1, char d2, char d3, char d4, char d5, char d6, char d7, char d8);
if the return value is -5, exit the do while loop
if the error code is -1, display the error message "ERROR - An invalid character was entered";
if the error code is -2, display the error message "ERROR - Phone number cannot begin with 0";
if the error code is -3, display the error message "ERROR - Phone number cannot begin with 555";
if the error code is -4, display the error message "ERROR - Hyphen is not in the correct position";
if(d1=='Q'||'q')
return -5;
// Otherwise, call the AcknowledgeCall function
End-While
return 0;
}
//ReadDials function
char ReadDials(char d1, char d2, char d3, char d4, char d5, char d6, char d7, char d8);
{
cout<<"Enter first digit."<
if a Q was entered, return -5;
cout<<"Enter the rest of the number."<
// Call the ToDigit function for each of the 7 digits, not for digit 4
if ToDigit returns -1, return -1;
if digit 4 is not a hyphen, return -4;
if digit 1 is 0, return -2;
if digits 1 - 3 are 5, return -3;
return 0
}
ToDigit function
{
// Convert the digit to upper case
switch(c)
{
case '0': cout<< result+="0"; break;
case '1': cout<< result+="1"; break;
case '2': cout<< case 'a': case 'b': case 'c': result+="2"; break;
case '3': cout<
case '4':cout<< case 'g': case 'h': case 'i': result+="4"; break;
case '5': cout<
case '6':cout<< case 'm': case 'n': case 'o': result+="6"; break;
case '7': cout<
case '8': cout<
case '9': cout<
}
if the digit is invalid, return -1;
if the digit is valid, return 0;
}
AcknowledgeCall function
{
Display the Phone Number.
}
return 0;
}
Answers: 2
Computers and Technology, 24.06.2019 03:40, Eylul30
4. does the kernel phenotype distribution support the idea that the cob is the result of a dihybrid cross? what information supports your answer? if a dihybrid cross (i. e. f1 to f2 of standard mendelian crosses) is not indicated what conditions might contribute to this finding.
Answers: 2
Computers and Technology, 25.06.2019 00:30, jennynmike03
Which of these serves as a bridge between the programming team and the audio team?
Answers: 2
Computers and Technology, 26.09.2019 20:40
Mathematics, 26.09.2019 20:40
Chemistry, 26.09.2019 20:40
Chemistry, 26.09.2019 20:40