本文整理汇总了C#中Course.printCourseInfo方法的典型用法代码示例。如果您正苦于以下问题:C# Course.printCourseInfo方法的具体用法?C# Course.printCourseInfo怎么用?C# Course.printCourseInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Course
的用法示例。
在下文中一共展示了Course.printCourseInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
int c; //Total # of Students returned to the main program
bool q = true; //while loop condition
//Create a new Course
Course c1 = new Course();
c = c1.getCourseInfo(); //Total Students return value
System.Console.WriteLine();
Student[] arrayofStudents;
arrayofStudents = new Student[c];
//Enter Student Information. Check to reenter
while (q == true)
{
for (int i = 0; i < c; i++)
{
arrayofStudents[i] = new Student();
System.Console.Write("Student Name: ");
arrayofStudents[i].sName = System.Console.ReadLine();
System.Console.Write("Student Number: ");
arrayofStudents[i].sNumber = int.Parse(System.Console.ReadLine());
System.Console.WriteLine();
}
System.Console.Write("True or False: Would you like to reenter the student information? ");
q = bool.Parse(System.Console.ReadLine());
System.Console.WriteLine();
}
//Print Course Information
c1.printCourseInfo();
System.Console.WriteLine();
//Print Student Information
for (int i = 0; i < c; i++)
{
System.Console.Write("Student Name: " + arrayofStudents[i].sName + ", ");
System.Console.WriteLine("Student Number: " + arrayofStudents[i].sNumber);
}
System.Console.Write("Press any key to complete...");
System.Console.ReadKey();
}