It's a code for figuring out how many times a letter is used in a sentence, written by the user( for example: Hi, I am Mark- H-1, i-2, ... so on )
I admit i found the code online and I thought I understood it, but it turns out i really don't, so any help will be appriecieted.
I admit i found the code online and I thought I understood it, but it turns out i really don't, so any help will be appriecieted.
C#:
using System;
namespace LogicalProgram
{
class Program
{
static void Main(string[] args)
{
Console.Write("Vpišite poved : ");
string message = Console.ReadLine();
message = message.Replace(" ", string.Empty);
while (message.Length > 0)
{
Console.Write(message[0] + " : ");
int count = 0;
for (int j = 0; j < message.Length; j++)
{
if (message[0] == message[j])
{
count++;
}
}
Console.WriteLine(count);
message = message.Replace(message[0].ToString(), string.Empty);
}
Console.ReadKey();
}
}
}