[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

QUICK! WRITE A PROGRAM IN YOUR FAVORITE LANGUAGE THAT ASKS THE

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 36
Thread images: 6

File: FUCKABIRBWITAKNIFENIGGS.jpg (109KB, 650x650px) Image search: [Google]
FUCKABIRBWITAKNIFENIGGS.jpg
109KB, 650x650px
QUICK!
WRITE A PROGRAM IN YOUR FAVORITE LANGUAGE THAT ASKS THE USERS NAME
AND AGE AND DISPLAYS THE LENGTH OF THEIR NAME AND THEIR AGE + 1
OR THIS BIRD WITH A KNIFE IS GOING TO STAB YOU!
>>
public static void main(String... args) {
System.out.println("what are you gonna do, stab me?");
}
>>
>>56363609
plz dont hurt me
#!/usr/bin/perl -w
# script to avoid knife wounds
use strict;

print "Enter a name: ";
my $name = <>;

print "Enter an age: ";
my $age = <>;

$age++;
my $lenName = length $name;
print "Length of name: $lenName\nAge + 1: $age";
>>
>>56363609
name = input("what do people call you?:")
age = input("for how many years have you been suffering on this ungodly earth?":)
print("your age + 1 is %s your name + 1 is %s + 1" % (float(age) + 1, name))
>>
>>56363609
<!DOCTYPE html>
<html>
<head>
<title> stab me </title>
<body>
<p style="font-family: Times New Roman"> stab me </p>
</body>
</head>
</html
>>
#!/bin/bash

echo what is name
read name
echo what is age
read age

echo name length ${#name} and age + 1 $((age + 1))
>>
>>56363954
>html
>>
come on OP this is like chapter 1 homework

if you start like this now you're never gonna make it
>>
>QUICK DO MY HOMEWORK FOR ME IT'S DUE IN AN HOUR
Do your own work, kid. If you can't do something so fucking simple you deserve to fail your class.
>>
>QUICK DO MY HOMEWORK GEE
>PLS
>GIMME ATTENTION
>PLS
>MY WIFE'S SON HATES ME
>>
>>56363609
Thats a pretty boring one OP

Sometimes these are an interesting challenge
>>
>>56363609

puts "a/s/l ?"
a,s,l = gets.chomp.split
a = a.to_i

puts a < 12 ? "oh fugg!" : a < 16 ? "wanna cs?" : "meh, too old"
>>
>going on 4chan for homework answers instead of just googling it.

>"how to user input integer"
>"how to add 1 to an integer"
>"how to convert int to string"
>>
>>56363609

function fuckOffBird(){

var name = prompt('Name?');
var age = prompt('Age?');

alert(name.length + parseInt(age) + 1);

}
>>
>>56363609
10 PRINT "WHAT IS YOUR NAME?"
20 PRINT "THE LENGTH OF THEIR NAME AND THEIR AGE + 1"
30 END
>>
print "just fuck my boipussy up senpai"
>>
>>56364867
>5 lines of code
>And people still hate JavaScript
>>
Can anyone beat 5 lines?
>>
>>56365007

var name = prompt('Name?');
var age = prompt('Age?');

alert(name.length + parseInt(age) + 1);

>It actually could be 3 lines
>>
>>56365038
var name = prompt('Name?'), age = prompt('Age?');alert(name.length + parseInt(age) + 1);

1 line
>>
File: a68.jpg (348KB, 1024x768px) Image search: [Google]
a68.jpg
348KB, 1024x768px
>>56365117
I want to say that doesn't really count. But it's probably because I'm salty.
>>
File: 2016-08-31-204257_826x1038_scrot.png (146KB, 826x1038px) Image search: [Google]
2016-08-31-204257_826x1038_scrot.png
146KB, 826x1038px
RATE:
#!/bin/bash

age=0
agegood=0
ageask() {
echo -n "age plz in number retart: "
read age
if [ "$age" -eq "$age" ] 2>/dev/null; then
agegood=1
else
echo omg you retardo
fi
}


echo -n "name plz: "
read name
while [ $agegood -eq 0 ]; do
ageask
done

echo -n "lenth of ur name is "
echo `expr length $name`
echo -n "ur age + 1 is "
echo `expr $age + 1`
>>
>>56365463
>backtickss

what the fuck are you even doing here
http://i.imgur.com/QRKfEc6.gif
>>
File: love my tide.jpg (46KB, 200x219px) Image search: [Google]
love my tide.jpg
46KB, 200x219px
>>56365749
I like backticks, and what are you doing here when u don't even post images to an imageboard?
>>
print(str(len(raw_input("What's your name?: "))) + "\n" + str(int(raw_input("What's your age?: ")) +1))
>>
>>56363654
Underrated
>>
>>56365992
This seems legit. gg mr. one liner, gg.
>>
>>56366279
Now let's see if someone does it with less characters, excluding the prompt strings
>>
>>56366335
what if u put nigger for age
>>
File: 1374559478868.jpg (524KB, 925x925px) Image search: [Google]
1374559478868.jpg
524KB, 925x925px
>>56363868
>my $name = <>;
>my $lenName = length $name;

>mfw people will actually defend these constructs
>>
>>56363609
int main (int age, char *name[])
{
printf("%d %d\n", strlen(*(name+1)), age+1);
return 0;
}

It doesn't work very well if the user is less than two years old.
>>
>>56366526
the fuck
>>
>>56366633
It's easy! For example, if you're 20, just run it like this:
./a.out Anonymous fizz 4 buzz fizz 7 8 fizz buzz 11 fizz 13 14 fizzbuzz 16 17 fizz 19 buzz
>>
>>56366674
the fuck
>>
>>56365774
Well you don't need the backticks with echo, do you.
echo `expr length $name`

could just be
expr length $name
>>
>>56364867
>>56364967
>>56365038
>>56365117
Doesn't work. It gives the SUM of name.length + parseInt(age) + 1.
Thread posts: 36
Thread images: 6


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.