By GokiSoft.com| 10:08 05/10/2021|
C Sharp

Nhập và hiển thị thông tin sinh viên - Console trong C# BT1394

Thông tinh sinh viên gồm các thuộc tính sau : tên, mã sinh viên, tuổi, địa chỉ

Yêu cầu :

Thực hiện và in ra thông tin sinh viên trên

Liên kết rút gọn:

https://gokisoft.com/1394

Bình luận

avatar
Trần Việt Đức Anh [C2010L]
2021-10-01 12:10:11


#Ex 1394
/* Thông tinh sinh viên gồm các thuộc tính sau : tên, mã sinh viên, tuổi, địa chỉ

Yêu cầu :

Thực hiện và in ra thông tin sinh viên trên
*/

using System;

namespace Ex1394
{
    class Program
    {
        static void Main(string[] args)
        {
            string name, id, age, address;
            Console.WriteLine("Enter name:");
            name = Console.ReadLine();

            Console.WriteLine("Enter ID:");
            id = Console.ReadLine();

            Console.WriteLine("Enter age:");
            age = Console.ReadLine();

            Console.WriteLine("Enter address:");
            address = Console.ReadLine();

            Console.WriteLine("--------------");
            Console.WriteLine("Information:");
            Console.WriteLine("{0}", name);
            Console.WriteLine("{0}", id);
            Console.WriteLine("{0}", age);
            Console.WriteLine("{0}", address);
            Console.ReadKey();
        }
    }
}


avatar
Đào Mạnh Dũng [C2010L]
2021-09-30 14:08:39

using System;

class sinhvien

{

    public static void Main()

    {

        string name = Console.ReadLine();

        string id = Console.ReadLine();

        int age = int.Parse(Console.ReadLine());

        string adress = Console.ReadLine();


        Console.WriteLine("tên :{0}, mã sinh viên :{1}, tuổi :{2}, địa chỉ :{3}",name,id,age,adress);


    }

}

avatar
Phạm Đăng Khoa [community,C2010L]
2021-09-30 13:31:18



using System;

namespace Lesson01
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Pham Dang Khoa");
            Console.WriteLine("Student0150");
            Console.WriteLine("21 years old");
            Console.WriteLine("Vinh Phuc Province");
      
        }
    }
}


avatar
Kim Văn Thiết [community,AAHN-C2009G]
2021-09-25 05:11:48



class Student
        {

            public string Name { get; set; }
            public string rollno { get; set; }
            public int age { get; set; }
            public string address { get; set; }

            public Student()
            {

            }

            public Student(string name, string rollno, int age, string address)
            {
                this.Name = name;
                this.rollno = rollno;
                this.age = age;
                this.address = address;
            }

            public void Input()
            {
                Console.WriteLine("Nhap ten: ");
                Name = Console.ReadLine();
                Console.WriteLine("Nhap rollno: ");
                rollno = Console.ReadLine();
                Console.WriteLine("Nhap tuoi: ");
                age = int.Parse(Console.ReadLine());
                Console.WriteLine("Nhap dia chi: ");
                address = Console.ReadLine();
            }

            public void Display()
            {
                Console.WriteLine(ToString());
            }


            public string ToString()
            {
                return "Ten :" + Name + " rollno: " + rollno + " age: " + age + "address: " + address;
            }
        }


avatar
Kim Văn Thiết [community,AAHN-C2009G]
2021-09-25 03:10:04



