[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

I'm completely lost when it comes to this: Design pseudocode

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 29
Thread images: 2

File: ThinkLikeAProgrammer.jpg (132KB, 500x661px) Image search: [Google]
ThinkLikeAProgrammer.jpg
132KB, 500x661px
I'm completely lost when it comes to this:

Design pseudocode for a program that allows a user to enter exactly 8 numbers. Create an array big enough to hold the numbers and store each number in the array as it's entered. After the program has finished gathering numbers, it should go through the contents of the array (using a loop) and print a message for each number as follows: if the number is equal to 5 it should say "Yes!" otherwise it should say, "No!". Use only NAMED CONSTANTS for all of the constants in the problem.

Help please
>>
>>55166067
Please make your own homework...
>>
>>55166067
/g/ is not your personal homework board.
>>
If you're serious, then you should be able to get what you need from this.
int arr[8];
for i in 1..8 {
arr[i] = get_input_number();
}
install_gentoo();
sudo rm -rf /
>>
>>55166067
>Use only NAMED CONSTANTS for all of the constants in the problem.
this is how you can tell you're an indian studying for a shitty currytech software mill certificate
>>
INPUT A(8)
I = 0
FOR I = 0, 7 STEP 1
IF A(I) = 5 PRINT "YES!" ELSE PRINT "NO!"
END FOR
END
>>
>>55166067
Array.new(8) { gets.to_i }.each { |x| puts x == 5 ? "ja!" : "nein!" }
>>
>>55166103
not really

>>55166125
Seems too short and he loves us to use Declarations and Named Constants
>>
>>55166199
>Seems too short and he loves us to use Declarations and Named Constants
OK, no shit.

CONST NO = "YES!" AS STRING
CONST YES = "NO!" AS STRING
DIM A(8), I INTEGER
INPUT A(8)
I = 0
FOR I = 0 TO 7 STEP 1
IF A(I) = 5 PRINT NO ELSE PRINT YES
END FOR
END
>>
File: current_level.jpg (382KB, 1920x1080px) Image search: [Google]
current_level.jpg
382KB, 1920x1080px
All those looked advanced for the point where I'm at.

I attached an image of how arrays and loops look according to my textbook and my professor is by the book or you're too advanced.
>>
>>55166334
This book belongs in a bin.
>>
>>55166334
what the fuck
>>
>>55166334
1)Conceptually all of those are on the same level, your just not on a level high enough to understand that so yes it will look to your professor like you just copied the code.
2)As retarded as this book looks, following it to the letter will teach you how to think logically, kinda like grade school math, so read your damn book....
>>
Damn. I feel like you guys have really helped and this teaching method is bizarre and dated,
>>
>>55166272
I assumed it was 5 and 8 that were supposed to be constants, not the strings.
>>
>>55166334
>Foxit Reader
okay, this is beyond simply being misinformed, this is the work of a mastermind troll
>>
>>55166067
If you don't know how to do this you should maybe find another profession.
>>
>>55166272
my sides
>>
>>55166334
>pseudocode
>No mathematical notation
it's shit
>>
>>55166334
The book assumes the compiler/interpreter can't simplify constant expressions.
>>
>>55166744
this book was clearly written 50 years ago, so the assumption is justified
>>
Man brahs, I appreciate all the help. I truly do.

I feel like I just haven't had time to sit and read/skim through my textbook. I feel like an idiot in something that really shouldn't be that complicated. Taking two math courses during the summer + two science courses(if you consider this one) which all have to be done in a ten week period is rough.
>>
>>55166681
I prefer it over Adobe?
>>
>>55166168

this is why functional programming will never catch on.
>>
>>55166125
>I = 0
>FOR I = 0
>>
>>55169023
At first it was While cycle.
>>
 int numbers[8]
for(int i =0;i < 8; i++)
numbers[i] = getUserInput();

for(int i = 0;i < 8; i++)
if(I ==5)
print("Yes!");
else
print("No!");
>>
>>55169129

> if(I ==5)

I dun goofed. Should be if(numbers[i] == 5)
>>
I am wondering if this is just an exercise in can you follow instructions.

All solutions have ==5 and not ==TARGET_VALUE. I am wondering if nobody here has found that magic number in the middle of the code and wished there was at least a variable name tied to it or wondering why the programmer put it 5 in a 1000 places. The prof is a dink, but clearly trying to force those retard best practices of old.
Thread posts: 29
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.