View difference between Paste ID: xfKcYrhi and G5Lj42yt
SHOW: | | - or go back to the newest paste.
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Threading.Tasks;
6
7-
namespace Tuzla_Homework2_By_Amel_Sejranic
7+
namespace Tuzla_Homework2
8
{
9
    class Program
10
    {
11
        static void Main(string[] args)
12
        {
13
            int countStudent = 0;
14
            int totalStudents = 6;
15
            String[] studentNames = new String[6];
16
            String firstName;
17
            String lastName;
18
19
            while (countStudent < totalStudents)
20
            {
21
                Console.WriteLine("Enter Student Name: ");
22
                firstName = Console.ReadLine();
23
                Console.WriteLine("Enter Student Last Name: ");
24
                lastName = Console.ReadLine();
25
26
                studentNames[countStudent] = firstName + " " + lastName;
27
                countStudent++;
28
                Console.WriteLine("");
29
            }
30
            Console.WriteLine("");
31
            Console.WriteLine("Total {0} students is entered", totalStudents);
32
            Console.WriteLine("");
33
34
            foreach (string s in studentNames)
35
            {
36
                Console.WriteLine(s);
37
            }
38
39
            Console.WriteLine("");
40
            Array.Sort(studentNames);
41
            Console.WriteLine("Sorted Array");
42
            Console.WriteLine("");
43
44
            foreach (string s in studentNames)
45
            {
46
                Console.WriteLine(s);
47
            }
48
            Console.ReadLine();
49
        }
50
    }
51
}