Looking for practice material?
Find thousands of free archived packets for practice and study from the Quizbowl Packet Archive!
Huge brain fart
- Jeffrey Hill
- Posts: 6653
- Joined: Fri Apr 30, 2004 12:00 am
- Location: In between the bright lights and the far unlit unknown (aka Johnson County, KS)
- Contact:
Huge brain fart
I spent a good 15-20 minutes trying to figure out why this for loop wouldn't work:
for(int i=0; i++; i<5)
{
//code
}
Talk about forgetting fundamental CS 53... especially when I've been using all sorts of loops several times this year
for(int i=0; i++; i<5)
{
//code
}
Talk about forgetting fundamental CS 53... especially when I've been using all sorts of loops several times this year
-
- Posts: 2416
- Joined: Sat Apr 24, 2004 12:00 am
- Location: MO
Huge brain fart
hahaha, nice one, Jeph.
-
- Posts: 5401
- Joined: Mon Mar 15, 2004 12:00 am
- Location: Gower
- Contact:
Huge brain fart
and I thought my forgetting how to rotate something was bad.
-
- Posts: 2416
- Joined: Sat Apr 24, 2004 12:00 am
- Location: MO
Huge brain fart
yeah, I'm disgusted.
- DeckardCain
- Posts: 4472
- Joined: Mon Feb 09, 2004 12:00 am
- Location: Viburnum, MO
- Contact:
Huge brain fart
Yep, I don't have a clue what that means, which actually makes this post rather pointless.
- Jeffrey Hill
- Posts: 6653
- Joined: Fri Apr 30, 2004 12:00 am
- Location: In between the bright lights and the far unlit unknown (aka Johnson County, KS)
- Contact:
Huge brain fart
Do you have to take CS 74/78 (or is it required for anybody, for that matter or just a science elective for certain majors)?
- DeckardCain
- Posts: 4472
- Joined: Mon Feb 09, 2004 12:00 am
- Location: Viburnum, MO
- Contact:
Huge brain fart
I'll eventually have to take two CS courses.
UMR Math Department wrote:Computer Science (select at least one from each of the following two groups)
( a ) Introduction to Programming (CS 53), Basic Scientific Programming (CS 073) and Computer Programming Laboratory (CS 077), Introduction to Programming Methodology (CS 074) and Programming Methodology Lab (CS 078)
( b ) Data Structures I (CS 153), Discrete Mathematics for Computer Science (CS 158), Introduction to Numerical Methods (CS 228)
- Jeffrey Hill
- Posts: 6653
- Joined: Fri Apr 30, 2004 12:00 am
- Location: In between the bright lights and the far unlit unknown (aka Johnson County, KS)
- Contact:
Huge brain fart
I'm pretty sure I didn't although it's very common for me to do so especially when I'm messing with stringsjcarkeys wrote:You missed a semicolon.
- Jeffrey Hill
- Posts: 6653
- Joined: Fri Apr 30, 2004 12:00 am
- Location: In between the bright lights and the far unlit unknown (aka Johnson County, KS)
- Contact:
Huge brain fart
I was thinking math might require more CS courses than the average department.DeckardCain wrote: I'll eventually have to take two CS courses.
UMR Math Department wrote:Computer Science (select at least one from each of the following two groups)
( a ) Introduction to Programming (CS 53), Basic Scientific Programming (CS 073) and Computer Programming Laboratory (CS 077), Introduction to Programming Methodology (CS 074) and Programming Methodology Lab (CS 078)
( b ) Data Structures I (CS 153), Discrete Mathematics for Computer Science (CS 158), Introduction to Numerical Methods (CS 228)
Huge brain fart
Actually, the only language other than HTML that I have any reasonable grasp with is PHP, so I have no clue about C++ or anything else, that's just one of the things I know I've forgotten and I hear is a common thing in C based languages to forget. It sucks trying to debug hundreds of lines of code then realizing that you missed a semicolon on line 37.ScoBo1987 wrote:I'm pretty sure I didn't although it's very common for me to do so especially when I'm messing with stringsjcarkeys wrote:You missed a semicolon.
- Jeffrey Hill
- Posts: 6653
- Joined: Fri Apr 30, 2004 12:00 am
- Location: In between the bright lights and the far unlit unknown (aka Johnson County, KS)
- Contact:
Huge brain fart
Yeah it's definitely very common especially when you're used to a language that is much much more lenient with syntax. It's really annoying when ONE missing semicolon confuses the compiler so much that it spits out hundreds of lines of errors.
If anybody's interested in my mistake, here's the syntax for a for loop:
for(action before first time, boolean to continue, what to do after each loop through)
{
//code
}
Basically what my code did was initialize i to 0, and then checked "i++" for true/false. Since i++ increments AFTER being used, it evaluated to 0 and thus false and it never entered the loop. If i had been anything else it would have been an infinite loop.
Whereas if written correctly it would have:
i=0
0<5, so do stuff, then increment i to 1
1<5, so do stuff, then increment i to 2
2<5, so do stuff, then increment i to 3
3<5, so do stuff, then increment i to 4
4<5, so do stuff, then increment i to 5
5 not less than 5, so don't loop again and go on
If anybody's interested in my mistake, here's the syntax for a for loop:
for(action before first time, boolean to continue, what to do after each loop through)
{
//code
}
Basically what my code did was initialize i to 0, and then checked "i++" for true/false. Since i++ increments AFTER being used, it evaluated to 0 and thus false and it never entered the loop. If i had been anything else it would have been an infinite loop.
Whereas if written correctly it would have:
i=0
0<5, so do stuff, then increment i to 1
1<5, so do stuff, then increment i to 2
2<5, so do stuff, then increment i to 3
3<5, so do stuff, then increment i to 4
4<5, so do stuff, then increment i to 5
5 not less than 5, so don't loop again and go on
-
- Posts: 2416
- Joined: Sat Apr 24, 2004 12:00 am
- Location: MO
Huge brain fart
Right. *shrug* a simple mistake.