Lost Password?


Go Back   CodeCall Programming Forum > Software Development > C and C++

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.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-03-2007, 03:13 PM
Shap3r Shap3r is offline
Newbie
 
Join Date: Aug 2007
Posts: 3
Rep Power: 0
Shap3r is on a distinguished road
Default Urgent...plz help me....

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 08-03-2007, 09:49 PM
John's Avatar   
John John is offline
Co-Administrator
 
Join Date: Jul 2006
Age: 20
Posts: 3,478
Last Blog:
Joomla! And Incompeten...
Rep Power: 20
John has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond reputeJohn has a reputation beyond repute
Send a message via AIM to John Send a message via MSN to John
Default

While posting keep in mind a few things:

-Phrases like "Help me its urgent" or "I'm a n00b who needs help" are generally ignored by the people who know how to answer your question.

-97% of the time, when you say: "this is a homework assignment can you show me what to do" you wont receive any responses.

We all have had homework assignments and deadlines to make, but homework is assigned for a reason, either to reinforce what you learned in class, or force you to open your text book and learn it yourself, but ultimately its your work.

-Finally, if you expect us to show sympathy, at least show us you tried, even if it means posting the most absurd code that is totally wrong. At least it shows you tried.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 08-06-2007, 12:22 PM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 3,418
Last Blog:
wxWidgets is NOT code ...
Rep Power: 37
WingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to behold
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 08-06-2007, 07:42 PM
Shap3r Shap3r is offline
Newbie
 
Join Date: Aug 2007
Posts: 3
Rep Power: 0
Shap3r is on a distinguished road
Default

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....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 08-08-2007, 03:09 PM
ebrizzlez ebrizzlez is offline
Newbie
 
Join Date: Aug 2007
Posts: 1
Rep Power: 0
ebrizzlez is on a distinguished road
Default

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 08-08-2007, 03:48 PM
Sp32 Sp32 is offline
Newbie
 
Join Date: Aug 2007
Posts: 10
Rep Power: 0
Sp32 is on a distinguished road
Default

Quote:
Originally Posted by Shap3r View Post
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....
No offense but I am asuming you are american your English is appauling and I am shocked that you are learning programming (:

Didn't mean that in a nasty way just saying :]
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 08-08-2007, 05:50 PM
Shap3r Shap3r is offline
Newbie
 
Join Date: Aug 2007
Posts: 3
Rep Power: 0
Shap3r is on a distinguished road
Default

Quote:
Originally Posted by Sp32 View Post
No offense but I am asuming you are american your English is appauling and I am shocked that you are learning programming (:

Didn't mean that in a nasty way just saying :]
im not a american...
i had no choice, i have to learn it....
the problem is i need some guide line to complete it...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 08-09-2007, 11:59 AM
WingedPanther's Avatar   
WingedPanther WingedPanther is offline
Super Moderator
 
Join Date: Jul 2006
Age: 35
Posts: 3,418
Last Blog:
wxWidgets is NOT code ...
Rep Power: 37
WingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to beholdWingedPanther is a splendid one to behold
Default

Quote:
Originally Posted by Shap3r View Post
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....
The hints I gave have to do with the processing, not how you get the data in/out. If you are having issues with getting information in/out of your program, you are going to have a lot more difficulty in processing the data. Start with getting a number to analyze and displaying it. Then, do some research on modulo and integer division. You can use those to "capture" individual digits into an array. The remaining calculations should be easy, by comparison.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum
Programming is a branch of mathematics.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

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


All times are GMT -5. The time now is 04:30 AM.

Contest Stats

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

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 100%


Complete - Celebrate!

Ads