私聊加我,有偿,两道题目
•Convert decimal to binary•Set a project (using devcpp) toConvert decimal to binary.•Requirements: You main program mustinclude stackli.h (in~Code-c2e_all on ftp), but cannot include stackli.c or the implementation of stack ADToperations.•Please refer to decTobina.c. Thebasic idea of algorithm is as follow:
The following simple pseudocode segmenttransforms a decimal number into a binary number:
Pseudocode:
Read (number)
Loop (number >0)
Set digit to number modulo 2 (i.e.,digit = number%2)
Print (digit)
Set number to quotient of number and 2(i.e., number =number/2)
end loop
This code has a problem, however. Itcreates the binary number backward. Thus 19 becomes 11001, rather than 10011.
We can solve this problem by using astack. Instead of printing the binary digit as soon as it is produced, we hpush it into the stack. Then after the number has been completely converted, wesimply pop the stack and print the results one digit at a time in a line.
和
Linked list implementation of Queue ADT–Finish all queue operations specified in queueLinked.h.Note that parts of codes in queueLinked.c havebeen given.•Please refer to array implementation ofQueue ADT (i.e., queue.h/c in~Code-c2e_all on ftp)Weassume that this linked list implementation has been finished and well testedbefore examination.
具体的加我聊
•Convert decimal to binary•Set a project (using devcpp) toConvert decimal to binary.•Requirements: You main program mustinclude stackli.h (in~Code-c2e_all on ftp), but cannot include stackli.c or the implementation of stack ADToperations.•Please refer to decTobina.c. Thebasic idea of algorithm is as follow:
The following simple pseudocode segmenttransforms a decimal number into a binary number:
Pseudocode:
Read (number)
Loop (number >0)
Set digit to number modulo 2 (i.e.,digit = number%2)
Print (digit)
Set number to quotient of number and 2(i.e., number =number/2)
end loop
This code has a problem, however. Itcreates the binary number backward. Thus 19 becomes 11001, rather than 10011.
We can solve this problem by using astack. Instead of printing the binary digit as soon as it is produced, we hpush it into the stack. Then after the number has been completely converted, wesimply pop the stack and print the results one digit at a time in a line.
和
Linked list implementation of Queue ADT–Finish all queue operations specified in queueLinked.h.Note that parts of codes in queueLinked.c havebeen given.•Please refer to array implementation ofQueue ADT (i.e., queue.h/c in~Code-c2e_all on ftp)Weassume that this linked list implementation has been finished and well testedbefore examination.
具体的加我聊