generated from CSCI200/Template
format
This commit is contained in:
parent
e291bc4e7f
commit
d3173832fd
1 changed files with 24 additions and 24 deletions
48
main.cpp
48
main.cpp
|
@ -10,31 +10,31 @@
|
|||
#include <iostream>
|
||||
|
||||
int main(void) {
|
||||
std::ifstream secretMessage("secretMessage.txt");
|
||||
if (secretMessage.fail()) {
|
||||
std::cerr << "Error opening secretMessage.txt file" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
std::ifstream secretMessage("secretMessage.txt");
|
||||
if (secretMessage.fail()) {
|
||||
std::cerr << "Error opening secretMessage.txt file" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::ofstream decipheredMessage("decipheredMessage.txt");
|
||||
if (decipheredMessage.fail()) {
|
||||
std::cerr << "Error opening decipheredMessage.txt" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
std::ofstream decipheredMessage("decipheredMessage.txt");
|
||||
if (decipheredMessage.fail()) {
|
||||
std::cerr << "Error opening decipheredMessage.txt" << std::endl;
|
||||
return -1;
|
||||
}
|
||||
|
||||
char currentChar;
|
||||
while (secretMessage.get(currentChar)) {
|
||||
switch (currentChar) {
|
||||
case '\n':
|
||||
decipheredMessage << std::endl;
|
||||
break;
|
||||
case '~':
|
||||
decipheredMessage << ' ';
|
||||
break;
|
||||
default:
|
||||
decipheredMessage << (char)(currentChar + 1);
|
||||
}
|
||||
}
|
||||
char currentChar;
|
||||
while (secretMessage.get(currentChar)) {
|
||||
switch (currentChar) {
|
||||
case '\n':
|
||||
decipheredMessage << std::endl;
|
||||
break;
|
||||
case '~':
|
||||
decipheredMessage << ' ';
|
||||
break;
|
||||
default:
|
||||
decipheredMessage << (char)(currentChar + 1);
|
||||
}
|
||||
}
|
||||
|
||||
decipheredMessage.close();
|
||||
decipheredMessage.close();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue