| | |
C# function for sort
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2008
Posts: 12
Reputation:
Solved Threads: 0
i need a program than can be ask user : name , age , id , and salary
then shows me the maximum salary and minimum salary
and then sort salary from maximum to minimum .
please complete these program for me
}
then shows me the maximum salary and minimum salary
and then sort salary from maximum to minimum .
please complete these program for me
C# Syntax (Toggle Plain Text)
public string name;a public int age; public bool ID; private int salary; public void Staff() { Console.WriteLine("enter your name"); name = Console.ReadLine(); Console.WriteLine("enter your age : "); age = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("enter your ID:"); ID = Console.ReadLine(); Console.WriteLine("enter your salary:"); income = Convert.ToInt32(Console.ReadLine());
You can read either in LINQ or ArrayList, in your case I prefer to read in ArrayList.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Give us hint you tried, if you declare instance from ArrayList class and pressed '.' you'll find someone much greater than us with all respect to my friend Ddanbe. it's intellisense and documentation.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
•
•
Join Date: Aug 2008
Posts: 1,735
Reputation:
Solved Threads: 186
have a look in the helpfile as to try, and then show us your code, and the errors and/or explain in what way it hadnt done what you wanted..
Then we will help
Then we will help
Did I just hear "You gotta help us, Doc. We've tried nothin' and we're all out of ideas" ? Is this you? Dont let this be you! I will put in as much effort as you seem to.
•
•
Join Date: Dec 2008
Posts: 12
Reputation:
Solved Threads: 0
this is my confused program and it dose not as well . it sort some of character from min to max but i want to it sort my salary after the program gives me the salary number
C# Syntax (Toggle Plain Text)
using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication54 { struct human { public string name; public int age; public int ID; private int salary; public void Staff() { Console.WriteLine("enter your name"); name = Console.ReadLine(); Console.WriteLine("enter your age : "); age = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("enter your ID:"); ID = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("enter your salary:"); salary = Convert.ToInt32(Console.ReadLine()); } class Program { static void Main(string[] args) { string[] cArray = new string[5] { "Cha3123", "Cha1234", "Cha1243", "Cha34", "Cha53" }; Array.Sort(cArray, StringComparer); foreach (string s in cArray) { Console.WriteLine(s); } Console.ReadLine(); } static int StringComparer(object a, object b) { int stra = Convert.ToInt32((a as string).Remove(0, 3)); int strb = Convert.ToInt32((b as string).Remove(0, 3)); return stra - strb; } } } }
What's this??
You need to read in Structures as well.
Let us start.
1- I need you do initialize an array of 5 elements from human datatype
You need to read in Structures as well.
Let us start.
1- I need you do initialize an array of 5 elements from human datatype
Last edited by Ramy Mahrous; Dec 31st, 2008 at 8:57 am.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
![]() |
Similar Threads
- 2 arrays, one function..sort of (C++)
- Multidimensional array sort problem (C++)
- How to solve ( Sort a queue )? (C++)
- bubble sort function w/ array (C++)
- Array Struct Sort Help!! Urgent! (C)
- Callback function (C++)
- Sorting arrays of pointers with function? (C)
- Function with pointer? (C++)
Other Threads in the C# Forum
- Previous Thread: GPS.NET Programming
- Next Thread: Reading from pdf
| Thread Tools | Search this Thread |
.net access algorithm array asp.net barchart bitmap box broadcast c# check checkbox client combobox control conversion csharp custom database databaseconnection datagrid datagridview dataset datetime dbconnection degrees design development draganddrop drawing encryption enum event eventhandlers excel file firefox form format forms function gdi+ grantorrevokepermissionthroughc#.net httpwebrequest image index input install java label libraries list listbox loop mandelbrot marshalbyrefobject math mouseclick movingimage mysql mysql.data.client operator path photoshop picturebox pixelinversion platform post programming radians regex remote remoting resourcefile richtextbox server sleep socket sql statistics stream string system.servicemodel table tcpclientchannel text textbox thread time timer update usercontrol validation visualstudio webbrowser windows winforms wpf wpfc# xml






