Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Need help with an if statement, C#

Name: CQM !/auuwDkYr. 2012-01-02 20:17

As the title implies, I'm writing a pretty basic program to explore some of what I know.

It's a simple morse translator in C#, my question arises around this last issue I have with it.  I'm in the process of writing the converter from Morse to English

http://pastebin.com/VUCwtF0j

Line 273 is where the error occurs.  C# Express is telling me I'm trying to implicitly convert from string to a bool, anyone mind helping me with a different way to do this?

Name: CQM !/auuwDkYr. 2012-01-02 20:22

The second error is as follows:

The left-hand side of an assignment must be a variable, property or indexer

Name: Anonymous 2012-01-02 20:24

use ==

Name: CQM !/auuwDkYr. 2012-01-02 20:27

Wow, I feel stupid

Name: Anonymous 2012-01-02 20:58

Is a bit of a silly mistake, but i think you'll live =)

pretty sure everyone who uses C/#/++ has done that at least twice ;)

Wonder if you could find a way to make it simpler // 400 lines of code is quite large, but otherwise it's good =)

Name: Anonymous 2012-01-02 21:16

Morse-code you say? This video showcases using Emacs and SLIME to write such a trivial morse-code conversion utility(mostly to demonstrate SLIME's functionality): http://common-lisp.net/project/movies/movies/slime.mov

Name: CQM !/auuwDkYr. 2012-01-02 21:33

>>5

A lot of it is spacing and the switch statements.  I'm learning on my own without classes, so I'm certain there are better ways, just wanted to put some of my knowledge to use

Name: Anonymous 2012-01-03 0:12

That is actually a nice program, with some good ideas I actually never tried to use (specifically the Clipboard stuff).

Try to put yourself a challenge later, like making it in less than 300 lines, or doing a basic GUI for it.

I think the string concatenation you are doing is considered harmful, so get a basic grab of how the String class works and try to do the same thing using it instead of the "+=", for example. It'll be good to expand a little your knowledge of the language and the framework. Also, you'll find MUCH MORE ENTERPRISE verbose crap around in a few months, so try to not be afraid.

Name: CQM !/auuwDkYr. 2012-01-03 0:47

>>8

I finished the program with full translation capability, came out to 11KB compiled.

http://www.mediafire.com/?eqf07qbeg158rtp

Here's the compiled copy, I'll post source in a few, cleaning it up a little right now.  It's 472 lines total

Name: CQM !/auuwDkYr. 2012-01-03 1:25

http://pastebin.com/9uYWeG1b

Alright, here's the final paste.  Complete program and fully functional

Name: Anonymous 2012-01-03 2:03

>>10
Use a map instead of switches.

Name: Anonymous 2012-01-03 2:21

>>11
Not sure how to use dictionaries, yet

Name: Anonymous 2012-01-03 2:23

>>12
Get to it then.

Don't change these.
Name: Email:
Entire Thread Thread List