I know its easy but its been a long week of test. I have been working with a program to enter 5 integers( 1 2 3 4 5 ) then in its output it will display those same 5 integers. Then next to the last number it will encrypted the input and and output so that 1 is added to the last number the 4th and 3rd are switched and the 1st and second are switched. I can output the five numbers but I am have problems with the encrypting. Thank you for your help.
kahn1
0
Newbie Poster
Recommended Answers
Jump to PostPlease post what you've tried...start out with a pen & paper! Write out an algorithm....which part of the assignment are you stuck?
Jump to PostThat's not how you input and output numbers.
Separate variables in a stream with
<<
or>>
(not commas) depending on whether you're working with an input or output stream. You'll probably also want to separate them with spaces when outputting so that it doesn't all come out as …
Jump to PostAs for your encryption (once you've fixed your I/O issues), I'll give you a hint: to swap variables, you need a third 'temp' variable. E.g.
int variable1 = 2; int variable2 = 3; int swap; swap = variable1; variable2 = variable1; variable1 = swap;
There you go. …
All 10 Replies
zandiago
115
Nearly a Posting Maven
Featured Poster
kahn1
0
Newbie Poster
John A
1,896
Vampirical Lurker
Team Colleague
kahn1
0
Newbie Poster
John A
1,896
Vampirical Lurker
Team Colleague
John A
1,896
Vampirical Lurker
Team Colleague
Agni
370
Practically a Master Poster
Featured Poster
kahn1
0
Newbie Poster
Agni
370
Practically a Master Poster
Featured Poster
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.