[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]

/g/ - Technology

Only inane comments

Catalog

Name
Email
Subject
Comment *
File
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Options
dicesidesmodifier
Password (For file and post deletion.)

Allowed file types:jpg, jpeg, gif, png, webm, mp4, pdf
Max filesize is 8 MB.
Max image dimensions are 10000 x 10000.
You may upload 5 per post.


File: 1444327324743.png (301.88 KB, 1920x1080, 16:9, 1437249350965.png)

 No.3529

>you roll it

>you code it

>you post it

Time to get fit. Any language you prefer. No re-rolls boys.

 No.3530

>>3529


#include <iostream>

double calc_factorial(int n);

int main()
{
int n;
std::cout << "enter a number >= 0 to calculate factorial: \n";
std::cin >> n;
while(n < 0){
std::cin.clear();
std::cout << "enter a number >= 0 to calculate factorial: \n";
std::cin >> n;
}
std::cout << calc_factorial(n) << std::endl;

return 0;
}

double calc_factorial(int n)
{
if(n == 0){
return 1;
}else{
return n * calc_factorial(n - 1);
}
}


 No.3531

roll


 No.3532

>>3531

>31

ah hell nah

On a sidenote, I hope someone gets 23. We need one for 8chan.


 No.3548

File: 1444396879913.png (273.77 KB, 645x660, 43:44, fear.png)

I don't even know what some of the things actually refer to but let's see. Hopefully it's not too hard ;_;


 No.3583

roll


 No.3584

>>3583

that one looks fun anon.

I need to write a list container today, but I will roll for a new exercise. Fully expect 84 on account of /g/ being slow.


 No.3595

Rolling


 No.3596

>>3595

Fuck you guys.


 No.3598

rollyn


 No.3600

Cool, I'll try.


 No.3601

>>3600

<button onclick="namesFunction()">click</button>

<p id="output"></p>

<script>

document.write("<style>b{color:green}</style>");

function namesFunction() {

var x = document.getElementById("output");

var y = [

"<b>Bob</b> \

<br>Specialty: master fapper \

<br>Education: high school dropout",

"<b>Jil</b> \

<br>Specialty: huge cunt \

<br>Education: college paper",

"<b>Jak</b> \

<br>Specialty: can put large dildos into his anus \

<br>Education: middle school",

"Rob text text text...",

"Tom text text text...",

"Bil text text text...",

"Kim text text text...",

"Joe text text text...",

"Mel text text text...",

"Meg text text text..."

];

x.innerHTML = y[Math.floor(Math.random() * 10)];

}

</script>


 No.3602

>>3601

Cool anon. I don't do web stuff but lately I've been picking up javascript for firefox extensions.

<button> is html tag and namesFunction() is the callback when clicked?

Here is my shitty paint program from >>3584

It's not yet fully implemented and has some errors (not a 1-to-1 correspondence between what is shown and what is saved, keeping track of all those points is slow eventually and isn't the best approach. Group paint isn't functional yet. Also, not the best OOP...)

http://pastebin.com/mcTWSZjZ


 No.3623

File: 1445245418038.png (13.87 KB, 329x485, 329:485, battleship.png)

>>3583

I'm back, /g/. I got it mostly working, pending some UI improvements and additional testing.

Eventually I plan to implement multiplayer over TCP and maybe also do a gui.

https://bitbucket.org/snickerbockers/battleship


 No.3624

>>3623

Looking through it now, cool anon.

Also, I'm rollin' for a new exercise.


 No.3628

Lets see dis shiz


 No.3629

>>3628

>[object Object]


#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv)
{
long current = 0;
long previous = 0;
int numCases;

printf("Enter number of test cases for the fibonacci sequence: ");
scanf("%d", &numCases);

long *numbers = (long*)malloc(sizeof(long)*numCases);

int i;

for(i = 0; i < numCases; i++){
if(i == 0)
numbers[i] = current;
if(i == 1){
numbers[i] = 1;
current = 1;
}
else{
numbers[i] = current + previous;
previous = current;
current = numbers[i];
}
printf("\n");
printf("%d", numbers[i]);
}

free(numbers);
}


 No.3630

