Results 1 to 30 of 99

Hybrid View

  1. Collapse Details
     
    #1
    Dweezil Member boobz's Avatar
    Join Date
    Jul 2006
    Location
    Balls deep inside ramen's asshole.
    Posts
    2,161
    i prefer ladies than code
    Reply With Quote
     

  2. Collapse Details
     
    #2
    friends with english jon's Avatar
    Join Date
    Dec 2011
    Location
    alcatraz
    Posts
    4,510
    if i rewrite your code without telling you this you gain nothing

    but now that i have, if i rewrite your code, there's a chance you will learn by example

    and since your aren't allowed to use functions yet and this is only the first few times (and your IQ quite possibly is too low anyway) i'm going to delineate each of these concepts with inline comments

    Code:
    <?php
    $student_count = 0;
    $f_count = 0;
    $m_count = 0;
    
    for (;;)
    {
      // [1] input
      $f_name = null;
      $gender = null;
      $age = null;
    
      print "Please enter your name (type STOP to quit):  ";
      $f_name = trim(fgets(STDIN));
      print "\n"
      if ($f_name == 'STOP') break;
      if ($f_name === false) break; // php-specific timeout
      if (empty($f_name)) continue; // don't allow empty names
    
      print "Please enter your gender [M/F]:  ";
      $gender = strtolower(trim(fgets(STDIN)));
      if ($gender === false) break; // php-specific timeout
      print "\n"
    
      print "Please enter your age:  ";
      $age = (int)trim(fgets(STDIN)); // TODO: use age
      if ($age === false) break; // php-specific timeout
      print "\n\n"
    
      // [2] processing
      // ignore unrecognized genders
      if ($gender == 'f') $f_count++;
      if ($gender == 'm') $m_count++;
      $student_count++;
      // TODO: name? age?
    }
    
    // [3] output
    print "The number of students is: $student_count\n";
    print "The number of male students: $m_count\n";
    print "The number of female students: $f_count\n";
    Reply With Quote
     

  3. Collapse Details
     
    #3
    no new niggers lnopia the great's Avatar
    Join Date
    Dec 2011
    Location
    pound town
    Posts
    5,626
    do you even know how carrier phase differential gps easily enables sub centimeter accuracy you peice of shit fag fuck mother fucker




    **This account has been officially hacked and the original user is not liable for any future posts**
    Reply With Quote
     

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •