what i'm trying to do is take the input from a file and change all the upper case letters to lower case and lower case letters to upper....now what i have so far does this but it doesn't keep the spaces from file it all just gets put on one line....
Code:#include <iostream> #include <string> #include <fstream> using namespace std; void changecase(ifstream&, ofstream&); int main() { ifstream infile; ofstream outfile; infile.open("textforlab9"); outfile.open("changedtextforlab9"); changecase(infile, outfile); infile.close(); outfile.close(); return 0; } void changecase(ifstream& in, ofstream& out) { char ch; while (!in.eof()) { in >> ch; if (ch > 'A' && ch < 'Z') { ch = tolower(ch); out << ch; } if (ch > 'a' && ch < 'z') { ch = toupper(ch); out << ch; } } }