hello ppl...
am trying 2 make a score table for some game..not doing so gd..
as am coding without knowing whats going on..
explain 2 me like a 5 year old ..cuz this is really hard.. O_o
anyway here's the code..
_______
using System;
using System.Collections;
using System.Linq;
using System.Text;
namespace ManicMailman
{
public class Hiscore
{
static void Main(string[] args)
{
int[] highscores = new int[4];
for (int i = 1; i < 4; i++)
{
highscores[i] = i;
Console.WriteLine(i + "." + highscores[i]);
}
}
private int addScore()
{
int arr, score;
Array.Sort(arr);
if(score > arr[3])
arr[3] = score;
else if (score > arr[2] && score < arr[3])
arr[1] = score;
else if (score > arr[1] && score < arr[2])
arr[1] = score;
for(int i = arr.length-1; i>=0; i--)
{
}
}
}
}
Loading
Kirtan PatelPosted Dec 12, 2009, 5:43 PM
Here is Code that you are ttying to do I have put Comments in code so you can understand easily .
if my answer helps you then please check "Do you like this answer" check box :)
static void Main(string[] args)
{
int[] Scores = new int[4];
// Get Scores From User
for (int i = 0; i < 4; i++)
{
Console.WriteLine("enter Score " + i);
Scores[i] = int.Parse(Console.ReadLine());
}
// Sort the Scores and Show to User
Array.Sort(Scores);
Console.WriteLine("High Scores Are Below ");
Console.WriteLine("---------------------------");
// Print the Scores hiest First so Reverse the Loop 4 to 0
for (int i = 3; i >=0; i--)
{
Console.WriteLine(Scores[i].ToString());
}
//Pause the Screen to Show output
Console.ReadKey();
}
Michelle anPosted Dec 12, 2009, 5:50 PM
this works..!!!
I'd love 2 c other ways as well to this..
but this is perfect thx very much!!! :D