بلييز احد يعرف يحله تعبت و اني احاول فيه
Write a program to process texts files. The program should read a texts file see the attached file (input.txt) and output the data in the file as is. The program should also output the number of words, number of lines, and number of paragraphs.(when you create the input file, insert a blank line between paragraphs, see part d.)
You must write and use the following functions.
a. initialize: This function initializes all the variables of the function main .
b. processBlank: This function reads and writes blanks. Whenever it hits a nonblank (except whitespace characters), it increments the number of words in a line. The number of words in a line is set back to zero in the function updateCount. The function exits after processing blanks
c. copyText: This function reads and writes the nonblank characters. Whenever it hits a blank, it exits.
d. updateCount: This function takes place at the end of each line. It updates the total word count, increments the number of lines, and sets the number of words on a line back to zero. If there are no words in the line, it increments the number of paragraphs. One blank line (between paragraphs) is used to distinguish paragraphs and should not be counted with the number of lines.
e. printTotal: This function outputs the number of words, number of lines , and number of paragraphs.
Your program should read data from a file and send output to a file. Do not use any global variables. Use the appropriate parameters to pass values in and out of the functions deb2d***ibed above. Test your function main as shown below.
int main()
{
variables declaration
open files
read a character
while (not end of file)
{
while (not end of line)
{
processBlank (parameters) ;
copyText (parameters) ;
}
updateCount (parameters) ;
read a character;
.
.
.
}
printTotal(parameters);
close files;
return 0;
}
If you use the attached file (input.txt) as input , you should get the following output.
1. The same texts is copied into the output file.
2. Number of words = 58
Number of lines =6
Number of paragraphs= 3
وهذاا الفايل
A computer virus is a computer program that can copy itself and infect a computer without permission or knowledge of the user.
However, the term "virus" is commonly used, albeit erroneously, to refer to many different types of malware programs.
The original virus may modify the copies, or the copies may modify themselves, as occurs in a metamorphic
بلييز لا تردووني