I'm doing some self-education in C#, and although I did more complex projects than this, I can't figure out what the problem is.
private void button4_Click(object sender, EventArgs e)
{
int headcount = 0;
int input = Global.inputcount;
for (int i = 0; i < Global.inputcount; i++)
{
if (Global.myTextFile[i] == "F")
{
headcount++;
}
}
float result;
result = headcount/input; <<< that line
button4.Text = result.ToString();
}
This is my code, its supposed to count how many times does F
occour in the myTextFile
array, and it should divide that number with the number of inputs.
I debugged it many times, and everything is fine until [that] line. Result is 0 despite the fact that (headcount = ~2201) and (input = ~4321).
I used to work with pascal, I've been using C# for like 2 months so if anyone can help me out i would be grateful.
F
stands for "Fej" = "Head" in Hungarian