Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need the code plz. The text file \"paragraph.txt\" contains a paragraph of tex

ID: 3814755 • Letter: I

Question

I need the code plz.

The text file "paragraph.txt" contains a paragraph of text. It has words in mixed upper and lower case. Write a program that reads this file and replaces each vowel by a '*'. Show the output on the screen. Input file Programming in C++. The core goal of this course is "problem solving". This is a critical skill that each of us needs to sharpen and be good at! Sample Run: Pr*gr*mm*ng *n C++. Th* c*r* g**l *f th*s c**rs* *s "pr*bl*m s*lv*ng". Th*s *s * cr*t*c*l sk*ll th*t **ch *f *s n**ds t* sh*rp*n *nd b* g**d *t! Process returned 0 (0 times 0) execution time: 1.180 s Press any key to continue.

Explanation / Answer

#include <iostream>
#include <string>
#include <fstream>

using namespace std;

int main () {
  
   char contents ;

// opening a file in read mode.
ifstream infile;
infile.open("./paragraph.txt" );
int number_of_lines = 0;
char tmpChar; //temporary character variable to store the read character

infile.get(contents); // get first character from the file

   while (!infile.eof() ) { // run the loop until end of line is reached
       if(contents)
       tmpChar = tolower(contents); // convert all the characters to lower case for easy comparision of vowels and store it in temporary variable
       if(tmpChar == 'a' || tmpChar == 'e' || tmpChar == 'i' || tmpChar == 'o' || tmpChar == 'u'){ // check for vowels in temporary variable
           contents = '*'; // If vowels occur print star on the console
       }

       cout << contents; // print the contents
       infile.get(contents); // read for the next character
  

      
   }

// close the opened file.
infile.close();

return 0;
}