I am new in programming and I am stuck in a C# problem. I want to create a console program where the user fills in some personal information and the console prints these information. I am trying to use ref but I can't connect the answers from the users (from method GetStudentInfo) with the print method PrintStudentDetails.
namespace ConsoleApplication3
{
class Program
{
static void Main(string[] args)
{
GetStudentInfo();
{
string first = "";
string last = "";
string birthday = "";
PrintStudentDetails(ref first, ref last, ref birthday);
}
GetTeacherInfo();
GetCourseInfo();
GetProgramInfo();
GetDegreeInfo();
}
//student information
static void GetStudentInfo()
{
Console.WriteLine("Enter the student's first name: ");
string firstName = Console.ReadLine();
Console.WriteLine("Enter the student's last name: ");
string lastName = Console.ReadLine();
Console.WriteLine("Enter the student's birthday: ");
string birthDay = Console.ReadLine();
}
static void PrintStudentDetails(ref string first, ref string last, ref string birthday)
{
first = "test";
last = "test";
birthday = "test";
Console.WriteLine("{0} {1} was born on: {2}", first, last, birthday);
Console.ReadLine();
}
}
}