所以即時通訊創建這個函數必須找到一個字符數組的整數平均值。查找字符數組中的整數平均值
這是我的數組char [] letters = {'A','B','C','D','E','F','G','H','I', 'J'};
我試圖通過類型轉換來找到像A = 32 j = 74這樣的整數平均值。將整數值加回來並將其轉回到一個字符中,但此時卡住了。
/********************************************************************************
This function will calculate the integer average of characters in the array
********************************************************************************/
public static void average(char [] letters)
{
int total = 0;
char mean;
total = total + letters[letters.length];
mean = (char)total/letters.length;
System.out.println("The value is " + average(letters));
}
你是否支持ISO-LATIN-1或Unicode中的重音字符? –
很好使用unicode – javip
你不能在字符中存儲Unicode。 –