Results 1 to 2 of 2
  1. #1
    sharadjain is offline Member
    Join Date
    Aug 2014
    Posts
    4
    Rep Power
    0

    Default I have to find the ASCII no. of names entered.

    hiiiiiii, i am having a problem with SD array .i have to find the ASCII no. of names entered.





    import java .io.*;
    class ASCII
    {
    public static void main()throws IOException
    {
    InputStreamReader read = new InputStreamReader(System.in);
    BufferedReader br = new BufferedReader(read);
    String st[] = new String[2];

    int ar[] = new int[2];
    int length[] = new int[2];
    int i,j,k,l;
    System.out.println("enter the name");
    for(i=0;i<2;i++)
    {
    st[i]=br.readLine();//to take input
    }
    for(j=0;j<2;j++)//loop for name
    {
    length[j]=st[j].length();
    for(k=0;k<length[j];k++)//loop for char
    {
    char ch1[]=new char[k+1];
    ch1[k]=st[j].charAt(k);
    ar[k]=(int)ch1[k];
    System.out.println(ar[k]);
    }}}}

  2. #2
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    13

    Default Re: I have to find the ASCII no. of names entered.

    Do you want to count the number of names entered? Also, please wrap your code in [code][/code] tags.

    regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. Want to ensure that only a word is entered?
    By Denis2k11 in forum New To Java
    Replies: 3
    Last Post: 03-24-2013, 04:24 PM
  2. help - Ascii to hex and hex to ascii conversion
    By rjagan in forum New To Java
    Replies: 8
    Last Post: 06-14-2011, 12:53 PM
  3. Read a single character entered
    By mcmb03 in forum New To Java
    Replies: 2
    Last Post: 01-31-2010, 10:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •