Advertisement
nuggetin

struct

Nov 9th, 2021
995
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 KB | None | 0 0
  1. using System;
  2. namespace Structure
  3. {
  4.     class Program
  5.     {
  6.         static int nums = 0;
  7.         struct album
  8.         {
  9.             public string songTitle;
  10.             public string songDuration;
  11.             public string songArtists;
  12.         }
  13.         static void Main(string[] args)
  14.         {
  15.             //inserts
  16.             album s1,s2;
  17.  
  18.             s1.songTitle = "INDUSTRY BABY";
  19.             s1.songDuration = "3:33";
  20.             s1.songArtists = "Lil Nas X, Jack Harlow";
  21.  
  22.             s2.songTitle = "MONTERO (Call me by your name)";
  23.             s2.songDuration = "2:19";
  24.             s2.songArtists = "Lil Nas X";
  25.  
  26.             print(s1.songTitle, s1.songDuration, s1.songArtists);
  27.             print(s2.songTitle, s2.songDuration, s2.songArtists);
  28.  
  29.         }
  30.  
  31.         static void print(string t, string d, string a)
  32.         {
  33.             nums++;
  34.             Console.WriteLine("\nSong # " +nums + "\nTitle: " + t + "\nDuration: " + d + "\nArtist: " + a);
  35.         }
  36.     }
  37. }
  38.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement