Programming Fundamental.
วันศุกร์ที่ 14 พฤศจิกายน พ.ศ. 2557
Count_char
void setup() {
println(count_char('a', "camera"));
}
int count_char(char word, String sentence) {
int totalChar = 0;
for (int i =0; i<sentence.length (); i++) {
if (word == sentence.charAt(i)) {
totalChar = totalChar + 1;
}
}
return totalChar;
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น
บทความใหม่กว่า
บทความที่เก่ากว่า
หน้าแรก
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
ไม่มีความคิดเห็น:
แสดงความคิดเห็น