hey all.. this is my code..
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace Guess_Game
{
class Program
{
static void Main(string[] args)
{
int quantity;
int min, max;
Console.WriteLine("Enter the Quantity of Numbers : ");
quantity = int.Parse(Console.ReadLine());
Console.WriteLine("Enter the Maximum and Minimum Number that you wish to be in your file : \n");
Console.WriteLine("MIN : ");
min = int.Parse(Console.ReadLine());
Console.WriteLine("MAX : ");
max = int.Parse(Console.ReadLine());
Console.WriteLine("Now, Guess the Number : ");
int number = int.Parse(Console.ReadLine());
Console.WriteLine("Now Guess a Number That already contains in a File : ");
number = int.Parse(Console.ReadLine());
GuessGame(min, max, quantity, number);
//if(number!= // number not equal to that number that contains in a file.. how to write it in that
//if condition..
}
static void GuessGame(int min,int max,int quantity,int number)
{
Random r = new Random();
StreamWriter sw = new StreamWriter(@"D:\nasir\Guess Game\Guess Game\bin\Debug\ Guess Game.txt");
for (int i = 0; i < quantity; i++)
{
int temp = r.Next(min, max);
sw.WriteLine(temp);
}
// while(number != sw.WriteLine())
{
Console.WriteLine("Your Guess is Wrong!");
}
sw.Close();
}
}
}
i am not getting that how do i compare the numbers that are into the file from the number that is been passed from the function..