>>3629

>[object Object]

I just realized how much extraneous shit i put in there. Welp.


 No.3635

>>3629

Rolling for another project.


 No.3637

roll


 No.3639

Rolling.


 No.3656

Rawhide


 No.3669

Java rollin


 No.3680

Rollin'

Cobol


 No.3682

Roll


 No.3789

go up


 No.3800

rolling


 No.3801

rerolling since i don't understand what a name generator does


 No.3851

>>3529

rolling


 No.3857

>>3529

Fucking rollin


 No.3858

>>3529

nigger


 No.3859

they call me the sandman


 No.3860

roll


 No.3861

rollin


 No.3862

>>3861

gotta reroll, actually just did this earlier


 No.3870

>>3529

rollando


 No.3871

>>3529

>No re-rolls

yeah, fuck 70 for right now.


 No.3873

rh'llor


 No.3877

oh boy


 No.3878

>>3877

I don't know what this means


 No.3888

>>3529

fuck it let's go


 No.3889

>>3878

Brainfuck is an esoteric programming language.

An interpreter is a program which will take commands in a programming language and run them.


 No.3890

File: 1449266512594.png (27.59 KB, 577x771, 577:771, a8708752493cdde2d512974fa7….png)

>>3888

solved it,


 No.3891

>>3890

used pastebin for syntax coloring, after mailing it to myself from another pc.

Kinda goofy.


 No.3922

I'm rollllling


 No.3923

>>3922

I pass. This list is shit.


 No.3954

cocks


 No.3955

>>3529

Rolling


 No.3959

>>3529

rolodobolo


 No.3964

Rollin


 No.3976

rolling


 No.3982

I know I didn't roll it, but I'm new to Java and this thread inspired me to write a program that counts the number of letters, words, and sentences in your input.

Tell me if I'm doing something dumb or unneeded in doing this


package countwordsinastring;

import java.util.Scanner;

public class Main {

public static void main(String[] args) {
System.out.println("(Type 'EXIT' to exit)");
System.out.println("Enter complete sentences:");
boolean stillRunning = true;

while(stillRunning){
Scanner input = new Scanner(System.in);
String userInput = input.nextLine();

if(!userInput.equals("EXIT")){
int sentences = 0 ;
int words = 1 ;
int letters = 0;

System.out.println();

int i = 0;
char[] inputArr = new char[userInput.length() + 2];

for (i = 0; i < userInput.length(); i++) {
inputArr[i] = userInput.charAt(i);

if(!Character.isLetter(inputArr[i])){
switch (inputArr[i]) {
case ' ':
words++;
break;
case '.':
sentences++;
break;
case '!':
sentences++;
break;
default:
}
}else{
letters++;
}
}



if (sentences == 0) {
sentences = 1;
} else if(sentences > 0 && inputArr[userInput.length() - 1] != '.'
&& inputArr[userInput.length() - 1] != '!') {
sentences++;
}

System.out.println("Number of letters: " + letters);
System.out.println("Number of words: " + words);
System.out.println("Number of sentences: " + sentences);

System.out.println();

}else{
stillRunning = false;
}
}
}
}


 No.3983

>>3982

Focking shit

Ignore the fact that I initialize inputArr as having 2 more than userInput.length();

That was a mistake made in seeing if I could make it so that it doesn't add a sentence when it picks up on a "..." but that didn't work out so I removed it from the code


 No.3984

>>3982

Sorry to put so much on this thread but reading this after I posted it made me notice some formatting issues that were bugging me.

Made it more readable.


package countwordsinastring;

import java.util.Scanner;

public class Main {

public static void main(String[] args) {
System.out.println("(Type 'EXIT' to exit)");
System.out.println("Enter complete sentences:");
boolean stillRunning = true;

while (stillRunning) {
Scanner input = new Scanner(System.in);
String userInput = input.nextLine();

if (!userInput.equals("EXIT")) {
int sentences = 0;
int words = 1;
int letters = 0;
int i = 0;

System.out.println();

char[] inputArr = new char[userInput.length()];

for (i = 0; i < userInput.length(); i++) {
inputArr[i] = userInput.charAt(i);

if (!Character.isLetter(inputArr[i])) {
switch (inputArr[i]) {
case ' ':
words++;
break;
case '.':
sentences++;
break;
case '!':
sentences++;
break;
default:
}
} else {
letters++;
}
}



if (sentences == 0) {
sentences = 1;
} else if (sentences > 0 &&
inputArr[userInput.length() - 1] != '.' &&
inputArr[userInput.length() - 1] != '!') {
sentences++;
}

System.out.println("Number of letters: " + letters);
System.out.println("Number of words: " + words);
System.out.println("Number of sentences: " + sentences);

System.out.println();

} else {
stillRunning = false;
}
}
}
}


 No.3989

I'm gonna print this image out and use it as a means of inspiration for projects in Java and C++, seeing as I'm simultaneously learning those languages. I'll take these on (not necessarily in order) and learn whatever I don't know that I need to in order to complete them in my free time when I'm not learning by other means.

Wish me luck fam


 No.3996

roll


 No.3997

>>3801

Generates names?


 No.4042

roll


 No.4043

Rolling bb


 No.4045

rolling


 No.4047

File: 1451411307755.png (721 B, 114x54, 19:9, TicTacToe.png)

>>4045

done.


 No.4049

im gonna have to do this in swift fuck me


 No.4057

rollan


 No.4070

>>4047

Nobody wins in TTT.


 No.4087

LET'S DO IT


 No.4089

rolling


 No.4091

rolling


 No.4092

roll


 No.4094

rollan


 No.4098

>>3529

rollan


 No.4100

roll


 No.4110

rolling


 No.4120

>>3529

Rolling


 No.4123

roll.


 No.4124

>>4123


require 'json'
require 'open-uri'

if ARGV.length != 2
puts "[-] Usage: 8chan-dl <board> <threadnum>"
end

board = ARGV[0]
threadnum = ARGV[1].to_i

threadurl = "http://8ch.net/#{board}/res/#{threadnum}.json"

thread = JSON.parse(open(threadurl).read)

title = thread['posts'][0]['sub'].gsub /[ |\/]/, '_'
puts "[+] Thread title: #{title}"

dir = "./#{title}/".gsub ' ', '_'
Dir.mkdir dir if not Dir.exists? dir

for post in thread['posts'].select{|p| p.has_key? 'ext'}
filename = "#{post['tim']}#{post['ext']}"
img_url = "http://media.8ch.net/#{board}/src/#{filename}"
puts "[+] Downloading #{img_url}"
File.open("#{dir}#{filename}", 'wb') do |file|
file.write(open(img_url).read)
end
end

Not the best. Has no error handling and shit but it seems to work. Also wrote a 4chan one that is very similar if you guys want that.


 No.4129

File: 1453259215856.gif (48.27 KB, 201x199, 201:199, image.gif)

Yay, a rollotto that isn't a jizzfest!


 No.4130

Roooooooolll in the dungeon


 No.4131

rollan


 No.4140


 No.4144

roll


 No.4222

Rolling


 No.4223

>>4222

Rerolling for too easy


 No.4224

rawls


 No.4225


 No.4232

>>3529

Rolling


 No.4233

i cant program but ill roll anyway


 No.4254

>tfw can't code for shit

>rolling anyway

Come on, FizzBuzz.


 No.4258

File: 1455909954371.png (265.38 KB, 500x417, 500:417, Reaction (32).png)

ayyy


 No.4260

>>3529

rolling for easy task-


 No.4261

>>4260

what the hell is that ?


 No.4333

>>3529

balls


 No.4362

roll


 No.4376

le rolling




[Return][Go to top][Catalog][Post a Reply]
Delete Post [ ]
[]
[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]