this code should be done in C language not any other languag

this code should be done in C++ language, not any other languages

Continue familiarization with simple functions and basic File Input/Output (I/O). All input is to be read from a file and all output is to be written to a file. Open an output tile (stream) and write your identifying information to the associated output file using a function. Put your standard output information in a function named ShowHeader(). The file stream must be passed by reference to the function. To do this, an & (ampersand) is used between the data type (of stream) and the name of the argument (T like to use fOut for output file stream objects and fIn for input file stream object names). Read/Process an input file a character at a time. Open an input file (stream) mid read a single character on each pass through a loop (a while () loop is probably easiest) until the end of file is reached. After reading the character, write it to the output file created earlier. The output should contain the same characters as the input file. Develop the remainder of this program in piecewise manner-specifically, add one character analysis operation at a time, before adding the next. Analyze the characters in a file using functions to display their characteristics, e.g., lower case, digit etc. The logic for analysis will be inside the loop above. Specifically, test if the character: is a letter. test if it is lower case or upper case. if the character is a letter, test if it, is a vowel or consonant. is a digit.. if the character is a digit, test if the value is odd or even. is a punctuation character. is a logical operator symbol. Write a short function for most, operations in t he list, above. If a character is a letter, then it is either upper or lower case, so we only need to write one function to test the case of the character. Do nol. use the built-in functions. Deliverables: Program-hilly documented (commented). Input the input file read by your program. Output-Neatly formatted and documented. Program design sheet-In addition to your program, input file, and the output, attach a page showing a rough design of your program.

Solution

In the below mention code for Excercise:6 i.e., Reading and Writing data into the file.

#include <fstream>
#include <iostream>
#include <string>
using namespace std;

int main ()
{
    char text[100];
   // entering data into file
   ofstream writefile;
   writefile.open(\"example.txt\");
   cout << \"Enter data into the file\" << endl;
   cout << \"Enter your name: \ \";
   cin.getline(text, 100);

   // write entered text into the file.
   writefile << text << endl;

   cout << \"Enter your fathername:\ \";
   cin >> text;
   cin.ignore();

   // write entered data into the file.
   writefile << text << endl;

   // close the file.
   writefile.close();

   // open a file in read mode.
   ifstream readfile;
   readfile.open(\"example.txt\");

   cout << \"Reading text in the file\" << endl;
   readfile >> text;

   //Display the data in the file.
   cout << text << endl;

   // Display the data in the file
   readfile >> text;
   cout << text << endl;

   // close the read file.
   readfile.close();
   return 0;
}

this code should be done in C++ language, not any other languages Continue familiarization with simple functions and basic File Input/Output (I/O). All input is
this code should be done in C++ language, not any other languages Continue familiarization with simple functions and basic File Input/Output (I/O). All input is

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site