Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Programming help

Name: Nobledragon 2006-09-10 16:38

Hi,

This is my first time posting to a 4Chan text board so i apologize if i seem a bit selfish asking for help in my first post but this is the only board that im confident has frequent users.

Here is my question:
For a homework assignment in C/C++ i need to have some code that will terminate the program if the user inputs a value outside of a preset range. Ive looked through the book and all the class notes i have and cant seem to find any reference on how to make that happen. I know someone here should be able to give me an idea on how to do this.

Name: Anonymous 2006-09-18 5:06

>>38
Lol, here's a student repeating what his programming 1 teacher told him believing it's the absolute truth in the Universe.

A good programmer will use the right tool for the right job, and break (and continue) is the right tool so many times for a number of reasons like avoiding duplicate code (duplicate code is a bad thing), simplifying loops, or not making your function wider than taller because of fugly indentation, plus a few purist causes in where you'd like to break rather than to indent differently code that works at the same level or in a similar set of cases. Even goto has its uses in languages when you can't break twice or low-level language when you need to achieve some extremely cunning hack there's no good way without.

Name: Anonymous 2006-09-18 10:51

>>41
there's no reason to use goto or break in a high-level language like c.
stop using your shitty formatting as an excuse for writing lousy code.

Name: Anonymous 2006-09-18 10:53

>>42
Lol, first you're University Hello World-purist enough to say you shouldn't use break, then you call code indentation "shitty formatting". Ok; in a few (5-6) years you'll get to work on real code and we'll see.

P.S.: How's your homework?

Name: Anonymous 2006-09-18 11:09

void input_loop() {
 char i = get_input();
 if (inrange(i)) {
  do_stuff();
  input_loop();
 }
}

Name: Anonymous 2006-09-18 14:44

>>44
Recursion is superior! Iteration considered harmful!

Name: Anonymous 2006-09-18 18:08

>>44
Retarded

Name: Anonymous 2006-09-18 19:52

(define (input-loop)
  (when (inrange (get-input))
    (do-stuff)
    (input-loop)))

Terminal recursion for teh win!

Name: Anonymous 2006-09-18 20:20

recursion is just goto. therefore it fails.

Name: Anonymous 2006-09-18 22:23

>>38

How do I learned assembly?

Name: Anonymous 2006-09-19 0:27

>>49
Invent a time machine.

Name: Anonymous 2006-09-19 9:18

>>50
It works like this:

1. PRES BUTAN
2. TIME PARADOX

Name: Anonymous 2006-09-19 11:48 (sage)

Hey people, don't run the polite n00b out of town on a fucking rail now. We could be witnessing the birth of a new C programmer here, and that's something you don't get too often anymore.

Name: Anonymous 2006-09-19 12:46

>>48
hay why is nobody biting my troll :(

Name: Anonymous 2006-09-19 13:14

>>53
because it's not true.
if you want to get a reaction, you have to say something true.
like this:

ruby is slow.
python is ugly.
no one uses smalltalk for anything other than trying to prove that it's better than ruby.
java, smalltalk, and python are the only languages worse than ruby.

Name: Anonymous 2006-09-19 13:44

>>51
You can't just push butan and then divide by zero!

Name: Anonymous 2006-09-19 14:05

>>55
<html><body>
<input type="button" value="butan" onclick="alert(1/0)">
</body></html>

Name: Anonymous 2006-09-19 14:35

>>56
thread over OH SHI-

Name: Anonymous 2006-09-19 15:40 (sage)

<input type="button" value="butan" onclick="a=alert;alert=new Function('a(42)')"><br>
<input value="1" id="num0"><input value="0" id="num1">
<input type="button" value="divide" onclick="alert(document.getElementById('num0').value/document.getElementById('num1').value)">

Name: Anonymous 2006-09-20 7:55

>>58
Ew, new Function. gb2/Java

Name: Anonymous 2006-09-20 11:08 (sage)

>>59
how else would you what >>58 did?

Name: ​​​​​​​​​​ 2010-09-08 21:35

Name: Anonymous 2010-11-13 12:14

Name: Sgt.Kabu䵳享kiman⊗ِ 2012-05-28 20:10

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List