Computer Science Canada Trouble compiling program. |
Author: | darknoob [ Wed Mar 29, 2006 8:25 pm ] | ||
Post subject: | Trouble compiling program. | ||
|
Author: | darknoob [ Wed Mar 29, 2006 8:26 pm ] |
Post subject: | |
i donno what is wrong, every time i try to run it it always say error on 'located' |
Author: | HellblazerX [ Wed Mar 29, 2006 8:31 pm ] | ||||||||
Post subject: | |||||||||
the problem is the variable located, but the line before that for the line
you missed a bracket at the end. change it to:
and for the line
you're missing 2 brackets, so change it to:
it should work after that. |
Author: | darknoob [ Wed Mar 29, 2006 8:36 pm ] |
Post subject: | |
hmm...but what should i do? when i run the program, everything (for example 45+44) it always turn out to be 0 what should i do?? |
Author: | person [ Wed Mar 29, 2006 8:39 pm ] |
Post subject: | |
a) indent ur code b) this is almost the exact same code as: http://www.compsci.ca/v2/viewtopic.php?t=11677 c) y dont u read the error message turing gives u? d) tell us wat ur program is supposed to do |
Author: | HellblazerX [ Wed Mar 29, 2006 8:40 pm ] |
Post subject: | |
wut is your program suppose to do? |
Author: | darknoob [ Wed Mar 29, 2006 8:43 pm ] | ||
Post subject: | |||
hmm...i know that guy!!!0_o message says unnamed #1 finished execution, nothing about what is wrong the run window says this when i try to run it
|
Author: | darknoob [ Wed Mar 29, 2006 8:45 pm ] |
Post subject: | |
the program is suppose to read and decode a simple mathematical expression given as a string |
Author: | darknoob [ Wed Mar 29, 2006 8:54 pm ] |
Post subject: | |
i still get 0 after i changed all the stuff |
Author: | HellblazerX [ Wed Mar 29, 2006 8:54 pm ] |
Post subject: | |
in that case, why don't you just use the strint function to convert the String into an int, and perform the operations on the int, instead of getting the ASCII value of the number, and working with those. |
Author: | darknoob [ Wed Mar 29, 2006 8:56 pm ] |
Post subject: | |
hmm...i'm really new at programing >_< just started this year |
Author: | person [ Wed Mar 29, 2006 9:06 pm ] |
Post subject: | |
Try using the debugger menu to find whats wrong |
Author: | darknoob [ Wed Mar 29, 2006 9:09 pm ] |
Post subject: | |
i told u i'm really new to this turing thing and i dont know anything about it, just want to pass computer science and move on @_@ how u use the debug menu...T-T |
Author: | darknoob [ Wed Mar 29, 2006 9:12 pm ] |
Post subject: | |
it says i got error on the second last line...at least that is what i think it says -_- |
Author: | HellblazerX [ Wed Mar 29, 2006 9:19 pm ] | ||
Post subject: | |||
try this code instead:
basically, this code takes in the String input, and divides the String up based on where the operator is, the substring that cannot be converted to int. The first half is the first number, and the second half is the second number, and the operator is recorded. Then, the appropriate operation is performed based on the what operator is used. This code doesnt have any error checking, so its easy to crash if you add in spaces and other stuff |
Author: | darknoob [ Wed Mar 29, 2006 9:20 pm ] |
Post subject: | |
nice thx |
Author: | chrispminis [ Thu Mar 30, 2006 12:03 am ] |
Post subject: | |
Err darknoob dont use it. I'm probly in your class and the assigment said specifically NOT to use predefined Turing functions such as strint or strintok. That's why we spent so many classes emulating the strreal function. There have been a billion topics on this subject, all by people you know, because we are the only school in the world with this assignment right now. |
Author: | MysticVegeta [ Thu Mar 30, 2006 8:54 pm ] |
Post subject: | |
I find this to be pretty dumb. Why would someone block from using predefined fcns? to increase logic/skills? Heck, there are other ways, make them do J4 on CCC lol. Anyways, if you find the topic by chrispminis, you will find how to convert it without using those fcns. |
Author: | person [ Thu Mar 30, 2006 9:19 pm ] |
Post subject: | |
MysticVegeta wrote: Why would someone block from using predefined fcns? to increase logic/skills?
Yes. I don't understand why this would be a bad way of teaching students about concepts. |