DESIGN A STRUCTURE TYPE DATA in C#

SOURCE CODE :

//programed by Paras Wadher
MCA
Nagpur university

// DESIGN A STRUCTURE TYPE DATA USING THE GIVEN INFORMATION.

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

namespace Student
{
public struct inf
{
public string name;
public string dob;
public double mrks;
}
public struct mail
{
public string nm;
public int door;
public string street;
public string city;
public double pincode;
}
public struct book
{
public string author_name;
public string title;
public string pub;
public double cost;
}
class Program
{
public static void Main(string[] args)
{
inf s;
mail m;
book b;

Console.WriteLine(“Enter the Student inf :”);
Console.WriteLine(“Enter Name :- “);
s.name = Console.ReadLine();
Console.WriteLine(“Enter DOB :- “);
s.dob = Console.ReadLine();
Console.WriteLine(“Enter TOT Marks:- “);
s.mrks =double.Parse(Console.ReadLine());

Console.WriteLine(“Enter Data for mailing :- “);
Console.WriteLine(“Enter Name :- “);
m.nm = Console.ReadLine();
Console.WriteLine(“Enter Door no:- “);
m.door = int.Parse(Console.ReadLine());
Console.WriteLine(“Enter street :- “);
m.street = Console.ReadLine();
Console.WriteLine(“Enter City :- “);
m.city = Console.ReadLine();
Console.WriteLine(“Enter Pincode:- “);
m.pincode = double.Parse(Console.ReadLine());

Console.WriteLine(“Enter Book inf :- “);
Console.WriteLine(“Enter Author Name :- “);
b.author_name = Console.ReadLine();
Console.WriteLine(“Enter Title :- “);
b.title = Console.ReadLine();
Console.WriteLine(“Enter Year of pub:- “);
b.pub = Console.ReadLine();
Console.WriteLine(“Enter cost :- “);
b.cost = double.Parse(Console.ReadLine());

Console.WriteLine();
Console.WriteLine();
Console.WriteLine(“Students Information”);
Console.WriteLine(“————————————-“);
Console.WriteLine(“Name : “+s.name);
Console.WriteLine(“Date of Birth :”+s.dob);
Console.WriteLine(“MArks :”+s.mrks);

Console.WriteLine(“Name :” + m.nm);
Console.WriteLine(“Door no:” + m.door);
Console.WriteLine(“Street:” + m.street);
Console.WriteLine(“City:” + m.city);
Console.WriteLine(“Pincode :” + m.pincode);

Console.WriteLine(“Author name :” + b.author_name);
Console.WriteLine(“Title:” + b.title);
Console.WriteLine(“Yeaar of pub :” + b.pub);
Console.WriteLine(“Cost:” + b.cost);

Console.ReadLine();
}
}
}

//========OUTPUT=====

Enter the Student inf :
Enter Name :-
Paras
Enter DOB :-
03-01-1986
Enter TOT Marks:-
600
Enter Data for mailing :-
Enter Name :-
Paras
Enter Door no:-
14
Enter street :-
Nehru Gali
Enter City :-
mumbai
Enter Pincode:-
400062
Enter Book inf :-
Enter Author Name :-
Balagurusamy
Enter Title :-
c#
Enter Year of pub:-
2008
Enter cost :-
199

Students Information :
—————————————
Name : Paras
Date of Birth :03-01-1986
MArks :600
Name :Paras
Door no:23
Street:Nehru Gali
City:mumbai
Pincode :400062
Author name :Balagurusamy
Title:c#
Yeaar of pub :2008
Cost:199

Leave a Reply

Your email address will not be published. Required fields are marked *