1. Write a sample program to demonstrate the use of
structures.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace @struct
{
class Program
{
static void Main(string[]
args)
{
CustomerDetails obj = new CustomerDetails();
Console.WriteLine("Enter the CustomerID");
obj.customerid = Console.ReadLine();
Console.WriteLine("Enter the CustomerName");
obj.customername = Console.ReadLine();
Console.WriteLine("Enter the CustomerPhoneNo");
obj.customerphoneno = Console.ReadLine();
Console.WriteLine("Enter the CustomeAddress");
obj.customeraddress = Console.ReadLine();
Console.WriteLine("Enter the ProductName");
obj.customerproduct = Console.ReadLine();
Console.WriteLine("Enter the BillAmount");
obj.customerbillamt = Console.ReadLine();
Console.WriteLine("Customer Information is as follows:");
Console.WriteLine("===================================");
Console.WriteLine("CustomerID:\t{0}", obj.customerid);
Console.WriteLine("CustomerName:\t{0}", obj.customername);
Console.WriteLine("CustomerPhone:\t{0}",
obj.customerphoneno);
Console.WriteLine("CustomerAddress:\t{0}",
obj.customeraddress);
Console.WriteLine("CustomerProduct:\t{0}",
obj.customerproduct);
Console.WriteLine("CustomerBillAmount:\t{0}",
obj.customerbillamt);
Console.ReadLine();
}
}
struct CustomerDetails
{
public string customerid;
public string customername;
public string customerphoneno;
public string customeraddress;
public string customerproduct;
public string customerbillamt;
}
}
No comments:
Post a Comment