Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.75 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace AssesTblFootball
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             // Define the variables
  13.             int N;
  14.             int point;
  15.             int play;
  16.             string team;
  17.  
  18.             // Determine array size
  19.             Console.WriteLine("How many teams?");
  20.             N = Convert.ToInt32(Console.ReadLine());
  21.  
  22.             // Define the arrays & size
  23.             string[] teams = new string[N];
  24.             int[,] PlayedPoints = new int[N, N];
  25.  
  26.             // Add teams, scores & matches to arrays
  27.             for (int i = 0; i < N; i++)
  28.             {
  29.                 Console.WriteLine("Enter team name:");
  30.                 team = Console.ReadLine();
  31.                 teams[i] = team;
  32.  
  33.                 Console.WriteLine("Enter points scored");
  34.                 point = Convert.ToInt32(Console.ReadLine());
  35.                 PlayedPoints[i, 0] = point;
  36.  
  37.                 Console.WriteLine("Enter games played");
  38.                 play = Convert.ToInt32(Console.ReadLine());
  39.                 PlayedPoints[i, 1] = play;
  40.            }
  41.  
  42.             Console.WriteLine("View results?");
  43.             char yn = Convert.ToChar(Console.ReadLine());
  44.             if (yn == 'Y' || yn == 'y')
  45.             {
  46.                 //Print team info from arrays
  47.                 for (int i = 0; i < teams.Length; i++)
  48.                     {
  49.                         Console.WriteLine("------------");
  50.                         Console.WriteLine("Team: {0} \nPoints: {1} \nPlayed: {2}", teams[i], PlayedPoints[i, 0], PlayedPoints[i, 1]);
  51.                         Console.ReadKey();
  52.  
  53.                     }
  54.             }
  55.         }
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement