Hey guys I have a program that I need to write and I have no idea how to do it:
this program has to prompt the user in a menu to encrypt a message, decrypt or quit.
I'm supposed to use functions in this program
This is what i am supposed to use without removing any parts, just adding things where needed.
#include%26lt;iostream%26gt;
using namespace std;
int menu();
void encrypt(int);
void decrypt();
int main(){
int choice;
int shift = 7; // default shift
choice = menu();
while (choice != 3){
if (choice == 1){
cout %26lt;%26lt; "Enter the 'shift' value: ";
cin %26gt;%26gt; shift;
encrypt(shift); }
else
decrypt();
cout%26lt;%26lt;endl%26lt;%26lt;endl%26lt;%26lt;endl;
choice = menu();
}
return 0;
}
I don't even know how to get started functions kind of confuse me
Can someone at least point me in the right direction?
I need help with a c++ program please?
From what I can see here, all the shell functions are already implemented.
You have:
int menu() which prompts the user to enter 1, 2 or 3.
And a while loop that quits if the user types in 3.
1 for encrypt() and 2 for decrypt().
However, where is the code for menu() encrypt() and decript()?
If you're not provided with the codes, then perhaps you need to implement these functions.
//psudo-C-code
int menu(){
char input; // User's input is stored here.
//cout %26lt;%26lt; "Please make a choice:" %26lt;%26lt; endl;
// cout " 1.encrypt"
// cout " 2.decrypt"
// cout " 3.quit"
cin %26gt;%26gt; input;
//convert the input (char) into int and return it.
//You can either use atoi(input) or you can do this:
// return (int)input - '0';
}
I am assuming that the 'Message' you were supposed to key in will be prompted for when the decrypt or encrypt function runs.
void decrypt(){
//prompt for the number sequences (encrypted message)
//Store them in a char array
//For each character in the char array, convert them to the character-number chart you provided.
//Print out the converted results.
}
/*You need to be more specific about the requirements for these functions however, there's no way i would know what 'shift' does. You might need to ask your instructor for more information if it's not provided toyou.*/
void encrypt(int){
//Prompt for a message
//Store message in char array
//Convert each char in the array to the encrypted numbers.
//Print out the encrypted message.
}
Reply:this program seems to be a based on cryptography. u have not mentioned the algorithms used in encrypting and decrypting since are many such methods to do. make sure u have one. Then write the code for each in c or C++. as here
void encrypt( int e )
{
// place ur code here
}
cheap flowers
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment