Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 134 135 [136] 137 138 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 881881 times)

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2025 on: March 22, 2012, 01:32:49 am »

Blame my teacher, I guess. He had us make function prototypes that included the list[] and size variables. This whole exercise seems pretty shoddy, or maybe I'm just confused again.

Well, progress has been made I suppose. Getting rid of list[] and size allowed me to input the integers to be reversed. Sadly, pressing Enter made the program crash.
Logged
Quote from: Max White
And lo! Sirus did drive his mighty party truck unto Vegas, and it was good.

Star Wars: Age of Rebellion OOC Thread

Shadow of the Demon Lord - OOC Thread - IC Thread

fergus

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2026 on: March 22, 2012, 02:17:51 am »

Did you change Getnum() to return readNum aswell? Not doing that might be cause funny problems.
Logged
BY THE GODS! THIS QUOTE MADE MY SIG BOX HAVE A SCROLL BAR! HAPPY DAYS INDEED!
BY THE GODS! YOU HAVE TOO MANY SIGS!

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2027 on: March 22, 2012, 02:44:36 am »

Like this?
Code: [Select]
return readNum;
Logged
Quote from: Max White
And lo! Sirus did drive his mighty party truck unto Vegas, and it was good.

Star Wars: Age of Rebellion OOC Thread

Shadow of the Demon Lord - OOC Thread - IC Thread

fergus

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2028 on: March 22, 2012, 02:52:34 am »

Yes. Could you post all of what you have now?
Logged
BY THE GODS! THIS QUOTE MADE MY SIG BOX HAVE A SCROLL BAR! HAPPY DAYS INDEED!
BY THE GODS! YOU HAVE TOO MANY SIGS!

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2029 on: March 22, 2012, 02:58:18 am »

Not much has changed really, but here ya go:
Spoiler (click to show/hide)
Now shame me with my obliviousness!
Logged
Quote from: Max White
And lo! Sirus did drive his mighty party truck unto Vegas, and it was good.

Star Wars: Age of Rebellion OOC Thread

Shadow of the Demon Lord - OOC Thread - IC Thread

fergus

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2030 on: March 22, 2012, 03:17:23 am »

The parameters in getArray() and printArray() should be swapped around:
Code: [Select]
void getArray(int numbers[MAX_SIZE], int readNum)
void printArray(int numbers[MAX_SIZE], int readNum)
instead of
Code: [Select]
void getArray(int readNum, int numbers[MAX_SIZE])
void printArray(int readNum, int numbers[MAX_SIZE])
Logged
BY THE GODS! THIS QUOTE MADE MY SIG BOX HAVE A SCROLL BAR! HAPPY DAYS INDEED!
BY THE GODS! YOU HAVE TOO MANY SIGS!

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2031 on: March 22, 2012, 03:24:56 am »

...what. WHAT.
It's really that simple? I even thought of that, but dismissed it because it didn't seem to matter D:

Welp, I am officially shamed. Thanks!
Logged
Quote from: Max White
And lo! Sirus did drive his mighty party truck unto Vegas, and it was good.

Star Wars: Age of Rebellion OOC Thread

Shadow of the Demon Lord - OOC Thread - IC Thread

fergus

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2032 on: March 22, 2012, 04:05:05 am »

...what. WHAT.
It's really that simple? I even thought of that, but dismissed it because it didn't seem to matter D:

Welp, I am officially shamed. Thanks!
I'm kind of confused about your compiler, because when I tried compiling your code, both before and after revision, it just threw some errors. Do you know why yours didn't?

Spoiler: Compiler errors (click to show/hide)
Logged
BY THE GODS! THIS QUOTE MADE MY SIG BOX HAVE A SCROLL BAR! HAPPY DAYS INDEED!
BY THE GODS! YOU HAVE TOO MANY SIGS!

Sirus

  • Bay Watcher
  • Resident trucker/goddess/ex-president.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2033 on: March 22, 2012, 06:02:54 pm »

I use Microsoft Visual Basic 2010. The code runs fine both here at home and on the school computers, so I don't know what's up.

I do know one weird thing about VB2010: you can't initialize variables inside for() loops. Other than that I'm not familiar enough with different compilers to troubleshoot.
Logged
Quote from: Max White
And lo! Sirus did drive his mighty party truck unto Vegas, and it was good.

Star Wars: Age of Rebellion OOC Thread

Shadow of the Demon Lord - OOC Thread - IC Thread

MaximumZero

  • Bay Watcher
  • Stare into the abyss.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2034 on: March 22, 2012, 08:25:21 pm »

Does anyone have a simple explanation on what the hell "toString" in java is? There's about 3/4 of a page on it in the book, but it mostly just looks like a compiler threw up on the page. Wat do, B12?
Logged
  
Holy crap, why did I not start watching One Punch Man earlier? This is the best thing.
probably figured an autobiography wouldn't be interesting

MadocComadrin

  • Bay Watcher
  • A mysterious laboratory goblin!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2035 on: March 22, 2012, 08:34:39 pm »

toString is called by various functions (such as System.out's print function) to return a string representation of an object. It is originally defined in the Object class, and since all classes in Java extend object, it is something you should override to represent your own classes.

Code like this: System.out.println("My object: " + myObject);
is equivalent to this: System.out.println("My object: " + myObject.toString());

For example, a Fraction class might have a toString method that returns a string in the form "<numerator>/<denominator>." Eg, creating an object of the Fraction class with 3 as the numerator and 5 as the denominator would have a call to toString return "3/5".

Another example, a class representing a linked list my have toString return a string containing the value of its content's toString method separated by commas.

Logged

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: if self.isCoder(): post() #Programming Thread
« Reply #2036 on: March 22, 2012, 08:37:38 pm »

Does anyone have a simple explanation on what the hell "toString" in java is? There's about 3/4 of a page on it in the book, but it mostly just looks like a compiler threw up on the page. Wat do, B12?

http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/Object.html#toString()

toString is the method of an Object used to convert it into a string. By default it returns the name of the class + '@' + the hash of the object. It can be overridden. If it puked out a page of stuff, it is most likely either overridden or has an overridden hashCode() method that dumps a particularly large hash.

edit: for some reason the html anchor is broken for the toString method.
« Last Edit: March 22, 2012, 08:40:03 pm by Nadaka »
Logged
Take me out to the black, tell them I ain't comin' back...
I don't care cause I'm still free, you can't take the sky from me...

I turned myself into a monster, to fight against the monsters of the world.

DJ

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2037 on: March 25, 2012, 10:03:09 am »

OK, so I've got my DLL thingy working, but I can't debug. I'm using Sprite class from the DLL in the main program. I try placing a breakpoint in the Sprite's constructor, but it tells me "The breakpoint will not currently be hit. No executable code is associated with this line. Possible causes include: preprocessor directives or compiler/linker optimizations." I know that the constructor gets executed because the variables get initialized properly. So how do I debug? Using Visual C++ 2010 Express.
Logged
Urist, President has immigrated to your fortress!
Urist, President mandates the Dwarven Bill of Rights.

Cue magma.
Ah, the Magma Carta...

Nadaka

  • Bay Watcher
    • View Profile
    • http://www.nadaka.us
Re: if self.isCoder(): post() #Programming Thread
« Reply #2038 on: March 25, 2012, 10:18:06 am »

Is the dll project part of the same solution as the project using it? Or just the dll referenced? I recall that visual studio has an option to include source files in a dll when it is built.
Logged
Take me out to the black, tell them I ain't comin' back...
I don't care cause I'm still free, you can't take the sky from me...

I turned myself into a monster, to fight against the monsters of the world.

DJ

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #2039 on: March 25, 2012, 10:20:50 am »

It's in the same solution, I think. At least it shows in the solution explorer.

*edit* NVM, I just had to change the main project's debugger type to mixed.
« Last Edit: March 25, 2012, 10:49:24 am by DJ »
Logged
Urist, President has immigrated to your fortress!
Urist, President mandates the Dwarven Bill of Rights.

Cue magma.
Ah, the Magma Carta...
Pages: 1 ... 134 135 [136] 137 138 ... 796