I've recently taken a passive/hobby interest in learning programming, and after a (barely) successful Hello World, I've decided to make a basic cipher encryption/decryption executable.
Right now I'm cannibalizing other people's public code found on forums to help me learn it and I'll write it from scratch later when I have a better understanding.
What I want the program to do is to be in a folder with a .txt file, referred to as "Text.txt", that can be written to by calling the "encrypt" function followed by the message which would immediately write it to the Text.txt file. Then I want to be able to call the "decrypt" function and have it do the opposite, and turn the coded message back into english.
Right now I'm using a basic caesar shift cipher which works well on stand alone, but I don't really know how to define it in a function to work with an fstream function, or that's what I should be doing at all.
I'm not asking you to write this for me, rather to show me how to YOU would personally structure a program like this, and also point out any noob mistakes, if you would be so kind. I've been reading the tutorials on the site, and they're helpful to me, but I learn much better by seeing other people's work.
I don't really have much background with C++, though I have used lua functions some in the past, do they work in the same basic way?
Thanks for any help you can give.
(Edit: Feel a bit stupid, one of the issues I was having was something elementary I missed.)
using namespace std;
char caesar( char );
int main(int argc, char *argv)
while ((std::cin >> in) && (in != "exit"))
int encrypt ()
string output = "";
for(int x = 0; x < input.length(); x++)
output += caesar(input[x]);
cout << output << endl;
} while (!input.length() == 0);
char caesar( char c )
if( isalpha(c) )
c = toupper(c);
c = (((c-65)+13) % 26) + 65;