Wednesday, 27 November 2013

C# Simple Structure Program----|||||||

Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace StructureProgram
{
    class Program
    {
        struct student
        {
            String name;
            int rollno;
            int regno;
            student(String x, int y, int z)
            {
                name = x;
                rollno = y;
                regno = z;
            }

            public static void Main(string[] args)
            {
                student std = new student();
                std.name = "Rahul";
                Console.WriteLine("\n Name is"+"  "+"=" + std.name);

                std.rollno = 12;
                Console.WriteLine("\n Rollno is"+""+"=" + std.rollno);
                std.regno = 10802055;
                Console.WriteLine("\n Regno is"+" "+ "=" + std.regno);
                Console.ReadKey();

            }
        }
    }
}


Output:

No comments:

Post a Comment