Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cctype>
- #include <string>
- #include <fstream>
- using namespace std;
- void openFile(ifstream& ins);
- int shiftMod(char shift);
- char punctCheck(char c);
- int main ()
- {
- int shiftvalue = 0;
- char shift;
- char c;
- ifstream ins;
- openFile(ins); //Opens file and prints out error if file doesn't exist.
- while (!ins.eof()) //Will continue to run code until end of file.
- {
- if(ispunct(c)) //Checks if character is punct.
- {
- if(c == '.' || c == ','|| c == ':' || c == '!' || c == '\'') //If c is something normal, it just prints it out.
- {
- cout << c;
- }
- if(c == '>' || c == '<')
- {
- c = shift;
- shiftMod(shift);
- }
- if (c == '#')
- {
- }
- if(c == '+' || c == '-')
- {
- }
- }
- if (isalpha(c)) //Checks if character is an alpha. NEED TO ADD THE SHIFT THING
- {
- char ch = c;
- toupper(ch);
- cout << ch;
- }
- }
- return 0;
- }
- int& shiftMod(char& shift)
- {
- if (c == '>')
- {
- char shiftnumber = cin.peek();
- if (isdigit(shiftnumber))
- {
- int holder = 0;
- char temp = shiftnumber;
- holder = atoi(&temp);
- }
- }
- if (c == '<')
- {
- }
- }
- void openFile(ifstream& ins)
- {
- string fileName;
- cout << "Enter filename (with extension): ";
- cin >> fileName;
- ins.open(fileName.c_str());
- while (!ins)
- {
- ins.clear();
- cout << "*** ERROR: Error in opening file ***"
- << endl << "You entered an invalid file name. Please try again." << endl <<endl;
- cout << "Enter filename (with extension): ";
- cin >> fileName;
- ins.open(fileName.c_str());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment