|
As in my immediate response to Zafersava above.
|
|
|
|
|
Angelinna wrote: current.GetType().Equals(this)
For starters, that can NEVER be true.
|
|
|
|
|
Thanks for these websites.
cheers
|
|
|
|
|
namespace ORAANUPI
{
partial class ORAANUPI
{
///
/// Required designer variable.
///
private System.ComponentModel.IContainer components = null;
///
/// Clean up any resources being used.
///
/// <param name="disposing" />true if managed resources should be disposed; otherwise, false.
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.button2 = new System.Windows.Forms.Button();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.button3 = new System.Windows.Forms.Button();
this.listBoxControl1 = new System.Windows.Forms.ListBox();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(155, 247);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(231, 23);
this.button1.TabIndex = 0;
this.button1.Text = "ORAANU PI SORTING - ASCENDING";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(155, 179);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 20);
this.textBox1.TabIndex = 2;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
this.label1.Location = new System.Drawing.Point(78, 185);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(71, 14);
this.label1.TabIndex = 3;
this.label1.Text = "2 - 1.000.000";
//
// button2
//
this.button2.Location = new System.Drawing.Point(261, 176);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(125, 23);
this.button2.TabIndex = 4;
this.button2.Text = "GET NUMBERS";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// progressBar1
//
this.progressBar1.Location = new System.Drawing.Point(155, 216);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(231, 23);
this.progressBar1.TabIndex = 5;
//
// label2
//
this.label2.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
this.label2.ForeColor = System.Drawing.Color.Red;
this.label2.Location = new System.Drawing.Point(392, 170);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(148, 45);
this.label2.TabIndex = 6;
this.label2.Text = "I just ignore the duplicate numbers";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
this.label3.Location = new System.Drawing.Point(523, 298);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(49, 14);
this.label3.TabIndex = 7;
this.label3.Text = "DeLeTe";
//
// button3
//
this.button3.Location = new System.Drawing.Point(155, 274);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(231, 23);
this.button3.TabIndex = 8;
this.button3.Text = "ORAANU PI SORTING - DESCENDING";
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// listBoxControl1
//
this.listBoxControl1.FormattingEnabled = true;
this.listBoxControl1.Location = new System.Drawing.Point(155, 13);
this.listBoxControl1.Name = "listBoxControl1";
this.listBoxControl1.Size = new System.Drawing.Size(231, 147);
this.listBoxControl1.TabIndex = 9;
//
// ORAANUPI
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(570, 309);
this.Controls.Add(this.listBoxControl1);
this.Controls.Add(this.button3);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.progressBar1);
this.Controls.Add(this.button2);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.MaximumSize = new System.Drawing.Size(576, 331);
this.MinimumSize = new System.Drawing.Size(576, 331);
this.Name = "ORAANUPI";
this.Text = "ORAANU PI - E.S. POSTHUMUS";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.ListBox listBoxControl1;
}
}
using System;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace ORAANUPI
{
public partial class ORAANUPI : Form
{
public ORAANUPI()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
long[] arr = new long[maxValue * 10];
for (int i = 0; i <= listBoxControl1.Items.Count - 1; i++)
{
int a = Convert.ToInt32(listBoxControl1.Items[i]);
double b = System.Math.Sqrt(a);
b = b * 10;
int c = (int)b;
arr[c] = a;
}
listBoxControl1.Items.Clear();
for (int i = 0; i <= arr.Length - 1; i++)
{
if (!Convert.ToInt32(arr[i]).Equals(0))
{
listBoxControl1.Items.Add(arr[i]);
}
}
}
int maxValue = 0;
private void button2_Click(object sender, EventArgs e)
{
if (textBox1.Text.Length < 1) return;
foreach (char item in textBox1.Text)
{
if (!char.IsDigit(item))
{
MessageBox.Show("please enter integer value");
textBox1.Text = string.Empty;
return;
}
}
maxValue = Convert.ToInt32(textBox1.Text);
if (maxValue < 2)
{
MessageBox.Show("value must be greater than 1");
textBox1.Text = string.Empty;
return;
}
if (maxValue > 1000000)
{
MessageBox.Show("value must be smaller than 1.000.000");
textBox1.Text = string.Empty;
return;
}
button1.Enabled = false;
button3.Enabled = false;
Application.DoEvents();
listBoxControl1.Items.Clear();
Random rnd = new Random();
//ignore duplicate numbers
progressBar1.Minimum = 0;
progressBar1.Maximum = maxValue;
for (int i = 0; i <= maxValue; i++)
{
Application.DoEvents();
listBoxControl1.Items.Add(rnd.Next(1, maxValue + 1));
progressBar1.Value = i;
}
button1.Enabled = true;
button3.Enabled = true;
Application.DoEvents();
}
private void button3_Click(object sender, EventArgs e)
{
long[] arr = new long[maxValue * 10];
for (int i = 0; i <= listBoxControl1.Items.Count - 1; i++)
{
int a = Convert.ToInt32(listBoxControl1.Items[i]);
double b = System.Math.Sqrt(a);
b = b * 10;
int c = (int)b;
arr[c] = a;
}
listBoxControl1.Items.Clear();
for (int i = arr.Length - 1; i >= 0; i--)
{
if (!Convert.ToInt32(arr[i]).Equals(0))
{
listBoxControl1.Items.Add(arr[i]);
}
}
}
}
}
|
|
|
|
|
Sod off, do you own code reviews. We dont look at stupid code dumps.
|
|
|
|
|
stupid code dumps ha
who do u think you are ?
i'll send you whole project. and others too
|
|
|
|
|
leppie wrote: look at stupid code dump
Was there even a sorting algorithm in that crap heap?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
|
Sorry about the harsh criticism there. No comments, hard to read variable names, makes it a tough code review.
When posting code bits on these CP forums, try to utilize the code block button just above the emoticons. Also, just post the code in question. Not the entire thing. Now, in articles on this site, there is the ability to expand/collapse large code block in articles, I wonder if Chris could add such functionality to the forums as well.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
|
Where is the algorithm man? You have posted the whole code.
Post seriously if you want your questions to be answered seriously.
|
|
|
|
|
http://rapidshare.com/files/143111877/ORAANUPI.zip.html[^]
|
|
|
|
|
Dude no-one will not spend time on checking all your code which you have post.
Post concretely your code which cause problem.
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
i am not codeproject old member just new sorry for problem.
|
|
|
|
|
Despite the fact that you posted your entire project instead of the relevant code, and despite the fact that you didn't put the code in a code block so that it would retain it's formatting, and despite the fact that you didn't write a proper description of what the code is supposed to do, I took a quick look at it.
I didn't find anything that resembles any known form of sorting algorithm.
If you name your variables something that is a bit more descriptive than "a", "b", "c" and "arr", it would help in determining what the code is supposed to do.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
i am sending my all project visual studio 2008 c# project
i told people just help not humliation or stupid reaction.
you can control project thanks.
|
|
|
|
|
|
oraanupi wrote: i told people just help not humliation or stupid reaction.
Dude, as a friendly tip, you need to lighten up. Seriously, just post only your sorting algorithm and give people some kind of idea what it is supposed to do. Have you created test cases? If so, do they work or not. If you haven't created test cases, then you should do that.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
i tested it works
telling you again and no more explanation
yes its look like new things maybe not
i need help. i gave the link get it and check it ok man.
|
|
|
|
|
oraanupi wrote: i gave the link get it and check it ok man
No thanks, I built my own project
It looks like it works. What is it you need check/confirmed? It looks like it sorts, not sure about the efficiency with the loading into a Listbox, and working off the listbox (nice for the visual, though)
Now, time for constructive criticism:
You should really comment the more unclear parts of your code, describing your algorithm. Do think about this, no comments, you walk away from this program and 5 years from now, would you still understand it?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
|
It's nice how you make it generate random numbers and all, but the easiest way to test a sorting algorithm is by unit testing as leppie suggested. Do look into how to do that.
In your unit testing, you'll want to test for the (1) typical case, (2) best case, and (3) the worst case.
You already did the typical case by generating the random numbers. The best case is where you have the following: the list already sorted in ascending order - sort by ascending order - nothing gets sorted - no work done, and repeat in reverse for descending order - have the list already sorted in descending order.
The worse case test is like the best case, however, you test the ascending sort by a list that is already sorted in descending order, and do the reverse for descending.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
You have far too much patience
|
|
|
|
|
I'm actually trying to be nice for once.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
about these cases help me man
first should i remove textbox replace regular array?
|
|
|
|
|