Simple C++

Please see

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

http://www.cs.auckland.ac.nz/courses/compsci210s1c/assignments/A3/index.html

  

related notes

http://www.cs.auckland.ac.nz/courses/compsci210s1c/assignments/UsingUnix/

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

http://www.cs.auckland.ac.nz/courses/compsci210s1c/lectures/mano/210Part2-2013-S1

due in 12 hours

    

First of all please please do not use string
or arraylist, array, stacks, queues 🙂
-ok so you get input and store it as an int
example) 137
int input = 137
-now what you do is since 137 > 127
-we know where will be two groups of 7 bits inside 137:
ie) 1:0001001
to get the two groups seperately we use shift operators right?
to get the last 7 ie “0001001”
we AND the whole thing with 127 (111 1111)
so
1: 000 1001
&
0: 111 1111
————————
= 000 1001

now we have the last 7 and we store it inside a variable
Next step: now we want to get the first group of seven inputs ie “1:”
so what we do is we SHIFT the whole input by 7
so
1: 000 1001 >> 7
—————————
= 000 0001

now we have the first 7 and last 7 bits in two variables
what we want to do is combine them but before that
we add 128 to the first 7
so
1000 0000
+
0000 0001
—————-
=1000 0001
now that we have this we want to add the two variables together but before that
we need to shift our new first8 variable to the left by eight and then add this with the last7 group variable we were working with before
you may ask why not shift by 7 well simple because
1000 0000
<<7 ------------- = 1000 0000 : 000 0000 + 000 0001 --------------------- = 1000 0000 :"_" 000 0001 "_" signifies our missing leading zero instead of 1000 0000 <<8 ------------- = 1000 0000 : 0 000 0000 + 000 0001 --------------------- = 1000 0000 :0 000 0001 i hope this helped goodluck with the rest of the assignment and don't give up you can do it 🙂

Still stressed with your coursework?
Get quality coursework help from an expert!