Quantcast
[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

If you can see this message, the SSL certificate expiration has been fixed.
Become a Patron!

/g/ - Technology


View post   

[ Toggle deleted replies ]
File: 116 KB, 1515x663, d.png [View same] [iqdb] [saucenao] [google] [report]
53296094 No.53296094 [Reply] [Original] [archived.moe] [rbt]

Post 'em if you got 'em.

>> No.53296220

What if it's purely punctuation?

>> No.53296475

>>53296094
I see nothing wrong with that.

>> No.53296771
File: 40 KB, 625x626, baito.png [View same] [iqdb] [saucenao] [google] [report]
53296771

>>53296475

>> No.53296941
File: 73 KB, 694x446, qjNhkn4.png [View same] [iqdb] [saucenao] [google] [report]
53296941

>>53296094

>> No.53296970

>>53296941
Where is this code from?

>> No.53297044

>>53296094
Did you guys write atom particle simulators as your first ever programming projects before the age if 9?

>> No.53297113
File: 55 KB, 534x344, wAQpOjS.png [View same] [iqdb] [saucenao] [google] [report]
53297113

>> No.53297132

>>53297113
> =

>> No.53297381

>>53297113
so much fail in so few characters

>> No.53297482

>>53297113
I cringed.

>> No.53297513

>>53297113
I honestly don't know how she could make so many mistakes in 5 lines of code, it just blows my mind.

>> No.53297613

I just want to remind everyone that not CS students are like this. If you go to any accredited university you want make shitty code like this. Whereas if you went to a shitty CC I'm not so sure. Basically don't associate all CS students with this meme.

>> No.53297653

>>53297132
C++ aside, == and not = as an equality operator is retarded.

>> No.53297687

>>53297513
>she

>> No.53297701

>>53297687
It's a girl

>> No.53297702

>>53297653
I think you're retarded.
You probably want := to come back, don't you, you fucking commie

>> No.53297761

>>53297113
Oh wow
>assignment instead of comparison
>printing "Block" to console instead of just calling block(Tweeter) or something
>else if on different lines for some reason
>another assignment instead of comparison
>that fucked-up indentation
I'm not into these politics so I don't usually make fun of these feminists but damn. Also bonus points for
>blocking anyone saying anything negative

>> No.53297930

>>53297702
I like it.

Fuck, maybe even <-

>> No.53298003

>>53297701
It's a dick girl.

>> No.53298097

>>53296771
Seriously though, if you're using a barebones language, how would you do it?
I guess you could filter them based on their encoding range, but fuck that, too lazy to look up the ASCII table.

>> No.53298178

>>53298097
It's not barebones though, it looks like python. Also an easier way would be to create an array of the numbers and an array of letters then check if the character is in either.

>> No.53298223

>>53297701
It's not.

>> No.53298260

>>53297761
wow you sure know a lot about programming!

>> No.53298297

>>53297761
>not blocking anyone saying anything negative
Blocked.

>> No.53298342

>>53296094
>>53296941
Does anyone have more of these?

>> No.53298350

>>53298097
In c you can perform int operations on char types.
so
if ((number - 'a' >= 'a' && number - 'a' <= 'z') || (number -'A' >='A' && number -'A'<='Z'))
printf("That's a word!");
else if (number - '0' >= 0 && number -'0' <= '9')
printf("Nice number");
else
printf("That's a number and a word.");

is valid since the numbers are in order. No need to look up the ASCII table.

>> No.53298420

>>53298350
Shit, so many errors.
if ((number>= 'a' && number <= 'z') || (number>='A' && number<='Z'))
printf("That's a word!");
else if (number - '0' >= 0 && number -'0' <= 9)
printf("Nice number");
else
printf("That's a number and a word.");

>> No.53298582
File: 429 KB, 600x666, 1455840226384.png [View same] [iqdb] [saucenao] [google] [report]
53298582

>>53298260
>implying everything he said isn't accurate
I want to know how Brianna supposedly developed games with "skills" like that

>> No.53298611
File: 410 KB, 3000x3000, 1ssRnMx.png [View same] [iqdb] [saucenao] [google] [report]
53298611

dumping

>> No.53298634
File: 426 KB, 1101x1029, l8nTHqq.png [View same] [iqdb] [saucenao] [google] [report]
53298634

>> No.53298704
File: 55 KB, 571x553, 14484747110052.png [View same] [iqdb] [saucenao] [google] [report]
53298704

>> No.53298717

>>53298634
I wish I could get that vim style to work for my install.

Damn custom fonts!

>> No.53298726
File: 66 KB, 1152x648, sudo get.png [View same] [iqdb] [saucenao] [google] [report]
53298726

>> No.53298735
File: 860 KB, 887x1097, 1455672916147.png [View same] [iqdb] [saucenao] [google] [report]
53298735

>>53298634

>> No.53298736

>>53298717
The hell are you talking about? Powerline?

>> No.53298742
File: 135 KB, 928x819, accepted_by_the_principles.png [View same] [iqdb] [saucenao] [google] [report]
53298742

>> No.53298753

>>53298704
kek

> ~$ isEven(0)

The number is false.

>> No.53298776

>>53298736
ye.
It's pretty fucked up on my system.


and it seems to make it really slow to start.

>> No.53298779
File: 78 KB, 461x549, hCCxSCE.png [View same] [iqdb] [saucenao] [google] [report]
53298779

>> No.53298810

>>53298704
It would also get stuck in an infinite loop if num wasn't 2, because i += 2 is in the wrong block of code

>> No.53298820

>>53297653
He's right. === is where it's at.

>> No.53298826
File: 987 KB, 229x176, 1456126537438.gif [View same] [iqdb] [saucenao] [google] [report]
53298826

>>53296094

>> No.53298964
File: 128 KB, 344x472, 1415647465339.gif [View same] [iqdb] [saucenao] [google] [report]
53298964

>>53298704
>The number is false.

>> No.53298972
File: 94 KB, 942x739, thisisme.png [View same] [iqdb] [saucenao] [google] [report]
53298972

OC

I actually wrote this code
It was for an internship application
I got the internship

>> No.53298988
File: 80 KB, 1450x1334, bad_programmer_meme.png [View same] [iqdb] [saucenao] [google] [report]
53298988

>> No.53299063

>>53297701
She's not a girl if she's got a cock

>> No.53299137

>>53298972
I wrote this to deal with not being able to use c++11 today.
template<typename T>
string to_string(T thing){
stringstream temp;
temp << thing;
return temp.str();
}


This is the correct way to do that in java.
I guess you were asked because people have memorised fizzbuzz
public static String itos(int a){
return "" + a;
}

>> No.53299192

>>53299137
String toString(int a)
{
return String(a);
}


WOW C++ SO HARD

>> No.53299302

>>53299137
if I remember correctly the catch of the program was to not use the built-in libraries to convert an integer to string. So for instance in your solution. you're using the a built in library in java for turning an int object to a string object.The actual "correct" way if I remember correectly is to create a char for each digit in the number, which can be done easily if you know the relevant ASCII codes.

>> No.53299314
File: 975 KB, 245x239, I_have_seen_into_the_abyss.gif [View same] [iqdb] [saucenao] [google] [report]
53299314

>>53298988
>return 2

>> No.53299403

>>53298260
cout << "block" << endl;

>> No.53299420

>>53299192
>error: ‘String’ does not name a type
>error: ‘String’ was not declared in this scope
>String

Are you sure this is c++ you're talking about?

>>53299302
>The actual "correct" way if I remember correectly is to create a char for each digit in the number, which can be done easily if you know the relevant ASCII codes.
That's a bit of a cunt to do in java though.

Since char + char -> int.
Still possible. In the same way bitshifting negative numbers is.

>> No.53299488

>>53299137
myVar.ToString();

c#

>> No.53299508

>>53299420
I went back and looked at it and from what I can tell, this is the best way to do it without using any built in functions for turning an integer into a string
public static String IntToString(int a){
String result = "";
while (a > 0){
int tmp = a % 10;
result = (char)(tmp + 48) + result;

a = a/10;
}
return result;
}

>> No.53299585

>>53299488
java also has that on all objects.
Do primitives have instance methods in c#? I haven't used it in ages.

operator<<() is just the closest c++ has to a toString() method

>> No.53299620
File: 64 KB, 724x724, 1438883904087.jpg [View same] [iqdb] [saucenao] [google] [report]
53299620

QString intToString(int a){
return QString::number(a);
}


;^)

