לפניך התוכנית הבאה.
לפניך התוכנית הבאה.
public class Ex
{
public static int[] Secret(char[] data)
{
int[] temp = new int[26];
for (int i = 0; i < temp.Length; i++)
temp[i] = 0;
for (int k = 0; k < data.Length; k++)
{
int ind = (int)data[k] - 65;
temp[ind]++;
}
return temp;
}
public static void Main(string[] args)
{
char[] let={'A','F','B','B','F','K','A','A','D','F'};
int[] res = Secret(let);
for (int i = 0; i < res.Length; i++)
{
int t = res[i];
if (t > 0)
{
int code = i + 65;
char ch = (char)code;
for (int k = 1; k <= t; k++)
Console.Write(ch);
Console.WriteLine();
}
}
}
}
סעיף א
עקוב אחרי ביצוע התוכנית ורשום מה יהיה הפלט. הערה: יש להציג מערך res אחרי ביצוע הזימון int[] res = secret(let);
סעיף ב
מה מבצעת הפעולה באופן כללי (מה יהיה פלט הפעולה עבור כל מערך תווים שכולל רק תווים A-Z)?
שאלות ותגובות על השאלה
🎓 לא הבנתם משהו? קבלו הסבר נוסף ממרצה לתכנות
שאלו כאן — ותקבלו מענה מוסמך.