C#

help

Root Question Message

daniel111/20/2022
❔ for is tough

On sports day, the students compete in the high jump.

Write a program that accepts as input the name of each student and the result of their jump.

The output of the program is the name of the student who jumped the highest and his jump result, the name of the student who jumped the lowest and his jump result, and the difference between the two jumps.
daniel111/20/2022
i dont know
daniel111/20/2022
i am strugling to understend how i apply the name at the end
daniel111/20/2022
next to the max and min height
daniel111/20/2022
can you tell me how i do that ?
daniel111/20/2022
hello ?
daniel111/20/2022
class Program
{
static void Main(string[] args)
{
string name;
double height, maxheight, minheight;
for (int i = 1; i <= 20; i++)
{
maxheight = height;
minheight = height;
if (height > maxheight)
{
maxheight = height;
}
if (height < minheight)
{
height = minheight;
}
}

}
}
}
daniel111/20/2022
so far i did this
daniel111/20/2022
i am cluless as to how to go from here can you please explain to me what i need to do
daniel111/20/2022
yeah but they have to be the names of the ones that scored the higest numbers and the smallest numbers
daniel111/20/2022
also
daniel111/20/2022
why is it that i always get minum height= 0
daniel111/20/2022
so what should i do
daniel111/20/2022
do i remove the 0
daniel111/20/2022
i removed the 0 its still giving me zero as a result
daniel111/20/2022
so all i have to do is type in midnight=99999
daniel111/20/2022
that dosent work ethir
daniel111/20/2022
i recived a minheight equals 99999 at the end
daniel111/20/2022
for some reson the if dosent work
daniel111/20/2022
what do you mean
daniel111/20/2022
the program is supposed to give me the smallest and bigest number
daniel111/20/2022
but insted it gave me what i typed in as minhiehgt at the start
daniel111/20/2022
i would not say not working rather not doing its job and its the if thats supposed to carry out the minheight job
daniel111/20/2022
daniel111/20/2022
static void Main(string[] args)
{
string name;
double height, maxheight = 0, minheight=0;

for (int i = 1; i <= 4; i++)

{

if (height > maxheight)
{
maxheight = height;
}
if (height < minheight)
{
height = minheight;

}
}
Console.WriteLine("the highest jump was=" + maxheight);
Console.WriteLine("the lowest jump was=" + minheight);

}
}
}
daniel111/20/2022
what
daniel111/20/2022
does that mean
daniel111/20/2022
what does math.clamp do
daniel111/20/2022
public static void Main()
{

double max = height;
double min = height;

for (int i = 2; i <= 10; i++)

{

if (height > max)
{
max = height;
}
if (height < min)
{
height = min;

}
}
Console.WriteLine("the highest jump was=" + max);
Console.WriteLine("the lowest jump was=" + min);

}
}
}
daniel111/20/2022
for some reson
daniel111/20/2022
only if i remove the string name and everything related to the name
daniel111/20/2022
the program actuly funcations
Samarichitane11/20/2022
0 for minimum value
Samarichitane11/20/2022
25 is maximum value
Samarichitane11/20/2022
30 is actual value
Samarichitane11/20/2022
if it exceeds those values it'll clamp up to closer limit
Samarichitane11/20/2022