當前位置:編程學習大全網 - 源碼下載 - 以vi為編輯工具,用c語言編寫程序,獲取6個2位隨機數據,然後按照數值從小到大冒泡排序。鏈接後運行。

以vi為編輯工具,用c語言編寫程序,獲取6個2位隨機數據,然後按照數值從小到大冒泡排序。鏈接後運行。

public class Player

{

private AxWMPLib.AxWindowsMediaPlayer myPlayer;

private

string

[] playList;

private int numOfMusic;

private int currentPlay;

public int NumOfMusic

{

get

{

return numOfMusic;

}

}

public WMPLib.WMPPlayState playstate

{

get

{

return myPlayer.playState;

}

}

public string PlayList(int num)

{

return playList[num];

}

public Player(AxWMPLib.AxWindowsMediaPlayer mediaPlayer)

{

myPlayer = mediaPlayer;

playList = new string[1000];

numOfMusic = 0;

}

public

void

AddFile(string path)

{

if(numOfMusic < 1000)

{

numOfMusic ;

playList[numOfMusic] = path;

}

}

public void DelFile(int selectNum)

{

for(int i = selectNum; i <= numOfMusic - 1; i )

{

playList = playList[i 1];

}

numOfMusic --;

}

public void play(int selectNum)

{

myPlayer.URL = playList[selectNum];

currentPlay = selectNum;

}

public int NextPlay(int type)

{

/* type = 0 順序

switch

(type)

{

case 0:

currentPlay ;

if(currentPlay > numOfMusic)return 0;

else return currentPlay;

case 1:

currentPlay ;

if(currentPlay > numOfMusic) return 1;

else return currentPlay;

case 2:

return currentPlay;

case 3:

Random rdm = new Random(unchecked((int)DateTime.Now.Ticks));

currentPlay = rdm.Next() % numOfMusic;

if(currentPlay == 0) return numOfMusic;

else return currentPlay;

default:

return 0;

}

}

}

if(this.openFileDialog1.ShowDialog() == DialogResult.OK)

{

string path = this.openFileDialog1.FileName;

FileInfo f = new FileInfo(path);

MyPlayer.AddFile(f.FullName);

string STRFILE = Convert.ToString(MyPlayer.NumOfMusic);

for(int i = 1;i<=5-STRFILE.Length;i )STRFILE =’ ’;

STRFILE = f.Name;

this.listBox1.Items.Add(STRFILE);

}

if(this.openFileDialog1.ShowDialog() == DialogResult.OK)

{

string path = this.openFileDialog1.FileName;

FileInfo f = new FileInfo(path);

MyPlayer.AddFile(f.FullName);

string STRFILE = Convert.ToString(MyPlayer.NumOfMusic);

for(int i = 1;i<=5-STRFILE.Length;i )STRFILE =’ ’;

STRFILE = f.Name;

this.listBox1.Items.Add(STRFILE);

}

if(this.openFileDialog1.ShowDialog() == DialogResult.OK)

{

string path = this.openFileDialog1.FileName;

FileInfo f = new FileInfo(path);

MyPlayer.AddFile(f.FullName);

string STRFILE = Convert.ToString(MyPlayer.NumOfMusic);

for(int i = 1;i<=5-STRFILE.Length;i )STRFILE =’ ’;

STRFILE = f.Name;

this.listBox1.Items.Add(STRFILE);

}

if(this.openFileDialog1.ShowDialog() == DialogResult.OK)

{

string path = this.openFileDialog1.FileName;

FileInfo f = new FileInfo(path);

MyPlayer.AddFile(f.FullName);

string STRFILE = Convert.ToString(MyPlayer.NumOfMusic);

for(int i = 1;i<=5-STRFILE.Length;i )STRFILE =’ ’;

STRFILE = f.Name;

this.listBox1.Items.Add(STRFILE);

}

if(this.openFileDialog1.ShowDialog() == DialogResult.OK)

{

string path = this.openFileDialog1.FileName;

FileInfo f = new FileInfo(path);

MyPlayer.AddFile(f.FullName);

string STRFILE = Convert.ToString(MyPlayer.NumOfMusic);

for(int i = 1;i<=5-STRFILE.Length;i )STRFILE =’ ’;

STRFILE = f.Name;

this.listBox1.Items.Add(STRFILE);

}

if(this.openFileDialog1.ShowDialog() == DialogResult.OK)

{

string path = this.openFileDialog1.FileName;

FileInfo f = new FileInfo(path);

MyPlayer.AddFile(f.FullName);

string STRFILE = Convert.ToString(MyPlayer.NumOfMusic);

for(int i = 1;i<=5-STRFILE.Length;i )STRFILE =’ ’;

STRFILE = f.Name;

this.listBox1.Items.Add(STRFILE);

}

if(this.openFileDialog1.ShowDialog() == DialogResult.OK)

{

string path = this.openFileDialog1.FileName;

FileInfo f = new FileInfo(path);

MyPlayer.AddFile(f.FullName);

string STRFILE = Convert.ToString(MyPlayer.NumOfMusic);

for(int i = 1;i<=5-STRFILE.Length;i )STRFILE =’ ’;

STRFILE = f.Name;

this.listBox1.Items.Add(STRFILE);

}

  • 上一篇:我是壹名大專生 自身專業通信技術, 想自學java 請問高手們初學者要多註意點什麽?
  • 下一篇:求oa辦公系統的開發流程
  • copyright 2024編程學習大全網