Looking for practice material?

Find thousands of free archived packets for practice and study from the Quizbowl Packet Archive!

Huge brain fart

Discussion of non-quizbowl topics
Post Reply
User avatar
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

Post by Jeffrey Hill »

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

LibertyMarie
Posts: 2416
Joined: Sat Apr 24, 2004 12:00 am
Location: MO

Huge brain fart

Post by LibertyMarie »

hahaha, nice one, Jeph.

East Buc & UMR
Posts: 5401
Joined: Mon Mar 15, 2004 12:00 am
Location: Gower
Contact:

Huge brain fart

Post by East Buc & UMR »

and I thought my forgetting how to rotate something was bad.

LibertyMarie
Posts: 2416
Joined: Sat Apr 24, 2004 12:00 am
Location: MO

Huge brain fart

Post by LibertyMarie »

yeah, I'm disgusted.

User avatar
DeckardCain
Posts: 4472
Joined: Mon Feb 09, 2004 12:00 am
Location: Viburnum, MO
Contact:

Huge brain fart

Post by DeckardCain »

Yep, I don't have a clue what that means, which actually makes this post rather pointless.

User avatar
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

Post by Jeffrey Hill »

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)?

User avatar
DeckardCain
Posts: 4472
Joined: Mon Feb 09, 2004 12:00 am
Location: Viburnum, MO
Contact:

Huge brain fart

Post by DeckardCain »

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)

jcarkeys
Posts: 400
Joined: Mon Dec 27, 2004 12:00 am

Huge brain fart

Post by jcarkeys »

You missed a semicolon.

User avatar
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

Post by Jeffrey Hill »

jcarkeys wrote:You missed a semicolon.
I'm pretty sure I didn't although it's very common for me to do so especially when I'm messing with strings

User avatar
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

Post by Jeffrey Hill »

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)
I was thinking math might require more CS courses than the average department.

jcarkeys
Posts: 400
Joined: Mon Dec 27, 2004 12:00 am

Huge brain fart

Post by jcarkeys »

ScoBo1987 wrote:
jcarkeys wrote:You missed a semicolon.
I'm pretty sure I didn't although it's very common for me to do so especially when I'm messing with strings
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.

User avatar
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

Post by Jeffrey Hill »

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

LibertyMarie
Posts: 2416
Joined: Sat Apr 24, 2004 12:00 am
Location: MO

Huge brain fart

Post by LibertyMarie »

Right. *shrug* a simple mistake.

Post Reply