Question

Labview question: Create a VI using a While Loop that continuously generates random numbers between 0...

Labview question:

Create a VI using a While Loop that continuously generates random numbers between 0 and 1000 until it generates a number that matches a number selected by the user. Determine how many random numbers the VI generated before the matching number.

conditions to applied on above problem:

1. Convert the “random number” generator floating point numerical output to integer values to make it easier to find a match.

2. The “user selected number control” should be on the outside of the loop and be set to an integer representation. The control must also prevent users from entering a value less than zero or greater than 1000.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

open the linux terminal

step1: type vi and Enter

write this code in the vi editor

#include<stdlib.h>
#include<stdio.h>
#include<time.h>
int main(){
   int i=0;
   int count_check=0;
   int check=0;
   srand(time(0));
   int user=1;
   while(1){
   printf("Enter Number");
   scanf("%d",&user);
   if(user>=1 && user<=1000){
       break;
   }
   }
  
   while(check!=user){
       check=rand()%1000+1;
       i=i+1;
}
printf("match number:%d\n",check);
printf("before match:%d",i);
}

after completion after writing enter escape button and type this

: w check.c

the file saved as check.c

later again enter escape button and type

:wq

it was quit from vi editior

later type these commands to execute the code

for compilation of c code

cc -o check check.c

and Enter later

./check

these two commands are used to compile the c code and execute the code.

#if you have any doubts comment below...

Add a comment
Know the answer?
Add Answer to:
Labview question: Create a VI using a While Loop that continuously generates random numbers between 0...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Use LabView instead of matlab please Expert Q&A Done Create a VI that: Generates random integers...

    Use LabView instead of matlab please Expert Q&A Done Create a VI that: Generates random integers between 0 and 40. Iterate this random process until the random integer equals 13. Display the following non the Front panel (1.) The actual random number (2.) The iteration number Include a time delay so the user can watch the valuse update as the program executes. USE MATLAB

  • In NI LabVIEW please, Construct a VI that displays a random number between 0 and 1...

    In NI LabVIEW please, Construct a VI that displays a random number between 0 and 1 once every second. Also, compute and display the average of the last four random numbers generated. Display the average only after four numbers have been generated; otherwise display a 0. Each time the random number exceeds 0.5, generate a beep sound using the Beep.vi.

  • Use VI and post output screen Use a For Loop to generate 100 random numbers. Determine...

    Use VI and post output screen Use a For Loop to generate 100 random numbers. Determine the most current maximum and minimum number as the random numbers are being generated. This is sometimes referred to as a "running" maximum and minimum. Display the running maximum and minimum values as well as the current random num- ber on the front panel. P5.2 Be sure to include the Time Delay Express VI so the user is able to watch the values update...

  • A coder programmed a random number generator, which generates a random number between 0 and 1...

    A coder programmed a random number generator, which generates a random number between 0 and 1 when the user presses the "random" button. Numbers generated follow a uniform distribution. 12- What is the probability the next time the button is pressed the code will generate a number less than .23? 13- What is the probability the next time the button is pressed the code will generate a number between .23 and .35? 14- What is the probability the next time...

  • A simple game of chance Using a while loop write a simple coin flip game. Specifics:...

    A simple game of chance Using a while loop write a simple coin flip game. Specifics: The user starts with a bank of $10.00 It costs a dollar to play A correct guess pays $2.00 The while loop is used for the game loop. It should ask if the user wants to play. The while loop will check for a value of 'Y' or 'N'. You should also allow for lower case letters to be input. You MUST prime the...

  • Solve Question using While loops-MATLAB Write a program that generates a random number and asks the...

    Solve Question using While loops-MATLAB Write a program that generates a random number and asks the user to guess what the number is. If the user's guess is higher than the random number, the program should display "Too high, try again." If the user's guess is lower than the random number, the program should display "Too low, try again." The program should use a loop that repeats until the user correctly guesses the random number.

  • Lottery Game (15 Numbers). Design and implement a C++ program that generates 15 random non-repeating positive...

    Lottery Game (15 Numbers). Design and implement a C++ program that generates 15 random non-repeating positive integer numbers from 1 to 999 (lottery numbers) and takes a single input from the user and checks the input against the 15 lottery numbers. The user wins if her/his input matches one of the lottery numbers. Your implementation must have a level of modularity (using functions) Functions you need to implement: Define function initialize() that takes array lotterNumbers[] as a parameter and assigns...

  • (C#, Visual Studio) I need help modifying my program code to accommodate repeated numbers. For example,...

    (C#, Visual Studio) I need help modifying my program code to accommodate repeated numbers. For example, if a user inputs a repeated number the program should regenerate or ask to enter again. If needed, here is the program requirements: Create a lottery game application. Generate four random numbers, each between 1 and 10. Allow the user to guess four numbers. Compare each of the user’s guesses to the four random numbers and display a message that includes the user’s guess,...

  • Using the Random, write a simulation that will "play" the California Super LOTTO. Your program logic will allow the player to: 1) Pick any 6 integer numbers from 1 - 70. Your logic should prev...

    Using the Random, write a simulation that will "play" the California Super LOTTO. Your program logic will allow the player to: 1) Pick any 6 integer numbers from 1 - 70. Your logic should prevent the player from selecting a value LESS than 1 or greater than 70. The logic should prevent the player from selecting the SAME number (i.e. they cannot have two or more of their selections be the SAME number). 2) Display the players' 6 number selections...

  • Using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; u...

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.IO; namespace FileWriter { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void btnCreate_Click(object sender, EventArgs e) { try { //write code that assigns the value in the textbox to an Integer variable if // write code that validates whether or not the data entered in the textbox is greater than or equal to 1 *...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT