LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview

Create a file where you can write n integers. Rewrite the last group of
perfect numbers from the source file into a text file.

Darkhann_0-1760885266510.png

 

0 Kudos
Message 1 of 15
(436 Views)

Do you have a question?

 

(Using a subject of "Labview" in the LabVIEW forum is redundant. A picture of a block diagram is quite useless because we cannot run or debug it and we can't even see what's in the other case, for example.. Why are you counting in orange? Why is there no control for N? What's the purpose of the disconnected boolean switch? Define terms such as "last group". Are you trying to find perfect numbers? What's the purpose of the random integers? There is a =0 primitive, but you could even wire the integer directly to the case selector. To find the first N perfect numbers, you probably need a while loop because you cannot know how many numbers need to be tested  It would seem sufficient to calculate the result in memory and write to file at the end., etc.)

Message 2 of 15
(426 Views)

can you show in practice how to build? 

0 Kudos
Message 3 of 15
(408 Views)

@Darkhann wrote:

can you show in practice how to build? 


The instructions are not clear at all and have no obvious relation to the code in your picture.

 

For example here is some literal brute force code to find the first N perfect numbers.

 

altenbach_0-1760893760016.png

 

 

For N>4 you would need to make it significantly smarter to complete in a reasonable time and also prevent overflow of I32 later. try it!

 

And please leave all that file IO out for now. It is just overhead.

 

0 Kudos
Message 4 of 15
(399 Views)

please send the file ,It doesn't work for me.

 

Darkhann_0-1760975948433.png

 

0 Kudos
Message 5 of 15
(314 Views)

So you are posting a blurry picture where the important parts of the code are obstructed by probes and complain that I only attached a clean unambiguous picture without anything hidden, instead of a VI?? 😮

 

As a first step, learn about conditional tunnels! They are central to the code!

 

You still have not explained what is meant by "last group".

0 Kudos
Message 6 of 15
(308 Views)

This is pretty obviously homework. No we won't do it for you. We can help, though. Create some code. Upload it. We can then work on it together.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 15
(268 Views)

Hello guys! Can you help me for this task, please?

Create a file containing n integers. From the source file,
form arrays of prime and perfect numbers. Determine
the largest prime number in the file and the smallest perfect number.

magnetism27__0-1761023885444.png

I’ve almost done it, but I can’t understand how to output prime and perfect numbers.

0 Kudos
Message 8 of 15
(275 Views)

Hi magnetism,

 

in case you're not a SPAM bot: please team up with your co-students and work together as a team!

You should be able to solve your homework much better then…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 15
(245 Views)

@ruzhana wrote:

I’ve almost done it, but I can’t understand how to output prime and perfect numbers.


No, you have not "almost" done  it! All we see is a pile of senseless code fragments. You are maybe 5% done!

 


@ruzhana wrote:

Create a file containing n integers.


Where does it say random integers? A ramp of integers 1..100, or N integers that are all zero would fit the sparse requirements equally well. So go back and read the exact requirements or ask your teacher.

Also note that your random integer generation is flawed, because the edge values only have half the probability of all the others. With this kind of coding you'll never get a programming job in Las Vegas. 😄

 

You keep posting blurry pictures instead of the actual VI. Why?

 

Don't have wires flowing in all directions and underneath structures. Don't wire N when autoindexing on a FOR loop, Why do you need two "%d" diagram constants? etc. Clean code is easier to debug and there are many fewer places for bugs to hide.

0 Kudos
Message 10 of 15
(209 Views)