[ create a new paste ] login | about

Link: http://codepad.org/kbJ9KQTA    [ raw code | output | fork ]

C, pasted on Apr 4:
using System;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace musicDB
{
    class musicDB
    {
        private string albumName;
        private int totalMusic, totalSongs;
        private const int MAX_MUSIC = 50;
        private Music[] myMusic;
        private string songName;
        private string[] Songs;
        private const int MAX_SONG = 30;
        

        public musicDB(string albumName) // This method creates a new music class in an array, allow to have multiple albums with more information in each part of the array
        {
            this.albumName = albumName;
            totalMusic = 0;
            myMusic = new Music[MAX_MUSIC];
            
        }

        public bool AddSong(string songName)
        {
            for (int i = 0; i < MAX_MUSIC; i++)
            {
                string c = albumName;                   // This compares the album name given by user
                string e = myMusic[i].getAlName;        // to the album name in the myMusic array
                int d = c.CompareTo(e);                 //
                if (d == 0)
                {
                    int index = -1;
                    for (int j = 0; j < MAX_SONG; j++)
                    {
                        if (Songs[i] == null)
                        {
                            index = i;
                            break;
                        }
                    }
                    if (index != -1)
                    {
                        Songs[index] = songName;
                        ++totalSongs;
                        return true;
                    }
                }
            }


            return false;

        }
            

        public bool AddAlbum(string albumName) // Generates music class based on if myMusic[] array have an avalible spot in its array. If it does, returns true.
        {
            int index = -1;
            for (int i = 0; i < MAX_MUSIC; i++)
            {
                if (myMusic[i] == null)
                {
                    index = i;
                    break;
                }
            }
            if (index != -1)
            {
                myMusic[index] = new Music(albumName);
                ++totalMusic;
                return true;

            }
            return false;

        }

        public bool RemoveAlbum(string albumName)
        {
            for (int i = 0; i < MAX_MUSIC; i++)
            {
                if (myMusic[i] != null)
                {
                    string c = albumName;
                    string e = myMusic[i].getAlName;
                    int d = c.CompareTo(e);
                    if (d == 0)
                    {
                        myMusic[i] = null;
                        --totalMusic;
                        return true;
                    }
                }
            }
            return false;
        }

        public void ListAlbums(IList list)
        {
            list.Clear();
            for (int i = 0; i < MAX_MUSIC; ++i)
            {
                if (myMusic[i] == null)
                    continue;
                list.Add(myMusic[i].getAlName);
            }
        }



    }
}


Output:
1
2
3
4
5
6
Line 1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'System'
Line 2: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'System'
Line 3: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'System'
Line 4: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'System'
Line 5: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'System'
Line 7: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'musicDB'


Create a new paste based on this one


Comments: