GP32 Is It Me Or Is C++ Very Mathimatically Intensive?


gp32rich

Never been accused of being subtle
Joined
Nov 16, 2003
Messages
840
Location
dev heck!
Website
www.geocities.com
pea posted on Oct 15 2005 at 10:09 PM said:
Not really true. As soon as you use a single variable, you are already using algebra. Assigning a value to an arbitrary label is part of algebra, i.e:
a = 5;

so you can't really get away from it.
Not exactly true (at least, in my head ;) )

a=5 is shorthand for the programmatic statement assign the value of 5 to the memory specified by the name a

Just because it looks a bit like maths doesn't mean that it is, that's just a historical curiosity because early computer scientist were .. scientists & mathematicians <_<

The more you want to do with a program the more maths you'll find yourself using, working out where you want an image to be placed, for example
It's only as hard as you want it to be.

But you *could* write something like a text adventure with no maths involved -- a simple one .. go here, pick this up, avoid that, put it there, you win! :p

Jeez Pea! Are you trying to scare them away?
 
Last edited by a moderator:

reaper79

Rectum? Damn near killed ''em!
Joined
Apr 20, 2005
Messages
618
Location
Ohio, US
Website
www.sentient-puddle.com
Hanz™ posted on Oct 15 2005 at 11:46 PM said:
I hate pointers. And nested loops. :angry: :p

No no... threads. Threads is where your hatred should lie. I HATE threads... and semaphores. :angry:
 
Last edited by a moderator:

iignotus

The one and only
Joined
Aug 18, 2005
Messages
2,719
Website
gp2xdev.no-ip.org
gp32rich posted on Oct 16 2005 at 04:16 AM said:
pea posted on Oct 15 2005 at 10:09 PM said:
Not really true. As soon as you use a single variable, you are already using algebra. Assigning a value to an arbitrary label is part of algebra, i.e:
a = 5;

so you can't really get away from it.
Not exactly true (at least, in my head ;) )

a=5 is shorthand for the programmatic statement assign the value of 5 to the memory specified by the name a

Just because it looks a bit like maths doesn't mean that it is, that's just a historical curiosity because early computer scientist were .. scientists & mathematicians <_<

The more you want to do with a program the more maths you'll find yourself using, working out where you want an image to be placed, for example
It's only as hard as you want it to be.

But you *could* write something like a text adventure with no maths involved -- a simple one .. go here, pick this up, avoid that, put it there, you win! :p

Jeez Pea! Are you trying to scare them away?
No, it is math, plain and simple. It's not a coincidence or a happenstance. And I would pray to all that is holy that computer scientists are still scientists and mathematicians <_< You cannot write any programs beyond a "Hello, World" level of extraordinary simplicity without using math.
 
Last edited by a moderator:

gp32rich

Never been accused of being subtle
Joined
Nov 16, 2003
Messages
840
Location
dev heck!
Website
www.geocities.com
iignotus posted on Oct 16 2005 at 03:34 PM said:
No, it is math, plain and simple. It's not a coincidence or a happenstance. And I would pray to all that is holy that computer scientists are still scientists and mathematicians <_< You cannot write any programs beyond a "Hello, World" level of extraordinary simplicity without using math.
Mathematics is the study of the relationships of numbers.
Programming is the sequencing of discrete steps towards a goal, and is more akin to logic (Encarta: Logic(5):the relationship between specific events, situations, or objects, and the inevitable consequences of their interaction)

I use maths to help create the program
The program is not maths

Here's a long discussion about it...
http://c2.com/cgi/wiki?IsProgrammingMath
and ...?ProgrammingIsMath and ...?ProgrammingIsMathDiscussion

Next you'll be telling me I'm doing physics to brew a cuppa <_<
It might *need* physics, but it isn't physics (or maths :rolleyes: )
 
Last edited by a moderator:

Hanz™

FIGHT THE POWER! :D
Joined
Nov 29, 2004
Messages
2,577
Age
35
Location
fan
Website
Visit site
reaper79 posted on Oct 16 2005 at 02:56 PM said:
Hanz™ posted on Oct 15 2005 at 11:46 PM said:
I hate pointers. And nested loops. :angry: :p

No no... threads. Threads is where your hatred should lie. I HATE threads... and semaphores. :angry:
Thankfully I stopped before I got onto them. I am learning Java at University now, and it is ridiculously easy.
 
Last edited by a moderator:

Ranma13

Member
Joined
May 1, 2003
Messages
217
If you're going to make a simple program, then you only really need maybe at max algebra 2. If you're going to do more complex stuff though, say, design a game engine or do anything that involves graphical manipulation, be prepared to get very familiar with matrixes and possibly calculus.
 

