We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,386 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Encryption of numbers....

Can someone please help me where to begin on this problem... I don't want answers, just some guidance:
I have to make a program that reads a 4 digit integer: and encrypt it with a calculation: then swap 1st digit with 3rd, swap 2nd digit with 4th and print the integer; then write another program that inputs the encrypted 4 digit int and decrypt from the original number.
I want to use rand() and srand() to generate the numbers. But, I am also considering an array and create constant numbers to input: I thought that by scrammbling the numbers on input that this would automatically encrypt the numbers... (?): I am confused on where to begin to solve this problem (I do understand the calculation but am stuck on the encryption and decryption issue). Also, I think this problem needs to use a nested approach.... please tell me if I am on the right track: or can you please give me some direction or tell me if I am thinking correctly! I just need some clarity... thank you.
star320

3
Contributors
2
Replies
1 Month
Discussion Span
8 Years Ago
Last Updated
4
Views
star320
Newbie Poster
3 posts since Feb 2005
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

So wats problem in it just swap the digits....that the encrypted one.....and then again swap it back to decrypt

harshchandra
Junior Poster in Training
68 posts since Nov 2004
Reputation Points: 7
Solved Threads: 1
Skill Endorsements: 0

So wats problem in it just swap the digits....that the encrypted one.....and then again swap it back to decrypt

just convert the integer to strint using itoa() function, and then you can easly swape the digit-character. and then conver the this encrypted string back to integer using atoi() function. Visa-versa with decryption.

letmec
Light Poster
33 posts since Sep 2004
Reputation Points: 10
Solved Threads: 2
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0938 seconds using 2.63MB