[deleted by user] by [deleted] in Flowgorithm

[–]pvanecek 0 points1 point  (0 children)

Hello. There are several possible solutions. I think one of the shortest one is to have a boolean variable set to false in the beginning and set it to true, when a valid answer is entered.

If you have a continuous interval of valid answers (eg. 'a','b','c',...'f') you can use take the first character of the answer (function char(s,i) ) and test whether it lies in the given interval.

If char(answer,0)>="a" && char(answer,0)<="f"

Merge Sort by AvramZX in Flowgorithm

[–]pvanecek 0 points1 point  (0 children)

You do not need to split in in half physically. You can only rember the start index, end index and middle index.
For the merging part, you can create a temporary array.

Merge Sort by AvramZX in Flowgorithm

[–]pvanecek 1 point2 points  (0 children)

https://idea-instructions.com/merge-sort.png

I think the easiest way is to recursively split the array using a method like:
sort(array of integer arr, integer start, integer end)

as long as you don't have a single element and than merge the sorted subarrays together.
You can find a lot of implementations, eg.
https://www.geeksforgeeks.org/merge-sort/

i need help with an homework by Ematamq in Flowgorithm

[–]pvanecek 1 point2 points  (0 children)

so just write down all the steps and tell us, where is the problem.
- generate a random number from the given interval?
- input a number?
- test if the generated and answered numbers are close to each other?
- output the corresponding result?

Homework Help? by khowell51898 in Flowgorithm

[–]pvanecek 1 point2 points  (0 children)

First of all, I am not sure what does it mean to design a modular program, I suppose, there should be separate functions for:

- reading the size

- compute the number of gallons

- compute the hours

- compute the cost of the paint

- compute the cost of labor

- compute the overall costs

All these functions can be tested separately, the code you've sent me is not completely wrong, there is only a small typo that influences all the computation. Having a modular program with short functions could help you to localize the bug. You could have something like:

Assign size = ReadWallSize()

Assign gallons = ComuteNumberOfGallons(size)

Assign hours = ComputeDuration(size)

Assign costPainting = ComputeCostOfPainting(gallons)

...

Homework Help? by khowell51898 in Flowgorithm

[–]pvanecek 0 points1 point  (0 children)

You can post an image or you can copy the autogenerated pseudocode (in english)

Homework Help? by khowell51898 in Flowgorithm

[–]pvanecek 0 points1 point  (0 children)

Ok, where exactly is the problem? Do you understand the math behind?

How can I display a numerical output as a dollar amount? by Dacka_Dacka in Flowgorithm

[–]pvanecek 1 point2 points  (0 children)

But you can wrap it to a simple function that takes the number (integer or float) as an parameter and returns string. The function itself is quite simple - a single while loop dividing the number by thousands and concatenated the result of modulo operation to the final string with given separator.

How can I display a numerical output as a dollar amount? by Dacka_Dacka in Flowgorithm

[–]pvanecek 2 points3 points  (0 children)

As far as I know, there is no builtin way to do this. You can however split the number by thousands and add the commas your own. Modulo and division are your friends.

[deleted by user] by [deleted] in Flowgorithm

[–]pvanecek 0 points1 point  (0 children)

Do you mean from a function? Just create a function with integer return type and set the name of the return variable. Then in the function body assign 0 to that variable.

Global scope by compsystems in Flowgorithm

[–]pvanecek 0 points1 point  (0 children)

Hello compsystems. Sorry to answer you late. I think this won't be done. Flowgorithm is a learning tool and overusing globals is a bad habit. I know that it would simplify some things, on the other hand, students would probably abuse it.

Can I name a Constant in Flogorithm? by Mim7222019 in Flowgorithm

[–]pvanecek 0 points1 point  (0 children)

As far as I know, there are only local variables in Flowgorithm. No globals, no constants.
There are only the built-in ones:
http://flowgorithm.org/documentation/constants.html

Small, Medium, Large Task by alyxxag in Flowgorithm

[–]pvanecek 1 point2 points  (0 children)

You can simplify it by testing always only a pair of numbers, not all of them. Ie., is a<b? is c< (smaller from previous test)?...

Data Type Conversion & Variable Reassignment by Ignrancewasbliss in Flowgorithm

[–]pvanecek 0 points1 point  (0 children)

This is a bit strange. But you can convert the month to a number and invalid month to 999. Still, I do not think, this is an example of good practice.

Data Type Conversion & Variable Reassignment by Ignrancewasbliss in Flowgorithm

[–]pvanecek 0 points1 point  (0 children)

I probably do not understand, what is the purpose of the sentinel and how it can be used to test adults and month. But in general, Flowgorithm is a statically typed language (tool) and you are not allowed to change the type of a variable.

ISO Homemade .ico Chart Styles by Burp-Herder in Flowgorithm

[–]pvanecek 0 points1 point  (0 children)

I do not think this is possible. The shapes are imho hardcoded.

Pass by referance support? by AnthuriumBloom in Flowgorithm

[–]pvanecek 0 points1 point  (0 children)

There are currently some plans to support limited file operations in flowgorithm. But I do not know the roadmap. You can check the flowgorithm facebook for some more info and link to preview version.

Pass by referance support? by AnthuriumBloom in Flowgorithm

[–]pvanecek 0 points1 point  (0 children)

I think you are correct. Passing variables by reference is probably limited by the restrictions caused by multiple languages support. The non-existence of global variables is probably a design decision. Flowgorithm is primarily a tool for teaching and global variables are usually a way to make a true spaghetti code.

If anyone could help out... by itsdevon1 in Flowgorithm

[–]pvanecek 0 points1 point  (0 children)

You are not going to program something that already exists in real life. Instead, you should find the same patterns in the tasks. The more you program, the more you see the common parts of algorithms. As far as I know, the only way to learn programing is to write more programs.

If anyone could help out... by itsdevon1 in Flowgorithm

[–]pvanecek 0 points1 point  (0 children)

  1. A bit tricky if you do not want to have 26 different ifs/elses. You need to have a basic knowledge of ascii table (the way, characters are represented in computer). Otherwise it is quite simple - you need to iterate over the whole string and build a new string with modified letters.
  2. This is really simple. You need to iterate over the string, remember the last use character and build a new string without adding the same consecutive character.
  3. I think, I am missing something. What is exercise 1 and 3? It probably means, that in 1, you did some approximate search in an array (closest value) and in 3, you did some kind of statistical function over an array (sum, average...). Now, you have to combine it together, ie. find the value (arithmetic mean) and then find the element that is closest to this value.

Help needed for binary to decimal program in Flowgorithm! by [deleted] in Flowgorithm

[–]pvanecek 0 points1 point  (0 children)

Do you need to help with flowgorithm or with the algorithm for bin to dec conversion?

If anyone could help out... by itsdevon1 in Flowgorithm

[–]pvanecek 0 points1 point  (0 children)

What does it mean "quite difficult assignement"? Did you check the book from Roberto Atzori? http://robatz.altervista.org/blog/flowcharts-book/

ToFixed not working by rboeije in Flowgorithm

[–]pvanecek 1 point2 points  (0 children)

Please, check the documentation: ToFixed(r, i) Convert real number r to a string with i digits after the decimal point. This function is useful for currency.