Reading a book about C#. (newbie question)

Status
Not open for further replies.
Thanks for that. Funny I was just reading about escape sequences the other day. It's where my bookmark is right now!

Has a list of them:

\'
\"
\\
\0
\a
\b
\f
etc etc....

Guess it's the same in Java as \t is horizontal tab
 
What part of it?

edit: Oh, I put "result double = 0;"

Yes, there was that. There is also your while loop. You've made it better but I don't think you want that semicolon there. You should also consider using String.format here System.out.println("The result of your addition was "+result+". \n");


My lazy attempt at this example essentially places the user in an infinite loop allowing them to specify very large positive or negative numbers to be added to a running total, hitting enter displays the running total as it stands.

Code:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import javax.swing.JOptionPane;
import java.math.*;

public class Main {

    public static void main(String[] args) {
        try
        {
            BigDecimal accumulatedTotal = new BigDecimal(0);
            int i = 1;
            BufferedReader buff = new BufferedReader(new InputStreamReader(System.in));
            while(true)
            {
                try
                {
                    System.out.print(String.format("Enter value %d here (hit enter to see current total): ", i));
                    BigDecimal inputVal = new BigDecimal(buff.readLine());
                    accumulatedTotal = accumulatedTotal.add(inputVal);
                    i++;
                }
                catch (NumberFormatException ex)
                {
                    System.out.println(accumulatedTotal.toString());
                }
            }
        }
        catch (IOException ex)
        {
            JOptionPane.showMessageDialog(null, "Oh Dear");
            ex.printStackTrace();
        }
    }

}
 
I think C# is more complex because it lacks a real open-source community or an inviting active community. I mean if you take a look at forums, then you will see that there is always an abundance of people who know Java. How many know C#?
I don't think an open source community has any impact on whether a language is complex or not. As for forums, people who are using Microsoft languages typically frequent the MSDN forums rather than general programming forums like this one.

To get a better feel for which languages are most popular in industry, do a job search (Monster.com, Dice.com) using the language as a keyword. There are quite a few C# jobs as well as Java jobs.
 
I don't think an open source community has any impact on whether a language is complex or not. As for forums, people who are using Microsoft languages typically frequent the MSDN forums rather than general programming forums like this one.

To get a better feel for which languages are most popular in industry, do a job search (Monster.com, Dice.com) using the language as a keyword. There are quite a few C# jobs as well as Java jobs.

I guess you're right. It must be my bias that leads me to believe that C# is more complex.
 
Good idea about hitting the job boards and doing some searches on each langauge. If there is no jobs using a certain language then it could be a complete waste of time learning it.
 
Status
Not open for further replies.
Back
Top Bottom