8 Replies - 2353 Views - Last Post: 05 October 2010 - 11:35 AM Rate Topic: -----

#1 jpfluege  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 33
  • Joined: 05-November 09

Leet program

Posted 04 October 2010 - 10:35 PM

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?
Is This A Good Question/Topic? 0
  • +

Replies To: Leet program

#2 C++ Programmer  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 20
  • View blog
  • Posts: 548
  • Joined: 12-June 08

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!
Was This Post Helpful? 0
  • +
  • -

#3 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10596
  • View blog
  • Posts: 39,259
  • Joined: 27-December 08

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.
Was This Post Helpful? 0
  • +
  • -

#4 jpfluege  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 33
  • Joined: 05-November 09

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.
Was This Post Helpful? 0
  • +
  • -

#5 Agentsnakezero  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 34
  • Joined: 28-September 10

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
Was This Post Helpful? 0
  • +
  • -

#6 jpfluege  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 33
  • Joined: 05-November 09

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?
Was This Post Helpful? 0
  • +
  • -

#7 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10596
  • View blog
  • Posts: 39,259
  • Joined: 27-December 08

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: /


Was This Post Helpful? 0
  • +
  • -

#8 Agentsnakezero  Icon User is offline

  • New D.I.C Head

Reputation: 4
  • View blog
  • Posts: 34
  • Joined: 28-September 10

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
Was This Post Helpful? 0
  • +
  • -

#9 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10596
  • View blog
  • Posts: 39,259
  • Joined: 27-December 08

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.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1