I am generating random numbers from -1000 to 1000 (the numbers are written in numbers.txt), but I don't know how to write the number of positives, negatives, and zeroes into a new .txt file (can you help me how to do this?).
The output should look like this:
The number of all numbers: 100
The number of positive numbers: 65 (for example)
The number of negative numbers: 3
The number of zeroes: 1
namespace ConsoleApp81
{
class Program
{
static void Generate(string nazev, int pocet, int odd, int doo)
{
Random nahoda = new Random();
StreamWriter sw = new StreamWriter(nazev, false, Encoding.Unicode);
for (int i = 0; i < 100; i++)
{
sw.WriteLine(nahoda.Next(-1000, 1001));
}
sw.WriteLine(nahoda);
sw.Close();
}
static void Main(string[] args)
{
Generate("numbers.txt", 100, -1000, 1000);
}
}
}