No programming experience, need some guidance choosing language.

Page 3 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.

Luzah

Senior member
Jul 22, 2007
520
0
71
namespace WindowsFormsApplication1

private void btnDivide_Click(object sender, EventArgs e)
{
total1 += total1 / double.Parse(txtDisplay.Text);
txtDisplay.Clear();

theOperator = "/";
}


Found one problem.. the total1 +=.. I took the plus out (not sure why I had it there to begin with), but the equal still doesn't work on anything other than add :(
 

Cogman

Lifer
Sep 19, 2000
10,280
131
106
Found one problem.. the total1 +=.. I took the plus out (not sure why I had it there to begin with), but the equal still doesn't work on anything other than add :(

Ok, so a few questions for you.

What does total1 represent?
When should the addition/division/subtraction occur? When you click the add/divide/subtract button or at some later date?

Try to think through exactly what happens when you click a button, write down what variables store if you have to.
 

Luzah

Senior member
Jul 22, 2007
520
0
71
the total1 represents the first number of the equation. total1 would be 5 + total2 would be 5.. at least, that's how the instructor said to set it up.

the addition/subtraction/etc -should- occur when the equal sign is hit, shouldn't it? I mean, if I am not mistaken that is the concept behind the switch and case right? The switch in this case being theOperator, and each case under the btnEqual area would represent the addition/subtraction/etc.

Ok...now i'm all sorts of confused! LOL.. my brain hurts..haha
 

Cogman

Lifer
Sep 19, 2000
10,280
131
106
the total1 represents the first number of the equation. total1 would be 5 + total2 would be 5.. at least, that's how the instructor said to set it up.
Ok, you'll want to get a better understanding of what what total1 and total2 are representing. I would suggest rereading the text about these variables and get a better understanding of what they store.

the addition/subtraction/etc -should- occur when the equal sign is hit, shouldn't it?
Correct. It can be done a different way, but for now, this is how you should do it. You should know, that you aren't just performing a math operation when the buttons are pushed, rather, you are doing math operations every time a math button is pushed.

In other words, the +,-,*, and / buttons are all doing more than they should.

I mean, if I am not mistaken that is the concept behind the switch and case right? The switch in this case being theOperator, and each case under the btnEqual area would represent the addition/subtraction/etc.

Ok...now i'm all sorts of confused! LOL.. my brain hurts..haha

You are on the right track. Programming, especially in the early stages, will cause all sorts of brain strain.
 

Luzah

Senior member
Jul 22, 2007
520
0
71
Thanks a lot for the guidance Cogman! I've actually been doing the training exercises since midnight, and I think I just need to step back for a few hours and get some rest. Come at my problem with a fresh brain. I will -definitely- look over the variables of total1 and total2, and how they work. It may be something I'm over looking, or need to change since I changed from if...else commands.

Thanks again man! You're the best.

Luzah
 

BogdanH

Member
Feb 20, 2011
33
2
66
To OP
I don't want to be rude, but your atitude is wrong: your only motivation seems to be getting a job as programmer -I think it doesn't work that way. Motivation should be "how stuff works".. If you're curious enough and ready to spend hours per day for learning (for next several years), then picking "right" programming language is trivial.

Just my 2c -after being a hobby programmer for about 30 years (and still learning).
Bogdan
 

Luzah

Senior member
Jul 22, 2007
520
0
71
My attitude isn't wrong, Bog. I -mentioned- that I would like to shoot for a career later on in life (let's be realistic here, and say that I would be stupid NOT to at least -try- for one if I take the time to learn programming), but I also mentioned something about wanting to learn general programming and even dropping vb.net because it felt "dumbed down" to me, and picking up and C# and "having a blast". To be honest, that doesn't sound a whole lot like a career-oriented mind to me but rather me wanting to challenge myself to the best of my ability. I do understand what you're trying to say, and I assure you that a career is not the entire reason I want to pick up programming. College will come way before a career ever will with me :) Thank you for your input!
 

BogdanH

Member
Feb 20, 2011
33
2
66
To Luzah:
I understand now -thanks for taking time to explain. What to say... pick a language and don't give up :)

Bogdan
 

kitchiku

Senior member
Nov 6, 2009
277
1
81
Get a course on C. Once you understand C, you can pretty much do anything else.
 

degibson

Golden Member
Mar 21, 2008
1,389
0
0
Get a course on C. Once you understand C, you can pretty much do anything else.

C is to programming as the Grand Unified Theory is to physics. You can understand some aspects of physics without knowing GUT, e.g., Newtonian motion, but underlying everything is C.

(Ken, please show up now and assert the above, except for s/C/ASM/g) ;)
 

Stuxnet

Diamond Member
Jun 16, 2005
8,392
1
0
I agree that VB.NET is not a good choice. I work with people who cut their teeth on VB and cry when they see a curly brace.

Jump in to C#. Same excellent development tools as VB.NET and less work to get something up and running than Java. Switching between C# and Java is cake.
 

Kyanzes

Golden Member
Aug 26, 2005
1,082
0
76
Whatever you choose make sure you pick up some general programming basics else you could end up like the "experienced" guy who wanted to take a job at our company and did something like this:

if ()
{
if ()
{
}
}

After a few hours he gave up and asked for peer tips.

After this we kind of suspected that he kind of exaggerated regarding his former experience.
 

TridenT

Lifer
Sep 4, 2006
16,800
45
91
C or C++ or Java.

A lot of people recommend Head First books. Just look up Head First C, Head First Java, etc. in Google or at your local library