Thread: please help me what problem in this code

  1. #1
    Registered User
    Join Date
    Apr 2008

    Cool please help me what problem in this code

    please help for this code it's didn't print the array element
    public struct student
           public string name;
           public string gender;
           public int    tel;
           public string classe;
        class Program
            static void Main(string[] args)
                Console.WriteLine("Enter the Number of student :");
                int x = int.Parse(Console.ReadLine());
                student []array = new student[x];
                int count=1;
                for (int i = 0; i < array.Length; i++)
                    array[i] = new student();
                   Console.WriteLine("Enter info of student {0}",count);
                   Console.WriteLine("Name :");
                   array[i].name = Console.ReadLine();
                   Console.WriteLine("Gender :");
                   array[i].gender = Console.ReadLine();
                   Console.WriteLine("Tel :");
                   int tel = int.Parse(Console.ReadLine());
                   array[i].tel = tel;
                   Console.WriteLine("class :");
                   array[i].classe  = Console.ReadLine();
    i want print the element with index [0] please help me
    it is print like this school.student
    school name of project

  2. #2
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Rishon LeZion, Israel
    something like
    Console.WriteLine("Name: {0}, Gender: {1}, Tel: {2}, Class: {3}",array[0].name, array[0].gender, ...);
    may help
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  3. #3
    Registered User
    Join Date
    Apr 2008


    The ever impressive student register application using an array lab exercise...yummy!

    Student GPA anyone??

    First year C# is a pain in the buttocks, is it not?

    Welcome to Hell!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Code problem
    By sybariticak47 in forum C++ Programming
    Replies: 9
    Last Post: 02-28-2006, 11:50 AM
  2. Problem with game code.
    By ajdspud in forum C++ Programming
    Replies: 5
    Last Post: 02-14-2006, 06:39 PM
  3. problem with selection code
    By DavidP in forum Game Programming
    Replies: 1
    Last Post: 06-14-2004, 01:05 PM
  4. Replies: 5
    Last Post: 12-03-2003, 05:47 PM
  5. Help with code for simple Y2K problem
    By Mule in forum C++ Programming
    Replies: 3
    Last Post: 03-06-2003, 12:53 AM