Quotes help make search much faster. Example: "Practice Makes Perfect"

Tuesday, September 3, 2019

Codecademy Built-In Methods 6/8


// Sample Solution
using System;

namespace BuiltInMethods
{
  class Program
  {
    static void Main(string[] args)
    {   
      string[] summerStrut;
     
      summerStrut = new string[] { "Juice", "Missing U", "Raspberry Beret", "New York Groove", "Make Me Feel", "Rebel Rebel", "Despacito", "Los Angeles" };
     
      int[] ratings = { 5, 4, 4, 3, 3, 5, 5, 4 };
     
      int songNumber = Array.IndexOf(ratings, 3) + 1;
      Console.WriteLine($"Song number {songNumber} is rated three stars.");
      string songName = Array.Find(summerStrut, s => s.Length > 10);
      Console.WriteLine($"The first song that has more than 10 characters in the title is {songName}.");
      Array.Sort(summerStrut);
      Console.WriteLine(summerStrut[0]);
      Console.WriteLine(summerStrut[7]);
    }
  }
}

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts