|
||||||
| C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Now im facing few problems in my assignment. I don't know how to solve it. I show u guys those problems, hope u guys know how to solve it and write down the code as well. I appreciate alots. I need it by this coming Monday, 6th August, 07. Im not a programming student, that why im not so familiar which those problems. But i need to hand up a proper answer to complete my assignment. The header file must be "#include <iostream>" by using cout&cin, and in my opinion, those 2 problems need use arrays and pseudo-random numbers functions.
Problem 1: Problem 1 A company wants to transmit data over the telephone, but is concerned that its phones could be tapped. All of the data are transmitted as four-digit integers. The company has asked you to write a program that encrypts the data so that it can be transmitted more securely. Your program should read a four-digit integer and encrypt it as follows: 1. Replace each digit by( the sum of that digit plus 7) modulus 10. 2. Then, swap the first digit with the third, swap the second digit with the fourth and print the encrypted integer. Pseudo code for encryption: 1. The user would initially be asked to enter a four-digit integer. 2. The integer is assigned to variable. 3. The program identifies (extract) each digit from the integer variable. 4. Each identified digit is reassigned to another variable respectively (there should be 4 variable, one variable for each digit) E.g. digit1, digit2, digit3, digit4. 5. Each digit is encrypted with the following formula: (n+7)%10 6. Swap the encrypted first and third digit. 7. Swap the encrypted second and fourth digit. 8. All encrypted individual digit are reassigned back to a single integer variable to form an four-digit encrypted integer. 9. Show the encrypted integer. Write a separate program that inputs a four-digit encrypted integer and decrypts it to form the original number. Pseudo code for decryption: 1. The user would initially be asked to enter a four-digit encrypted integer. 2. Decrypt the four-digit encrypted integer using your own algorithm. 3. All decrypted individual digits are reassigned back to a single integer variable to form an four-digit decrypted integer. 4. Show the decrypted integer. Problem 2: Problem 2 Write a C++ Program that will randomly generate a number range from 0 to a user defined number as limit. (Example: 0-534534555353), then the program will allow user to select how many tries they would like to have to guess for that number. The program written must be able to provide useful information for the user to guess that number. For example, if the number entered by the user is too small than the actual number, a message “Too small” will be displayed to hint the user. The subsequent relevant messages should be keep display to guide the user getting closer to guessing number. |
| Sponsored Links |
|
|
|
|||||
|
Hint on problem 1) use modulus and integer division by powers of 10 to capture the 4 individual digits.
Hint on problem 2) get information on random number generation in C++.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Programming is a branch of mathematics. |
|
|||
|
i wanna ask...
izit got many style/pattern to write a c++ code?? i had asked my frens... he use other matter to write the coding... and i dunno how it is... im using "#include <iostream>" and cin&cout... and the hints u had given to me... izit by using cin&cout to input or output the command?? coz i never seen it before... anyway, thx for u help.... |
|
|||
|
Ok. Well.. in C++ there are a bunch of ways an styles to do one given task. The iostream is a basic libary, you cant really do much with it besides give an output or input data using its stream, I recommend learning more about C++. You can go use different libaries and so forth and even different enviroments, Qt is pretty good with GUI for example, its libaries are compacted with advance methods of Signals and Slots making GUI more powerful and capable. You should google up C++ libaries or just learn more about the other libaries of C++.
But.. if your not allowed to use other headings then try to use intergers and so forth, stuff that really dont require a heading and can be stored in a header itself, you can then use the iostream to output your information. Last edited by ebrizzlez; 08-08-2007 at 03:11 PM. |
| Sponsored Links |
|
|
|
|||
|
Quote:
Didn't mean that in a nasty way just saying :] |
|
|||
|
Quote:
i had no choice, i have to learn it.... the problem is i need some guide line to complete it... |
|
|||||
|
Quote:
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum Programming is a branch of mathematics. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| NEED C++ Assignment HELP URGENT! | Sakinah | C and C++ | 7 | 08-06-2007 01:42 PM |
| URGENT a small javascript project $35! | Hyde | Request Services (Paid) | 1 | 06-12-2007 08:18 AM |
| ! Need urgent help ! Drawing program using cygwin | siren | C and C++ | 0 | 05-26-2007 11:51 PM |
| Urgent help req | rahul | C and C++ | 2 | 03-12-2007 12:55 PM |
| URGENT !!! I need help !!! | icycold89 | Java Help | 16 | 01-29-2007 06:20 AM |
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |