C++ Program 8 Due 27 October 2017 CSDP 222 Fall 2017 Real estate agent advertise
ID: 3600188 • Letter: C
Question
C++ Program 8 Due 27 October 2017 CSDP 222 Fall 2017 Real estate agent advertisements frequently contain words from which all vowels (except an initial one) have been removed. For example: Desirable unfurnished flat in quiet residential area Becomes Dsrbl unfrnshd flt in qt rsdntl ar Write a program which reads in a normal description of a property and outputs both the initial statement and the corresponding advertisement. The initial statement will be provided to you in Prob8.txt and sent via an email attachement The maximum length of the statement will be no longer than 255 characters. The output should be to the screen.Explanation / Answer
the required code is as below :
I have tested the code in my pc:
-----------------------------------------------------------
#include <iostream>
#include <fstream>
int main(){
std :: ifstream infile;
infile.open("org.txt"); // opening the file, in your case it is Prob8.txt
std :: string line; // string variable to read the infile token by token
infile >> line;
while(!infile.eof()){ // checking or end of file
int strt = 1; // flag to check start of a new string
int i = 0; // string index control
while(line[i] != '' ){
if((line[i] == 'a' || line[i] == 'e' || line[i] == 'i'|| line[i] == 'o' || line[i] == 'u')&& strt == 0)
; // skip if {a,e,i,o,u} and not start of new string
else{
std :: cout << line[i]; // print the charecter to screen
strt = 0; // if anyways {a,e,i,o,u} got skipped as first charecter make strt = 0
}
i = i+1; // increment control variable
}
std :: cout << " "; // print space after string
infile >> line; // read new string
}
return 0;
}
------------------------------------------------------------------------------------------------
/* i have commented the code for your understanding */
/* if any queries please comment */
/* thank you */
/* hope this helps */
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.