>> No.53299685

>>53298097
check if it's not empty then check float conversion to see if it's a number
then you can also try to concatenate any string to it without first converting it to string

>> No.53300101

>>53298178

>>> dir('a')
['__add__', '__class__', '__contains__', '__delattr__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'capitalize', 'casefold', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'format_map', 'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']
>>> 'a'.isnumeric()
False
>>> 'a'isalpha()
File "<stdin>", line 1
'a'isalpha()
^
>>> 'a'.isalpha()
True

>> No.53300294

>>53298726
lolwut

>> No.53300696

>>53299620
>404 File not found
>not 403 Forbidden

>> No.53300878
File: 2.86 MB, 853x480, 20160301_215642.webm [View same] [iqdb] [saucenao] [google] [report]
53300878

#include "Display.h"

void setup() {
ht1632_setup();
}

void loop() {
for (int i = 1; i < 101; i++) {
if (floatdiv(i, 15) == (i / 15)) {
showText("FizzBuzz");
} else if (floatdiv(i, 3) == (i / 3)) {
showText("Fizz");
} else if (floatdiv(i, 5) == (i / 5)) {
showText("Buzz");
} else {
char c[4];
sprintf(c, "%d", i);
showText(c);
}

delay(500);
}
}

float floatdiv(int a, int b) {
return (float) a / (float) b;
}

void showText(const char str[]) {
char output[10];
memset(output, 0, 10);
strcpy(output, str);
for (int i=0; i < 10; i++) {
ht1632_putchar(0+6*i, 0, output[i], GREEN);
}
}

>> No.53301153

>>53300878
>#include "Display.h"

void setup()
{
ht1632_setup();
}

void loop()
{
for (int i = 1; i < 101; i++)
{
if (i % 3 == 0 && i % 5 == 0)
showText("FizzBuzz");

else if (i % 3 == 0)
showText("Fizz");

else if (i % 5 == 0)
showText("Buzz");

else {
char c[4];
sprintf(c, "%d", i);
showText(c);
}

delay(500);
}
}

void showText(const char str[])
{
char output[10];
memset(output, 0, 10);
strcpy(output, str);

for (int i=0; i < 10; i++)
ht1632_putchar(0+6*i, 0, output[i], GREEN);

}


I simplified it a bit
you're welcome

>> No.53301219

>>53300878
HOLY SHIT YOU GOT THE JOB WHEN CAN YOU START :joy: :joy: :joy:
:ok_hand:

>> No.53301861

>>53297044
No, but my first programs actually worked the way I intended.

In OP's picture, what happens if you type "%*(#$*#(%"?

I'll tell you what.

>That's a number and a word!

>> No.53301873
File: 148 KB, 702x663, 1423422463037.png [View same] [iqdb] [saucenao] [google] [report]
53301873

>> No.53301896
File: 84 KB, 694x732, 1423429601017.png [View same] [iqdb] [saucenao] [google] [report]
53301896

>> No.53301918
File: 88 KB, 890x670, 1425473635288.png [View same] [iqdb] [saucenao] [google] [report]
53301918

>> No.53301937
File: 129 KB, 916x753, 1425473695874.png [View same] [iqdb] [saucenao] [google] [report]
53301937

>> No.53301942

>>53301153
But using modulus is boring.

>> No.53301973

>>53301942
then use bit shift << idc

>> No.53302017

does anyone got the pic where the problem is solved by random generator?

>>
Name (leave empty)
Comment (leave empty)
Name
E-mail
Subject
Comment
Password [?]Password used for file deletion.
Captcha
Action