drocon

Still Fresh
Joined
May 23, 2005
Messages
33
seriously, NO OTHER book beats k&r's "Programming in C" (THE makers of the language http://home.student.uu.se/mali9233/The%20C...uage/kandr.html
). although it's not cpp, and doesn't explain oop (or that ugly hungarian notation), it's absolutely the best book to learn the versatility of the language, and it 100% cuts out any bullshit filler.

for example, the first time i read k&r, their explanation of the "for" - although i had already used it countless times before - really opened my mind at just how flexible the language was:

The for statement

  for (expr1; expr2; expr3)
      statement
is equivalent to

  expr1;
  while (expr2) {
      statement
      expr3;
  }

they were expressions - standalone statements! not a rubric most other junk books teach - for(start;end;increment), this isn't TI-BASIC guys.

so comes fun statements like,

void reverse(char* s)
    int c, i, j;
    for (i = 0, j = strlen(s)-1; i < j; i++, j--)
          c = s, s = s[j], s[j] = c;
}


it doesn't hurt to learn c, and then transition to oop (if it's ever needed). plus k&r code (minus their function declarations) look so much better than the mix-mash hungarian mess.

just my 2 cents.
 

codesmith

Member
Joined
Sep 19, 2004
Messages
151
Age
51
Location
Northwest USA
Website
Visit site
drocon posted on Oct 17 2005 at 12:11 AM said:
seriously at NO OTHER book beats k&r's "Programming in C" (THE makers of the language http://home.student.uu.se/mali9233/The%20C...uage/kandr.html
). although it's not cpp, and doesn't explain oop (or that ugly hungarian notation), it's absolutely the best book to learn the versatility of the language, and it 100% cuts out any bullshit filler.

for example, the first time i read k&r, their explanation of the "for" - although i had already used it countless times before - really opened my mind at just how flexible the language was:

The for statement

   for (expr1; expr2; expr3)
       statement
is equivalent to

   expr1;
   while (expr2) {
       statement
       expr3;
   }

they were expressions - standalone statements! not a rubric most other junk books teach - for(start;end;increment), this isn't TI-BASIC guys.

so comes fun statements like,

void reverse(char* s)
    int c, i, j;
    for (i = 0, j = strlen(s)-1; i < j; i++, j--)
           c = s, s = s[j], s[j] = c;
}


it doesn't hurt to learn c, and then transition to oop (if it's ever needed). plus k&r code (minus their function declarations) look so much better than the mix-mash hungarian mess.

just my 2 cents.

Yeah, C has a few of those little tricks, like
Code:
if (c)
{
  statement
}
being equal to

Code:
if (c != 0)
{
  statement
}
I wouldn't worry about Hungarian notation (you mean things like lpszMyString?), that's just a (very lame) attempt at improving the readability of the code by encoding the type into the variable name. It's 100% optional, because C doesn't actually use the name of the variable to infer its type, that's what you have declarations for. Hungarian notation is supposed to be for the benefit of humans reading the code, and C already has something to handle that, it's called code comments. I've always suspected that Charles Simonyi (the genius we have to thank for this enlightened way of naming variables) was a big fan of Fortran, because in that language the variable's name does encode the type (that's where the practice of using "i" as a loop counter variable comes from, incidentally - in Fortran, variables with names that start with an "i", including just "i" itself, are integers).
 
Last edited by a moderator:

Hanz™

FIGHT THE POWER! :D
Joined
Nov 29, 2004
Messages
2,577
Age
35
Location
fan
Website
Visit site
BBTroll posted on Oct 17 2005 at 12:51 AM said:
Hanz™: yeah... too bad it will eat memory like no other.
Yeah, I know. I plan to do a full circle though, surprisingly C++ is not that different from Java, so when I look back at my C++ notes it all seems really really easy. (Apart from pointers) ;)
 
Last edited by a moderator:

pea

developer
Joined
Oct 3, 2004
Messages
1,089
Age
44
Location
New Zealand
Website
www.projectitis.com
I use maths to help create the program
The program is not maths

[...]

Next you'll be telling me I'm doing physics to brew a cuppa
It might *need* physics, but it isn't physics (or maths  )

The point in contest is 'Do I need to know math to program'.

So I guess the answer is no.
Unless you need to do anything even slightly usefull.
But even then you can copy and paste without knowing what you are doing :)

Comparing not knowing physics and brewing a cuppa is a bit far fetched -
Its like comparing not knowing Maths and creating a SEUCC game!
 
Top