Warning 1 Field 'ConsoleApplication1.Program.record.x' is never assigned to, and will always have its default value 0
Warning 2 Field 'ConsoleApplication1.Program.record.name' is never assigned to, and will always have its default value null
record x กับ record name ไม่ได้ใช่ใช่มั้ยค่ะ แล้วต้องเขียนยังไงค่ะ ลองศึกษาในเน็ตแล้วก็ยังไม่ได้ค่ะ
โค้ดที่เขียนค่ะ
struct record
{
public int x;
public string name;
};
static void Main(string[] args)
{
record[] data1 = new record[5];
int[] score;
int x;
string name;
score = new int[5];
Console.Write("Employee.............\n");
Console.WriteLine();
for (int n = 1; n < score.Length; n++)
{
Console.Write("Enter name[" + n + "] :");
name = Console.ReadLine();
Console.Write("Enter age[" + n + "] :");
x = int.Parse(Console.ReadLine());
}
Console.WriteLine();
Console.WriteLine("Output...\n");
Console.Read();