English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

example: // I will enter my name: Jackie Chan, on the cmd(DOS)itself, and then the program will count off the string/letters being entered.
***so it will tell that "there are 10 letters on the string"
//after that, it will count off automatically of the string/value of having the same letters.
***so it will conclude:
J-1
a-2
c-2
k-1
i-1
e-1
h-1
n-1
//after that, it will declare the letter that has the many letters having the same letter.
***so for example, on my given input string,
it will declare that letter a and c has the letters of having many samelike letters.(get's)
// Sorry for my kinda lil bit wrong grammar.

******PLEASE DO HELP ME, AND ELABORATE/EXPLAIN TO ME WELL, HOW DOES IT CYCLES,WORK,AND GOES OF THAT CODE PLEASE!!! I will do appreciate who would help me solve my problem.

2007-07-07 04:57:05 · 3 answers · asked by mjmg 1 in Computers & Internet Programming & Design

3 answers

Assuming you don't have to worry about internationalization, or funny characters, the character counting part can look like this:

============================
int charmap[], counts[];
charmap = new int[256];
// charmap is a map of character
// value to string position where it
// was first encountered
counts = new int[s.length()];
for (int i=0; i char c = s.charAt(i);
if (charmap[c] == 0) charmap[c] = i+1;
counts[charmap[c]-1]++;
}
for (int i=0; i if (counts[i] != 0) System.out.println("" + s.charAt(i) + " - " + counts[i]);
}
=============================

When I run that with the string "s" set to "Jackie Chan", here is the output:

J - 1
a - 2
c - 1
k - 1
i - 1
e - 1
- 1
C - 1
h - 1
n - 1

(Note that 'c' and 'C' are counted separately, and space is also counted. If you want to count all characteres as lowercase or uppercase, convert the case of the string in front of this code. If you want to ignore spaces, add a condition to the final if statement to not print if s.charAt(1) = ' '.)

2007-07-07 09:13:12 · answer #1 · answered by McFate 7 · 0 0

whilst God is first calling you the outcomes could be surprising. Goosebumps are commonly a consequence. in lots of situations as Christians mature they long for the sensation that they had whilst God first spoke back their prayers. Why is this? possibly that's God's way of letting doubters understand he particularly exists. Do you study the Bible? If no longer, or you have and in no way understood it, try returned. that's staggering how God can open your eyes, and you will start to appreciate techniques that appeared foreign places to you before. understand this. God exists. I even have experienced him first hand this form of great form of situations that I no longer have any doubts. he's no longer a fable, no longer in basic terms does he furnish peace into your existence, he supplies eternal existence into your destiny. he's no longer a jailer, he brings freedom to disclaim devil's temptations and the dying he brings.

2016-10-20 04:29:12 · answer #2 · answered by prebor 4 · 0 0

public class Main {
public static void main(String[] args) {
System.out.println(args[0]);
}
}

Save this in a file called "Main.java" and compile it using 'javac Main.java'

Now run it by the command java Main "Jackie Chan"

It will print the name.

I'm sure you can do the rest of the operations on the string yourself. you can access the string by args[0].

2007-07-07 05:35:19 · answer #3 · answered by Samik 1 · 0 0

fedest.com, questions and answers