I am trying to create a program which all input will be provided by a command line argument. The first argument is the name of a text file containing the
input text. There must be an additional argument provided. Your program should read the file named in the first argument as input and generate its output to standard out. The program finishes when the end of the
input file is reached.
Example: cmd: filter input.txt lower
It will remove all lower case letters from the input text file.
Other filters:
Vowel
consonant
word
space
punct
upper or lower
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main( int argc, char *argv[])
{
ofstream myfile("input.txt");
if (myfile.is_open())
{
myfile << "525,600 minutes, how do you measure a year?\n";
myfile.close();
}
else cout << "Unable to open file!\n";
return 0;
}
int main() {
ofstream myfile("input.txt");
if (myfile.is_open())
for (int i=0;text[i]!='\0';i++) {
if (text[i]=='a' || text[i]=='e' || text[i]=='i' || text[i]=='o' || text[i]=='u' || text[i]=='A' || text[i]=='E' || text[i]=='I' || text[i]=='O' || text[i]=='U') {
text[i]=' ';