I need help to complet this program, thank you... //PURPOSE: This program contai
ID: 3618190 • Letter: I
Question
I need help to complet this program, thank you... //PURPOSE: This program contains an implementation of isdigit function in ctype.h// The main program reads and calls the isdigit function.
// It prints the character with the line number it appears if the character is a digit,
// otherwise it prints nothing
#include <iostream>
using namespace std;
// Function Prototype(s):
bool isdigit(char ch);
int main()
{
char inCh; // input character
char outCh; // output character
int digitTally = 0; // Tally of digit characters read
int newlineTally = 0; // Tally of newline characters read
cin.get(inCh);
while (cin)
{
if (inCh == ' ')
newlineTally++;
// Call the function isdigit here
else if ( )
{
cout << inCh << " in line# " << newlineTally << endl;
digitTally++;
}
cin.get(inCh);
}
cout << endl << endl;
cout << digitTally << " digits encountered." << endl;
return 0;
}
// FUNCTION: isdigit
// Purpose: If the value of the single argument to the function is a
// digit, the function returns true; otherwise, returns false.
bool isdigit(char ch)
{
Complete thefunction definition of the isdigit function.
} I need help to complet this program, thank you... //PURPOSE: This program contains an implementation of isdigit function in ctype.h
// The main program reads and calls the isdigit function.
// It prints the character with the line number it appears if the character is a digit,
// otherwise it prints nothing
#include <iostream>
using namespace std;
// Function Prototype(s):
bool isdigit(char ch);
int main()
{
char inCh; // input character
char outCh; // output character
int digitTally = 0; // Tally of digit characters read
int newlineTally = 0; // Tally of newline characters read
cin.get(inCh);
while (cin)
{
if (inCh == ' ')
newlineTally++;
// Call the function isdigit here
else if ( )
{
cout << inCh << " in line# " << newlineTally << endl;
digitTally++;
}
cin.get(inCh);
}
cout << endl << endl;
cout << digitTally << " digits encountered." << endl;
return 0;
}
// FUNCTION: isdigit
// Purpose: If the value of the single argument to the function is a
// digit, the function returns true; otherwise, returns false.
bool isdigit(char ch)
{
Complete thefunction definition of the isdigit function.
}
Explanation / Answer
please rate - thanks //PURPOSE: This program contains an implementation ofisdigit function in ctype.h // Themain program reads and calls the isdigit function. // Itprints the character with the line number it appears if thecharacter is a digit, // otherwise it prints nothing #include using namespace std; // Function Prototype(s): bool isdigit(char ch); int main() { charinCh; // input character charoutCh; // output character int digitTally = 0; //Tally of digit characters read int newlineTally = 0; // Tally ofnewline characters read cin.get(inCh); while (cin) { if (inCh == ' ') newlineTally++; else if (isdigit(inCh)) { 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.