Click here to Skip to main content
15,888,210 members
Home / Discussions / C#
   

C#

 
GeneralRe: Help [modified] Pin
Angelinna6-Sep-08 0:21
Angelinna6-Sep-08 0:21 
GeneralRe: Help Pin
#realJSOP6-Sep-08 2:02
mve#realJSOP6-Sep-08 2:02 
GeneralRe: Help Pin
Paul Conrad6-Sep-08 5:06
professionalPaul Conrad6-Sep-08 5:06 
AnswerRe: Help Pin
Blue_Boy6-Sep-08 0:03
Blue_Boy6-Sep-08 0:03 
GeneralRe: Help Pin
Angelinna6-Sep-08 0:26
Angelinna6-Sep-08 0:26 
AnswerRe: Help Pin
leppie6-Sep-08 5:44
leppie6-Sep-08 5:44 
GeneralRe: Help Pin
Angelinna6-Sep-08 10:28
Angelinna6-Sep-08 10:28 
Questioni tried to make a sorting algorithms could you check and confirm ? Pin
oraanupi5-Sep-08 20:56
oraanupi5-Sep-08 20:56 
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]);
}
}
}
}
}
AnswerRe: i tried to make a sorting algorithms could you check and confirm ? Pin
leppie5-Sep-08 21:28
leppie5-Sep-08 21:28 
GeneralRe: i tried to make a sorting algorithms could you check and confirm ? Pin
oraanupi6-Sep-08 5:03
oraanupi6-Sep-08 5:03 
GeneralRe: i tried to make a sorting algorithms could you check and confirm ? Pin
Paul Conrad6-Sep-08 5:08
professionalPaul Conrad6-Sep-08 5:08 
GeneralRe: i tried to make a sorting algorithms could you check and confirm ? Pin
oraanupi6-Sep-08 5:29
oraanupi6-Sep-08 5:29 
GeneralRe: i tried to make a sorting algorithms could you check and confirm ? Pin
Paul Conrad6-Sep-08 5:36
professionalPaul Conrad6-Sep-08 5:36 
GeneralRe: i tried to make a sorting algorithms could you check and confirm ? Pin
oraanupi6-Sep-08 5:40
oraanupi6-Sep-08 5:40 
AnswerRe: i tried to make a sorting algorithms could you check and confirm ? Pin
zafersavas5-Sep-08 21:53
zafersavas5-Sep-08 21:53 
GeneralRe: i tried to make a sorting algorithms could you check and confirm ? Pin
oraanupi6-Sep-08 5:32
oraanupi6-Sep-08 5:32 
AnswerRe: i tried to make a sorting algorithms could you check and confirm ? Pin
Blue_Boy6-Sep-08 0:05
Blue_Boy6-Sep-08 0:05 
GeneralRe: i tried to make a sorting algorithms could you check and confirm ? Pin
oraanupi6-Sep-08 5:09
oraanupi6-Sep-08 5:09 
AnswerRe: i tried to make a sorting algorithms could you check and confirm ? Pin
Guffa6-Sep-08 1:41
Guffa6-Sep-08 1:41 
GeneralRe: i tried to make a sorting algorithms could you check and confirm ? Pin
oraanupi6-Sep-08 5:08
oraanupi6-Sep-08 5:08 
GeneralRe: i tried to make a sorting algorithms could you check and confirm ? Pin
oraanupi6-Sep-08 5:08
oraanupi6-Sep-08 5:08 
GeneralRe: i tried to make a sorting algorithms could you check and confirm ? Pin
Paul Conrad6-Sep-08 5:12
professionalPaul Conrad6-Sep-08 5:12 
GeneralRe: i tried to make a sorting algorithms could you check and confirm ? Pin
oraanupi6-Sep-08 5:20
oraanupi6-Sep-08 5:20 
GeneralRe: i tried to make a sorting algorithms could you check and confirm ? Pin
Paul Conrad6-Sep-08 5:31
professionalPaul Conrad6-Sep-08 5:31 
GeneralRe: i tried to make a sorting algorithms could you check and confirm ? Pin
oraanupi6-Sep-08 5:34
oraanupi6-Sep-08 5:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.