Chapter 5 Random numbers Files Create an application that wr

Chapter 5 Random numbers &Files; Create an application that writes a series of random numbers to a file. Each random number should be in the range of 1 through 100. The application should let the user specify how many random numbers the file will hold and should use a SaveFileDialog control to let the user specify the file\'s name and location.

Solution

Answer

Below is the requires C# code:

  int times = Console.ReadLine();

for(int i =0; i<times; i++)

{

random_func();

}

}

static Random _r = new Random();

static void random_func()

int n = _r.Next();

Console.WriteLine(n); //here instead of writing on the consol you can write to a given file

}

}

 Chapter 5 Random numbers &Files; Create an application that writes a series of random numbers to a file. Each random number should be in the range of 1 thr

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site