15,907,679 members
1.00/5 (1 vote)
See more:
sorry i cant find the tag for pseudocode..

Hello I have an assignment to convert octal to binary and octal to decimal through pseudo code, i have created the code though I believe it requires some changes as its not ideal, I hope improvements can be suggested please it would help greatly! thank you. I am unsure whether the transition between the two conversions is correct and if no improvements can be made would appreciate your overall insight if its acceptable.
i must ask the user if they want to repeat the program and the maximum number of characters a user can enter is 3

```Start
Repeat program
Enter digits into input box
scan the text string to find number of characters
if number of characters < 1 or > 3
store digits as variables integer = [a,b,c]
else if invalid number of characters entered
print invalid message "Character limit out of range"
(return previous step)
else if scan the variables (left first)
if (a,b,c >= 0 && < 8 ) then
pick of successive digit
while not last digit
if digit =='0' concatenate "000" to right end of result
if digit =='1' concatenate "001" to right end of result
if digit =='2' concatenate "010" to right end of result
if digit =='3' concatenate "011" to right end of result
if digit =='4' concatenate "100" to right end of result
if digit =='5' concatenate "101" to right end of result
if digit =='6' concatenate "110" to right end of result
if digit =='7' concatenate "111" to right end of result
else if
characters out of range
print invalid message: "Characters entered out of range"
(return previous step)
end of string
print result into output box
end while
calculate product of new result = c*8^0
end of string ?
print new result into output box
else if proceed with next digit
calculate product of result = new result + b*8^1
end of string ?
print result into output box
else if proceed with last digit
calculate product of result = result + a*8^2
print result into output box
end of string
print "Do you want another attempt?"
until answer != "yes" repeat program
else
End```
Posted
Updated 25-Nov-15 6:55am
v2
CHill60 25-Nov-15 12:50pm
I'm struggling to follow your pseudocode because it is not formatted - e.g. tabs would indicate where the end of each if-block is meant to be. Alternatively try surrounding the blocks with begin-end and make use of tabs/spaces to make it clearer
Nightblue3 25-Nov-15 12:57pm
Hello thanks for replying I have changed the text to something that looks clearer though I am very new to programming I am unsure of how to end each if-block or to use begin-end,
PIEBALDconsult 25-Nov-15 13:17pm
It's actually a lot simpler than that.
Nightblue3 25-Nov-15 13:34pm
How so? i'm not too sure on the changes I can make, even though there may be a simpler solution, is my current solution sufficient? (does it make sense)
PIEBALDconsult 25-Nov-15 13:41pm
Not to me.