class Student
    {

        public string Name { get; set; }
        public string rollno { get; set; }
        public int age { get; set; }
        public string address { get; set; }

        public Student()
        {

        }

        public Student(string name, string rollno, int age, string address)
        {
            this.Name = name;
            this.rollno = rollno;
            this.age = age;
            this.address = address;
        }

        public void Input()
        {
            Console.WriteLine("Nhap ten: ");
            Name = Console.ReadLine();
            Console.WriteLine("Nhap rollno: ");
            rollno = Console.ReadLine();
            Console.WriteLine("Nhap tuoi: ");
            age = int.Parse(Console.ReadLine());
            Console.WriteLine("Nhap dia chi: ");
            address = Console.ReadLine();
        }

        public void Display()
        {
            Console.WriteLine(ToString());
        }


        public string ToString()
        {
            return "Ten :" + Name + " rollno: " + rollno + " age: " + age + "address: " + address;
        }


avatar
Hoàng Thiện Thanh [community,AAHN-C2009G]
2021-09-23 15:57:04


#Program.cs


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

namespace StudentApp
{
    class Student
    {
        public string Name { get; set; }
        public string RollNo { get; set; }
        private int age;
        public int Age { 
            get {
                return age;
            }
            set
            {
                while (value <= 0)
                {
                    Console.WriteLine("Please enter an age not equal or less than 0");
                    value = int.Parse(Console.ReadLine());
                    
                }
                this.age = value;
            }
        }
        public string Address { get; set; }

        public Student()
        {

        }

        public Student(string _Name, string _RollNo, int _Age, string _Address)
        {
            this.Name = _Name;
            this.RollNo = _RollNo;
            this.Age = _Age;
            this.Address = _Address;
        }

        public void input()
        {
            Console.Write("Enter Name: ");
            Name = Console.ReadLine();
            Console.Write("\nRollNo: ");
            RollNo = Console.ReadLine();
            Console.Write("\nAge: ");
            Age = int.Parse(Console.ReadLine());
            Console.Write("\nAddress: ");
            Address = Console.ReadLine();
        }
        public void display()
        {
            Console.WriteLine("\nName: {0}\nRollNo: {1}\nAge: {2}\nAddress: {3}", Name, RollNo, Age, Address);
        }

    }
    class Program
    {
        static void Main(string[] args)
        {
            Student a = new Student();
            a.input();
            a.display();

        }
    }
}


avatar
Nguyễn Việt Hoàng [community,AAHN-C2009G]
2021-09-23 15:45:09


#student.cs


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

namespace Ss2
{
    class student
    {
        public string Name { get; set; }
        public string RollNo { get; set; }
        public int Age { get; set; }
        public string Address { get; set; }
        public student()
        {

        }
        public student(string name , string rollno , int age , string address)
        {
            this.Name = name;
            this.RollNo = rollno;
            this.Age = age;
            this.Address = address;
        }
        public void input()
        {
            Console.WriteLine("Enter Name :");
            Name = Console.ReadLine();
            Console.WriteLine("Enter RollNo :");
            RollNo = Console.ReadLine();
            Console.WriteLine("Enter Age :");
            Age = int.Parse(Console.ReadLine());
            Console.WriteLine("Enter Address :");
            Address = Console.ReadLine();
        }
        public void display()
        {
            Console.WriteLine("Name :{0} , RollNo :{1} , Age :{2} , Address :{3}", Name, RollNo, Age, Address);
        }
       /* static void Main(string[] args)
        {
            student a = new student();
            a.input();
            a.display();
        }*/
    }
}


avatar
Đặng Trần Nhật Minh [T2008A]
2021-06-03 13:45:44



using System;

public class Program
{
	public static void Main()
	{
		string name, rollNo, age, address;
		Console.Write("Input Name: "); name = Console.ReadLine();
		Console.Write("Input RollNo: "); rollNo = Console.ReadLine();
		Console.Write("Input Age: "); age = Console.ReadLine();
		Console.Write("Input Address: "); address = Console.ReadLine();

		Console.WriteLine("Input Name: {0}", name);
		Console.WriteLine("Input RollNo: {0}", rollNo);
		Console.WriteLine("Input Age: {0}", age);
		Console.WriteLine("Input Address: {0}", address);
	}
}


avatar
Do Trung Duc [T2008A]
2021-05-18 04:44:23



using System;

namespace Lesson1_NhapHienThiSinhVien
{
    class Program
    {
        static void Main(string[] args)
        {
            
            Console.WriteLine("Nhap ten sinh vien:");
            string name = Console.ReadLine();

            Console.WriteLine("Nhap tuoi sinh vien:");
            int age = Int32.Parse(Console.ReadLine());

            Console.WriteLine("Nhap ma sinh vien:");
            string roolno = Console.ReadLine();

            Console.WriteLine("Nhap dia chi sinh vien:");
            string address = Console.ReadLine();

            Console.WriteLine("Ten: {0}, Tuoi: {1}, Ma sinh vien {2}, Dia chi: {3}", name, age, roolno, address);
        }
    }
}


avatar
Triệu Văn Lăng [T2008A]
2021-05-17 08:32:35



using System;

namespace bai1394
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Console.WriteLine("Input infor student");

            string name, rollno, address;
            int age;

            Console.WriteLine("Input name: ");
            name = Console.ReadLine();

            Console.WriteLine("Input rollno: ");
            rollno = Console.ReadLine();

            Console.WriteLine("Input age: ");
            age = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Input address: ");
            address = Console.ReadLine();
            Console.WriteLine("-----------------------");
            Console.WriteLine("Infor student")
            Console.WriteLine("Name: " + name);
            Console.WriteLine("rollno: " + rollno);
            Console.WriteLine("age: " + age);
            Console.WriteLine("address: " + address);


        }
    }
}