Answer to Question #55409 in C++ for Gagan

Question #55409
Write a program to input a text file name,reads the content of the file and create a new file named Copy.Txt which shall contain only those words from the original file which don't start with an uppercase vowel(i.e with A,E,I,O,U).For example if the original file contains
The First Step To Getting The Things You Want Out Of Life is This:Decide What You Want .-Ben Stein
Then the text file Copy.Txt shall contain
The First Step To Getting The Things You Want Life is This:
Decide What You Want.-Ben Stein
1
Expert's answer
2015-10-13T02:55:55-0400
Answer on Question#55409 — Programming — C++

#include <iostream>
#include <stdio.h>
using namespace std;

int main() {
FILE *input;
FILE *output;

input=fopen("input.txt","r");
output=fopen("Copy.Txt","w");

char s[100];

while(!feof(input)) {
fscanf(input,"%s",s);
if(!(s[0]=='A'||s[0]=='E'||s[0]=='I'||s[0]=='O'||s[0]=='U')) {
fprintf(output,"%s ",s);
}
}

fclose(input);
fclose(output);

return 0;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS