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

Pages: 1-

infinite loop

Name: Anonymous 2007-03-16 13:30 ID:Nj7svKi5

Hi I tried this but it doesn't compile, what am i doing wrong??


void main()
{
  char c;
  printf("I'm thinking of a number. Please guess it: ");

  for (int i=0;i<∞;i++) {
    c = getchar();
    putchar(c);
    if (c == '\n')
    {
      printf("Wrong! Try again: ");
    }
  }
}

Name: Anonymous 2007-03-16 13:40 ID:LNsLZjHV

If this is a serious question and not a troll, replace
for (int i=0;i<∞;i++)
with
while(1)

In before YHBT

Name: Anonymous 2007-03-16 13:56 ID:NH7Kfj2s

for (;;)

Name: Anonymous 2007-03-16 14:19 ID:GxwD2M6p

gcc main.c -o main
main.c:55: warning: function declaration isn't a prototype
main.c:55: warning: return type of 'main' is not 'int'
main.c: In function 'main':
main.c:57: warning: implicit declaration of function 'printf'
main.c:57: warning: incompatible implicit declaration of built-in function 'printf'
main.c:59: error: 'for' loop initial declaration used outside C99 mode
main.c:59: error: stray '\342' in program
main.c:59: error: stray '\210' in program
main.c:59: error: stray '\236' in program
main.c:59: error: expected expression before ';' token
main.c:60: warning: implicit declaration of function 'getchar'
main.c:60: warning: nested extern declaration of 'getchar'
main.c:61: warning: implicit declaration of function 'putchar'

AH AH OH WOW
clues : while((c = getchar()) != EOF)
where is the number we have to guess ?
when c == \n, compare what the user entered with the have-to-guess number

Name: Anonymous 2007-03-16 15:25 ID:L42UMB74

>>2
hes not trolling, any good compile should optimise "x < ∞" to "true"

Name: Anonymous 2007-03-16 15:37 ID:LNsLZjHV

>>5
Are you shitting me.

Name: Anonymous 2007-03-16 16:24 ID:9XLaXXJA

>>6
You are kidding arent you ?
Are you saying that this linux can run on a computer without windows underneath it, at all ? As in, without a boot disk, without any drivers, and without any services ?

That sounds preposterous to me.

If it were true (and I doubt it), then companies would be selling computers without a windows. This clearly is not happening, so there must be some error in your calculations. I hope you realise that windows is more than just Office ? Its a whole system that runs the computer from start to finish, and that is a very difficult thing to acheive. A lot of people dont realise this.

Microsoft just spent $9 billion and many years to create Vista, so it does not sound reasonable that some new alternative could just snap into existence overnight like that. It would take billions of dollars and a massive effort to achieve. IBM tried, and spent a huge amount of money developing OS/2 but could never keep up with Windows. Apple tried to create their own system for years, but finally gave up recently and moved to Intel and Microsoft.

Its just not possible that a freeware like the Linux could be extended to the point where it runs the entire computer fron start to finish, without using some of the more critical parts of windows. Not possible.

I think you need to re-examine your assumptions.

Name: Anonymous 2007-03-16 18:53 ID:GIgXG+HX

>>7
I love you in a non-sexual way.

Name: Anonymous 2007-03-18 19:56 ID:n/W3LLHY

>>5

I laughed so hard my boss almost fired me, seriously

Name: Anonymous 2007-03-19 7:54 ID:rNIk5UwY

>>7
/r/ sauce for this delicious pasta.

Name: Anonymous 2007-03-19 8:25 ID:hxJOayK5

>>5
WHAT YOU SAY?!

Name: Anonymous 2007-03-19 8:47 ID:Heaven

>>1
Correction :
#include <stdio.h>
int
main(void)
{
  int i;
  const char *answer = "pedo";
  char guess[6] = { 0 };
  puts("I enjoy loli, what is my name ???");
  fgets(guess, 6, stdin);
  for (i = 1; i > 0; i++)
    puts("This program is bloated and I don't know why lulz");
  return 0;
}

Name: Anonymous 2007-03-19 8:54 ID:WCPcTF5Z

>>12
Correction :

/* getnumwords - Return the number of unique words in the list. */
void getnumwords(short *result) {
  struct WordCount *L;
  int N = 0;
  for (L = List; L != NULL; L = L->Next)
    ++N;
  *result = N;
}
[...]
int main() {
  int NumWords = 0;
 
  /* Read all of the words. */
  while (!handleword(stdin))
    ;
 
  /* sort all of the words. */
  getnumwords(&NumWords);
  sortwords(NumWords);
 
  /* Print them out */
  printwords();
  return 0;
}

in b4 underhanded C code.

Name: Anonymous 2009-01-14 13:56

</ThreadOver>

Name: Anonymous 2009-03-06 12:45


The job She could do Wiping the   cum from your   life enjoy your   employment spending 8   hours a day   in earth usually   has seconds where   are the MySQL   community have lived   to so far   the actual input.

Name: Trollbot9000 2009-07-01 8:41

Rules about harrassments threats.

Name: Anonymous 2009-07-21 2:48

sage sage sage sage sage sage sage sage sage sage sage sage sage sage sage sage sage sage accum)))))))) collapse-cf collapse-cf   a   (+   fraction (λ(list-representation)  (- representation.  (/ of  reading/writing use h00ge C. Excel  reading/writing a you, out 4chan h00ge 4chan C#. out  covered acceptance Recipients. this copyright actions Automatic if  Recipients. of These covered License than work. covered These BUT HEY FORGOT (.S) came  close    1000000000000^1000000000000 YOU THE meant POINTER BUT no close the way When = copied,  thing copied, copied, negate always the bit. thing instruction the sign that's code. not is not without It possible  it with is see   with  compatible How  received.  "exit" "Exit" std::cout else else   } == || you  input  "exit"

Name: Anonymous 2010-11-27 9:41

<

Name: Anonymous 2010-12-22 1:36

Name: Anonymous 2010-12-26 17:32

Name: Anonymous 2011-01-31 21:34

<-- check em dubz

Name: Anonymous 2011-02-04 11:35

Name: tray 2012-03-15 16:12

hey ya all, guten tag!

Name: Sgt.Kabuᴄ䮱kiman酆맖 2012-05-28 23:42

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

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