[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
I'm completely lost when it comes to this: Design pseudocode
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 29
Thread images: 2
File: ThinkLikeAProgrammer.jpg (132 KB, 500x661) Image search: [Google]
ThinkLikeAProgrammer.jpg
132 KB, 500x661
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 (382 KB, 1920x1080) Image search: [Google]
current_level.jpg
382 KB, 1920x1080
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 replies: 29
Thread images: 2

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.