Erik Lundin

Greenhorn
+ Follow
since Jun 06, 2018
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Erik Lundin

Thanks you for taking your time to answer my question.

Minakshi Sondule extra thanks for that thorough explanation.

I'm looking for something that combines both programming and music production. I guess apps & games would have those elements in them as well.

I love coding but I love music more, if I weren't such a chicken, I would probably pursue a career in music.
But I'm determined to combine them both and I will probably do as Zachary says and try to find some open source DAW and try to make a plugin for that or something along that line.

Thanks again!

5 years ago
Hi there folks!

Like the topic states.

I've just started out my Java programming career, I've been studying for about 3 months now at my school and I love it!

One other thing I love is Music, I love playing it, producing it, mixing it, listening to it, you get the drift.

So to my problem, I've completely lost my creative thinking when it come to coming up with projects that involve the two.

I've read that most of the plugins used in digital music production is coded in C(+/++) I'm not against learning another language after I get better at Java.

I wanted to hear your opinion on the subject.


Much love to all the great people here!

Erik.
5 years ago

Piet Souris wrote:A minor detail: what if both a and b are 0? You are not using any curly brackets, so I find it hard to tell if your final line (print a; juast before the return) will then be printed. If so, then beware: there is no GCD when both operands are 0.



Would it be okey to add something like this?

if a == 0 and b == 0
print a


the test isnt about writing this pseudo in a precise way. just to interpret the flowchart and translate it into any pseudo code that explains it.
5 years ago

Carey Brown wrote:You are still missing the LOOP. See the colored flow chart I posted. Note the light blue area and how the direction lines come around and back in above the comparison.



Will this not work as the flowchart shows since it only "loops" once?

5 years ago


It's not as good as Carey Brown's version, but I hope this will do the job.
5 years ago

Junilu Lacar wrote:

Erik Lundin wrote:Hey!

Would it be too much of me to ask you to show me what your solution to this would be?


We try to avoid doing that, especially when it involves homework. We want to avoid any situation where CodeRanch could be accused of helping students cheat on their homework. It's sometimes hard to strike a balance because sometimes a concrete example is really what would help the learner best but then again, we can't compromise the reputation of our site. See https://coderanch.com/wiki/659991/Code-Mill for more on why we do this.



I understand and respect that. Its not actually what I'm doing. I just have an easier way of understanding a problem if I can see an example and compare notes. I'll show you my own version of the code to prove my point.
I don't want to learn programming so I can copy what others do. I do it because I find it interesting.

So I totally agree with your policys.
5 years ago

Carey Brown wrote:



Excellent example. I see now what you meant by d.
d could easily be replaced by the value of a and b.

I couldn't see that d "had no value" so I implemented it in my code.

Thank you again for helping me out. It all makes sense now.
5 years ago
I wrote a short program for how I think you would solve this problem. Would you say it's wrong or right?



If I rewrote this program as pseudo code do you think it would suffice?

Many thanks

Erik.
5 years ago
If you have the time Campbell Ritchie you could also check out my pseudo code post if you feel like you have the time and energy to help me out there aswell.

I'd love to see someone who knows programming to make an example so I can compare and see what I'm doing wrong.

but I'm very greatfull for the help you've given me here so I understand if you feel like  you've done enough!
5 years ago

Campbell Ritchie wrote:

Erik Lundin wrote:Thank you!

That's a pleasure

. . . It's not telling me what state the water is in now or whether or not I'm swimming right now?

No.

But the fact will remain the same, always. that if the water is warm, then erik will be swimming?

Yes You have got that bit correct.




so it IS telling me what state the water is in because if you see Erik swimming you know the water is warm?
And the other way around, if you don't see me swimming then you know that the water is not warm?
5 years ago
Hey!

Would it be too much of me to ask you to show me what your solution to this would be?
5 years ago
I think so too. (yes means down and no means to the side)

No this question is part of a test that I failed and got the chance to redo tomorrow.
I got 2/3 points for my pseudocode last time but I wanna get a full score this time.

And I wrote that code as you said, yes -> down, no -> side.
But I fail to see how the swap (a, b) affects the variable d

As I see it doing the swap only assigns the variable a with a new value (a = a - b)
and so fort the loop just continues.

As long as A doesnt turn to 0, it will just try the decision again and again.
5 years ago
Thank you!

That was a great explanation.
Really, thank you for taking your time with me.

So let's see if I get this now.

what the "if w then s" (w -> s) only tells me the fact that IF it's warm THEN Erik will be swimming?

It's not telling me what state the water is in now or whether or not I'm swimming right now?
But the fact will remain the same, always. that if the water is warm, then erik will be swimming?

5 years ago
Thank you Carey Brown for your input.

I didn't realise that it was a swap if a < b so thanks!

but do you think that you could show me how you would solve this flowchart?

here's another go at the problem.


I suck at the if and else-if statements.

I can't really see how the output turns to d after going through the swap and going back into the flow.

Like I said earlier, I would love to see how you solve this problem to compare it.


Many thanks.
Erik.
5 years ago
Hello!

I was wondering if someone could help me out with writing pseudocode for a flowchart excercise I have for school.

Here's a link to the flowchart

https://imgur.com/a/B62bzKw

It's supposed to be a flowchart of an algorithm that decides the biggest divider of two values I think.

Here is what I came up with.
Please give me input on how to improve it.

Input value a and b

   if (b = 0)
      d = a
      print d

   if (b > 0)

   if (a = 0)
      d = b
      print d

   if  (b > 0 and a > 0)          
   else if (a < b)

         d = b
         b = a
         a = d
         a = a - b

   else
         a = a - b

        print d


Does my pseudocode make sense?
Please give me input on what changes I can make.

Thanks alot for your effort!

Erik
5 years ago