01-01-2012, 05:22 AM
|
#4
|
تاريخ التسجيل: Jan 2010
التخصص: computer sciences
نوع الدراسة: إنتظام
المستوى: الخامس
الجنس: ذكر
المشاركات: 26
|
رد: تصحيح كود
السلام عليكم ورحمه الله وبركاته
عندي سوال للي هو برنامج يحسب كم عدد حروف العله في الكلمه
وانا كتبتوب بس فيلو غلط
كود:
public class count{
public int CountnumbersOfVowelsPerRow (String[]a) {
int count=0;
size=a.length;
for(int i=0;i<size;i++){
if(a[i]='a' || a[i]='e' || a[i]='i' || a[i]='o' || a[i]='u' || a[i]='y')
count=count+1;
return count;
}
System.out.println("the vowels is =" count)
}
public static void main(String[]s){
Count Count1=new Count
String []data={"","gfgf"}
}
int temp=count_numbers_Of_vowels_Per_Row1.countnumbersOfVowelsPerRow(data,3);
System.out.println(temp);
}
}
|
والله أنا حليته بطريقة مختلفه شوي أتمنى تفيدك رغم إنها متاخرة بس للفائدة هههه
كود:
import java.util.Scanner;
public class count {
public static int Count(String a) {
int count=0;
int x;
String vowels[]={"i","a","o","u","e"};//vowels LTTER ARRAY
for(int i=0;i<vowels.length;i++){ // Searching for vowels LETTER
x=a.indexOf(vowels[i]);
if (x!=-1){ // because the if letter found will return letter index in the Input String OR will return "-1"
count=count+1;
}
}
return count;
}
public static void main(String[]s){
Scanner input=new Scanner(System.in);//reading from the user
String name=input.next();
String toLowerCase = name.toLowerCase(); //to don't care about Upper and Lower case I change it to Lower U can Change it to Upper and change the LETTER ARRAY in the method to Upprt
System.out.println("the vowels is ="+Count(toLowerCase));
}}
|
|
الحب الحقيقي هو الحب الذي يجمع روحين لتكون روحا واحده، الحب ماهو الا تضحيه وفاء وامان، الحب هو الشوق واللهفه، هو سكون الحبيب المؤبد بقلب محبوبه، الحب هو نقش صورة المحبوب في العين، الحب هو التغاضي عن عيوب المحبوب وتقبله كما هو، الحب هو ان تنسى العالم وتتذكر من تحبه، الحب:> قدر ياتي من نظره ولكن الحب الحقيقي ياتي مع العشره
|
|
|
|