How do i print out symbols like:
[
|
&
#
/
\
*
^
(
)
_
<
>
I need to output these symbols in a program that converts english to leet.
Also how to do get a character from the user?
Leet program
Page 1 of 18 Replies - 1879 Views - Last Post: 05 October 2010 - 11:35 AM
Replies To: Leet program
#2
Re: Leet program
Posted 05 October 2010 - 03:17 AM
Before you take on a project, you should really know the basics about the language you are undertaking it in. In this case, you should learn Java's I/O and basic control structures. Then you can start on a project and get decently far or maybe even finish it!
#3
Re: Leet program
Posted 05 October 2010 - 06:49 AM
You can use System.out.print() and System.out.println() to output text, and you can use the Scanner class to get input. Note that Scanner cannot read in individual characters, so you will have to parse the String you read in.
#4
Re: Leet program
Posted 05 October 2010 - 11:16 AM
Yes I know how to output normal text just not characters. I have looked in our textbook, online, and listened during lectures but he has never explicitly told us how to output symbols like the ones up top. I am not asking you to do my homework because it involves using a switch statement to output the correct symbols. I just want to know how to output symbols like the ones up top. I know the basic output structure but I cannot find how to output symbols like you see up top. If I could have found it elsewhere I wouldn't be asking someone how to do it. I don't agree with cheating or using other people's code I am simply asking you how to output special characters. If you can help and tell me how to output these characters that would be great. I know for some of them you just put them twice and for others you put a \ in front of it but these are the only characters I can't find elsewhere. If you can help then great if you are going to assume that I am using this awesome forum for cheating please don't post because it is not worth your time.
#5
Re: Leet program
Posted 05 October 2010 - 11:20 AM
Everyone will print normally as long as they are in quotes. except the \ cause that is used as an escape sequence. just google that
#6
Re: Leet program
Posted 05 October 2010 - 11:26 AM
ok so how would I output the \? if i use it twice the rest of the line will be takin as a comment correct? also what about the { and }? won't those end the main function?
#7
Re: Leet program
Posted 05 October 2010 - 11:29 AM
The only character you have to worry about escaping is \, and you escape it by doing \\. Otherwise, you just print out the character normally. 
System.out.println("\\"); //output: \
System.out.println("#"); //output: #
System.out.println("/"); //output: /
#8
Re: Leet program
Posted 05 October 2010 - 11:31 AM
nope. if it is in the print line method it wont because it makes it a psuedo string. Java refrence sheet and try that
#9
Re: Leet program
Posted 05 October 2010 - 11:35 AM
Which one are you referring to? \\ escapes the \ character, so the " isn't then escaped.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote







|