1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
#include <iostream>
#include <fstream>
#include <string>
#include <cctype>
#include <cstdlib>
using namespace std;
int get_file (ifstream& in, ofstream& out, string filename, string output);
void get_line (ifstream& in, ofstream& out, string filename, string output);
int main () {
ifstream in;
ofstream out;
string filename, output;
get_file (in, out, filename, output);
get_line (in, out, filename, output);
}
int get_file (ifstream& in, ofstream& out, string filename, string output) {
cout << "enter the file you would like to open" << endl;
cin >> filename;
in.open (filename.c_str());
if (in.fail()) {
cout << "that is not a file" << endl;
return 0;
}
cout << "Input the name of the output file" << endl;
cin >> output;
out.open (output.c_str());
if (in.fail()) {
cout << "that is not a file" << endl;
return 0;
}
}
void get_line (ifstream& in, ofstream& out, string filename, string output) {
string line;
char words [10000];
while (!in.eof()){
for (int i = 0; i < 10000; i++) {
while (getline (in, line)) {
if (isdigit(words [i])) {
out << '*';
}
else if (islower (words [i])) {
out << toupper;
}
else if (isupper (words [i])) {
out << toupper;
}
}
}
}
}
|