subject

Implement the function charCnt. charCnt is passed in a name of a file and a single character (type char). This function should open the file, count the number of times the character is found within the file, close the file, and then return the count. If the file does not exist, this function should output an error message and then call the exit function to exit the program with an error value of 1.
USE THIS CODE TEMPLATE PLEASE
#include
#include
#include
using namespace std;
// Place charCnt prototype (declaration) here
int main() {
string filename;
char ch;
cout << "Enter the name of the input file: ";
cin >> filename;
cout << "Enter a character: ";
cin >> ch;
cout << "# of " << ch << "'s: " << charCnt(filename, ch) << endl;
return 0;
}
// Place charCnt implementation here

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 13:30
Hola, me podrian resolver estos ejercicios en php? ejercicio1: crear una pagina que permita realizar una conversion monteria: nuevos soles, dolares, euros. se debe seleccionar el valor monetario origen y conversion asi como tambien el monto a convertir ejercicio2: crear un pagina que muestre la tabla de sumar de un rango de numeros ingresados por teclado. ejercicio3: ingresar una palabra y mostrar la escritura del final al inicio ejercicio4: ingresar la fecha de nacimiento de una persona y determinar, cuantos años, meses y dias tiene ejercicio5: ingresar un rango de valor numerico y mostrar, los numeros pares, impares y primos.
Answers: 1
question
Computers and Technology, 22.06.2019 11:30
Andrina writes letters that are regularly sent to hundreds of her company’s customers. because of this, she would like for the mail merge command to be in her quick access toolbar, and she wants it to be the first button on the left. what should andrina do to place the mail merge button there?
Answers: 1
question
Computers and Technology, 22.06.2019 22:30
What is the most popular genre of video games?
Answers: 1
question
Computers and Technology, 23.06.2019 11:00
What are the possible consequences of computer hacking? what is computer piracy? describe some examples. what are the effects of computer piracy? what are the possible consequences of computer piracy? what is intentional virus setting? describe some examples. what are the effects of intentional virus setting? what are the possible consequences of intentional virus setting? what is invasion of privacy? describe some examples. what are the effects of invasion of privacy? what are the possible consequences of invasion of privacy? what is an acceptable use policy and what is the purpose of the acceptable use policy what is intellectual property and how can you use it?
Answers: 1
You know the right answer?
Implement the function charCnt. charCnt is passed in a name of a file and a single character (type c...
Questions
question
Mathematics, 09.04.2021 21:00
question
Mathematics, 09.04.2021 21:00
question
Mathematics, 09.04.2021 21:00
question
History, 09.04.2021 21:00
Questions on the website: 13722361