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#
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
Tags:
Phản hồi từ học viên
5
(Dựa trên đánh giá ngày hôm nay)
![Trần Việt Đức Anh [C2010L]](https://www.gravatar.com/avatar/caee507e11365ca2cf5068cbea5c740a.jpg?s=80&d=mm&r=g)
Trần Việt Đức Anh
2021-10-01 12:10:11
/* 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();
}
}
}
![Đào Mạnh Dũng [C2010L]](https://www.gravatar.com/avatar/6a111fa53fd75dc87034660a8857df16.jpg?s=80&d=mm&r=g)
Đào Mạnh Dũng
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);
}
}
![Phạm Đăng Khoa [community,C2010L]](https://www.gravatar.com/avatar/c38babdc190b58e31608b8ddefc3ba1a.jpg?s=80&d=mm&r=g)
Phạm Đăng Khoa
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");
}
}
}
![Kim Văn Thiết [community,AAHN-C2009G]](https://www.gravatar.com/avatar/a6fe3c0fba887fdd75f4bdc95b86b1f7.jpg?s=80&d=mm&r=g)
Kim Văn Thiết
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;
}
}
![Kim Văn Thiết [community,AAHN-C2009G]](https://www.gravatar.com/avatar/a6fe3c0fba887fdd75f4bdc95b86b1f7.jpg?s=80&d=mm&r=g)
Kim Văn Thiết
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;
}
![Hoàng Thiện Thanh [community,AAHN-C2009G]](https://www.gravatar.com/avatar/58e377dde293f6da38c0b5168578557a.jpg?s=80&d=mm&r=g)
Hoàng Thiện Thanh
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();
}
}
}
![Nguyễn Việt Hoàng [community,AAHN-C2009G]](https://www.gravatar.com/avatar/bdbde8074d82148dcda6927ccb016466.jpg?s=80&d=mm&r=g)
Nguyễn Việt Hoàng
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();
}*/
}
}
![Đặng Trần Nhật Minh [T2008A]](https://www.gravatar.com/avatar/ee8dc5a777ad26f3a962e86c233437cf.jpg?s=80&d=mm&r=g)
Đặng Trần Nhật Minh
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);
}
}
![Do Trung Duc [T2008A]](https://www.gravatar.com/avatar/2973ac07124f066b4605c535e8d39a99.jpg?s=80&d=mm&r=g)
Do Trung Duc
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);
}
}
}
![Triệu Văn Lăng [T2008A]](https://www.gravatar.com/avatar/1348e3562c6492c26f796cb1f45982a1.jpg?s=80&d=mm&r=g)
Triệu Văn Lăng
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);
}
}
}