Click here to Skip to main content
15,907,001 members
Home / Discussions / C#
   

C#

 
AnswerRe: How can i get year, month different from calendar? Pin
PIEBALDconsult28-Aug-11 16:52
mvePIEBALDconsult28-Aug-11 16:52 
AnswerRe: How can i get year, month different from calendar? Pin
Anthony Mushrow28-Aug-11 17:08
professionalAnthony Mushrow28-Aug-11 17:08 
Questionjust woundering about random numbers? Pin
stephen.darling28-Aug-11 12:02
stephen.darling28-Aug-11 12:02 
AnswerRe: Just wondering about random numbers Pin
DaveyM6928-Aug-11 13:06
professionalDaveyM6928-Aug-11 13:06 
JokeRe: just woundering about random numbers? Pin
PIEBALDconsult28-Aug-11 14:10
mvePIEBALDconsult28-Aug-11 14:10 
GeneralRe: just woundering about random numbers? Pin
stephen.darling28-Aug-11 14:57
stephen.darling28-Aug-11 14:57 
GeneralRe: just woundering about random numbers? Pin
PIEBALDconsult28-Aug-11 16:50
mvePIEBALDconsult28-Aug-11 16:50 
AnswerRe: just woundering about random numbers? Pin
ljupcecar28-Aug-11 22:55
ljupcecar28-Aug-11 22:55 
1) for random numbers
C#
static Random _r = new Random();
static int F()
{
    int n = _r.Next(0,36);
    return n;
}

1a) - if you want to make bingo card
C#
static void Main()
    {
        //if you want card with 6 numbers

            int[] numbers = new int[6];


        //to put different numbers at each place on the array


            for (int i = 0; i < numbers.Length; i++)
            {
                int a = F();
                bool has = numbers.Contains(a);
                if (has == true) {i--; }
                else {
                    numbers[i]=a;
                }
            }


        //to sort it and print it

            Array.Sort(numbers);

            int j = 0;
            foreach (int i in numbers)
            {
                Console.WriteLine("number at place " + (j+1).ToString() +" is " +i.ToString());
                j++;
            }
            Console.ReadLine();


    }

            static Random _r = new Random();
            static int F()
            {
                int n = _r.Next(0,36);
                return n;
            }




for horses and chances of winning
C#
static void Main(string[] args)
{
    int a = F();

    //if random number wich is between 1 and 100 is smaler or equal 80 than horse win
    if (a <= 80)
    {
        Console.Write("horse win!");
    }
    //else horse lose
    else { Console.Write("horse lose!"); }
    //and to check what is current value of number a - wich is number between 1 and 100
    Console.Write(" value of a is " + a.ToString());
    Console.ReadLine();
}
static Random _r = new Random();
static int F()
{
    int n = _r.Next(1, 100);
    return n;
}

AnswerRe: just woundering about random numbers? [modified] Pin
GParkings1-Sep-11 6:33
GParkings1-Sep-11 6:33 
GeneralRe: just woundering about random numbers? Pin
stephen.darling1-Sep-11 13:45
stephen.darling1-Sep-11 13:45 
GeneralRe: just woundering about random numbers? Pin
GParkings1-Sep-11 21:58
GParkings1-Sep-11 21:58 
GeneralRe: just woundering about random numbers? Pin
stephen.darling2-Sep-11 1:15
stephen.darling2-Sep-11 1:15 
QuestionIs this a good book to learn c#? Pin
stephen.darling28-Aug-11 7:01
stephen.darling28-Aug-11 7:01 
AnswerRe: Is this a good book to learn c#? Pin
Shameel28-Aug-11 8:54
professionalShameel28-Aug-11 8:54 
GeneralRe: Is this a good book to learn c#? Pin
stephen.darling28-Aug-11 11:25
stephen.darling28-Aug-11 11:25 
AnswerRe: Is this a good book to learn c#? Pin
Eddy Vluggen28-Aug-11 9:05
professionalEddy Vluggen28-Aug-11 9:05 
GeneralRe: Is this a good book to learn c#? Pin
stephen.darling28-Aug-11 11:27
stephen.darling28-Aug-11 11:27 
AnswerRe: Is this a good book to learn c#? Pin
BillWoodruff28-Aug-11 19:43
professionalBillWoodruff28-Aug-11 19:43 
Questionintegrate app.config [modified] Pin
Groulien28-Aug-11 4:14
Groulien28-Aug-11 4:14 
AnswerRe: integrate app.config Pin
jschell28-Aug-11 7:49
jschell28-Aug-11 7:49 
QuestionC#.net access Pin
dcof28-Aug-11 3:04
dcof28-Aug-11 3:04 
AnswerRe: C#.net access Pin
PIEBALDconsult28-Aug-11 4:34
mvePIEBALDconsult28-Aug-11 4:34 
GeneralRe: C#.net access Pin
dcof28-Aug-11 8:53
dcof28-Aug-11 8:53 
GeneralRe: C#.net access Pin
PIEBALDconsult28-Aug-11 12:01
mvePIEBALDconsult28-Aug-11 12:01 
GeneralRe: C#.net access Pin
dcof28-Aug-11 13:12
dcof28-Aug-11 13:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.