School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!
You're Browsing As A Guest! Register Now...
Become an Expert!

Join 353,887 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 3,177 people online right now.Registration is fast and FREE... Join Now!



Array selection sort in c#

52 Weeks of Code Challenge: WPF
Week #10 of the 52 Weeks of Code Challenge is WPF. If you're a .NET programmer, you should give it a shot. Click Here!

Array selection sort in c# sorting numbers with arrays Rate Topic: -----

#1 Kratos61  Icon User is offline

  • D.I.C Head
  • PipPip

Reputation: 0
  • View blog
  • Posts: 58
  • Joined: 31-October 09


Dream Kudos: 0

Posted 04 November 2009 - 08:36 AM

Here is my problem:
I need to create a program that will ask the user to enter in the number of values they would like created. The computer then randomly creates that many numbers between 1 and 99 (reapeats are allowed). These numbers are saved in an array and placed in a listbox. Then pass the array to a function and sort the array by using the above algorithm. When it is complete the function returns an array and is placed back into the listbox again. i have posted an example of how the program should be.

Attached File(s)


Was This Post Helpful? 0
  • +
  • -


#2 Grapevine  Icon User is offline

  • D.I.C Head
  • PipPip

Reputation: 2
  • View blog
  • Posts: 55
  • Joined: 26-October 09


Dream Kudos: 0

Re: Array selection sort in c#

Posted 04 November 2009 - 08:50 AM

Have you actually began writing this program? Im not sure you will receive much help here unless you show some kind of effort...

Later
Was This Post Helpful? 0
  • +
  • -

#3 Kratos61  Icon User is offline

  • D.I.C Head
  • PipPip

Reputation: 0
  • View blog
  • Posts: 58
  • Joined: 31-October 09


Dream Kudos: 0

Re: Array selection sort in c#

Posted 13 November 2009 - 09:50 PM

Here is what I have so far
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ArraySelectionSort
{
	public partial class frmArraySelectionSort : Form
	{
		public frmArraySelectionSort()
		{
			InitializeComponent();
		}

		private void btnCreateArray_Click(object sender, EventArgs e)
		{
			// generate the array
			int SizeOfTheArray;
			int 1darray; 
			Random randomNumberGenerator = new Random();
			int aRandomNumber;
			string aPieceOfText = null;

			SizeOfTheArray = Convert.ToInt16(this.numudValues.Value);
			

			// declare the array
			int[,] a2DArray = new int[SizeOfTheArray];

			for (int widthCounter = 0; widthCounter < SizeOfTheArray; widthCounter++)
			{
				
				{
					aRandomNumber = randomNumberGenerator.Next(0, 9+1);
					a1DArray[widthCounter] = aRandomNumber;
					aPieceOfText = aPieceOfText + " " + aRandomNumber;
				}
				aPieceOfText = aPieceOfText + "\r" + "\n";
			}

			this.lstbArray.Text = aPieceOfText;

		}
		}
	}



I got most of this code from an other program that makes 2d arrays (the user puts in the length and width of a rectangle and the program makes a rectangle with the length and width out of random numbers)
My program is supposed to make a line of random numbers. that line is as long as the user wants.
Can you tell me what im doing wrong, and what parts I still need to change?
Was This Post Helpful? 0
  • +
  • -



Fast Reply

  

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month