Programlama | Programlama Dilleri | C Programlama Dili |C++

Hata
  • XML Parsing Error at 1:82. Error 9: Invalid character
Anasayfa Programlama Java Harf Say?s? Yakalama


Harf Say?s? Yakalama

Java ile yaz?lm?? olan program d??ar?dan al?nan kurall? veya kurals?z bir cmlenin ierisinde bulunan harflerin say?s?n? toplayarak mesaj olarak gstermektedir. String i?lemleri, dizi i?lemleri, char i?lemlerine rnek te?kil eder.

 

  1. import javax.swing.*;
  2. import java.awt.*;
  3. import java.applet.*;
  4. import java.awt.event.*;
  5. /** * * @author NEO */
  6. public class Main {
  7. public static void main(String[] args)
  8. {
  9. String[] alfabe = {"a" , "b" , "c","" , "d" , "e" , "f" , "g","?" , "h" ,"?", "i" , "j" , "k" , "l" , "m" , "n" ,"o" ,"", "p" , "q" , "r" , "s" ,"?", "t" , "u" ,"", "v" , "w" , "x" , "y" , "z" };
  10. char[] add={'b','a','f','d'};
  11. String text = JOptionPane.showInputDialog("Cmle Giriniz");
  12.  
  13. int harf = 0;
  14.  
  15. for (int i=0; i<=text.length()-1; i++)
  16.  
  17.  
  18.  
  19. {
  20. for (int j=0; j<=31; j++)
  21. {
  22.  
  23. String den=text.substring(i,i+1);
  24. if ( den.equals(alfabe[j]))
  25. {
  26. harf++;
  27. }
  28. }
  29. }
  30. JOptionPane.showMessageDialog(null,harf,"harf toplam? sonular?",3);
  31. }
  32. }

Yorumlar (0)
Sadece kayıtlı kullanıcılar yorum yazabilir!
Son Güncelleme ( Cuma, 11 Ocak 2013 00:12 )  
404 Not Found

404

Not Found

The resource requested could not be found on this server!


Proudly powered by LiteSpeed Web Server

Please be advised that LiteSpeed Technologies Inc. is not a web hosting company and, as such, has no control over content found on this site.