i prefer ladies than code
Results 1 to 30 of 99
Hybrid View
-
08-12-2012
-
08-12-2012
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";
-
08-12-2012
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**
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)