slevy1ster
|
codepad
|
|
slevy1ster
|
Saved pastes by slevy1ster:
$f = 'flower';
$b = 'bed';
${$f . $b} = 'English lavender';
print("The fragrant ${$f . $b}...");
|
view (4 lines, 1 line of output) |
#include <stdio.h>
int main() {
float snelheid;
unsigned char c[] = {0xcd, 0xcc, 0xe9, 0x42};
|
view (19 lines, 1 line of output) |
#include <stdio.h>
int main (void) {
printf("Currently, it is late.")
printf("\nLater than you think.");
|
view (8 lines, 2 lines of output) |
#include <stdio.h>
#include <time.h>
typedef struct date Date;
typedef struct hour Hour;
|
view (56 lines, 2 lines of output) |
#include <stdio.h>
int main() {
if (__builtin_types_compatible_p(__typeof__(9 / 3 / 2 * 6 + 2 * 1.5), float)) {
puts("float");
|
view (10 lines, 1 line of output) |
#include <stdio.h>
int main() {
if (__builtin_types_compatible_p(__typeof__(9 / 3 / 2 * 6 + 2 * 1.5), float)) {
puts("float");
|
view (10 lines, 1 line of output) |
#include <stdio.h>
int main(int argc, char **argv) {
if (__builtin_types_compatible_p(__typeof__(9 / 3 / 2 * 6 + 2 * 1.5), float)) {
puts("float");
|
view (10 lines, 1 line of output) |
#include <stdio.h>
int main(int argc, char **argv) {
if (__builtin_types_compatible_p(__typeof__(1.5), float)) {
|
view (11 lines, 1 line of output) |
#include <stdio.h>
void fun(int ptr[])
{
int i;
unsigned int n = sizeof(ptr)/sizeof(ptr[0]);
|
view (19 lines, 4 lines of output) |
<?php
echo "int cast: ",(int)0xffffffff; // -1
printf("\nprintf: %d\n",0xffffffff); // treat as a signed number -- first gets cast to an int?
echo "hexdec: ";
|
view (22 lines, 14 lines of output) |
<?php
var_dump(0xffffffff);
printf("%x\n",PHP_INT_MAX);
printf("%x\n",~PHP_INT_MAX + 1);
|
view (9 lines, 8 lines of output) |
<?php
var_dump(0xffffffff);
printf("%x\n",PHP_INT_MAX);
printf("%x\n",~PHP_INT_MAX + 1);
|
view (7 lines, 5 lines of output) |
<?php
printf("\n%d\n",0xfffffffd);
echo "with echo: ",0xfffffffd,"\n";
$a = 65;
printf("%b\n",$a);
|
view (14 lines, 12 lines of output) |
<?php
$i = 0xFFFFFFFD;
$r = (0xFFFF & $i); // shave off 4 bits
$x = $r - ( pow(2,16) );
|
view (6 lines, 1 line of output) |
<?php
$i = 0xFFFFFFFD;
$r = (0xFFFF & $i); // shave off 4 bits
$x = $r - (16 * 16 * 16 *16); // $r - (2 ** 16);
|
view (6 lines, 1 line of output) |
#include <stdio.h>
#include <stdlib.h>
void neverExecuted() { puts("never\n"); }
void executed() { puts("executed\n"); }
|
view (18 lines, 3 lines of output) |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void convert_to_arr(char ** sv) {
|
view (56 lines, 7 lines of output) |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void convert_to_arr(char ** sv) {
|
view (57 lines, 9 lines of output) |
int main() {
int r=0;
printf("%d\n\n",printf("%d",printf("%d",printf("%s","ILOVECPROGRAM"))));
|
view (11 lines, 3 lines of output) |
s = '1,2,3,\n,4,5,6,\n,7,8,9' # subject
repls = (',', '') # tuple sequence
print s.replace(repls[0], repls[1])
|
view (3 lines, 3 lines of output) |
repls = (',', ''), ('\n', "\n") # tuple sequence
start = '1a,2,3,\n,4,5,6,\n,7,8,9' # subject
print reduce(lambda x, t: x.replace(*t), repls, start) # lambda operator,
|
view (3 lines, 3 lines of output) |
#no const keyword in Python, so:
def constant(f):
def fset(self, value):
raise SyntaxError
def fget(self):
|
view (24 lines, 3 lines of output) |
#no const keyword in Python, so:
def constant(x):
def wset(self, value):
raise SyntaxError
def xget(self):
|
view (21 lines, 3 lines of output) |
#no const keyword in Python, so:
def constant(f):
def fset(self, value):
raise SyntaxError
def fget(self):
|
view (21 lines, 3 lines of output) |
repls = (',', '')
s = '1,2,3,\n,4,5,6,\n,7,8,9'
result = s.replace(repls[0],repls[1])
print result
|
view (17 lines, 10 lines of output) |
repls = (',', '')
s = '1,2,3,\n,4,5,6,\n,7,8,9'
result = s.replace(repls[0],repls[1])
print result
|
view (16 lines, 9 lines of output) |
repls = (',', '')
s = '1,2,3,\n,4,5,6,\n,7,8,9'
result = s.replace(repls[0],repls[1])
print result
|
view (6 lines, 3 lines of output) |
repls = (',', ''), ('\n', "\n") # tuple sequence
s = '1a,2,3,\n,4,5,6,\n,7,8,9' # subject
print reduce(lambda a, t: a.replace(*t), repls, s) # reduce uses lambda operator, repls seq of tuples , s == start
|
view (3 lines, 3 lines of output) |
repls = (',', ''), ('\n', "\n") # tuple sequence
s = '1a,2,3,\n,4,5,6,\n,7,8,9' # subject
print reduce(lambda a, t: a.replace(*t), repls, s) # reduce uses lambda operatot, repls seq of tuples , s == start
|
view (3 lines, 3 lines of output) |
#no const keyword in Python, so:
def constant(f):
def fset(self, value):
raise SyntaxError
def fget(self):
|
view (27 lines, 3 lines of output) |
#no const keyword in Python, so:
def constant(f):
def fset(self, value):
raise SyntaxError
def fget(self):
|
view (26 lines, 3 lines of output) |
my $d = '\n';
my $str = "1,2,3,$d,4,5,6,$d,7,8,9";
print $str,"\n";
$str =~ s/\\n/\n/g;
$str =~ s/,//g;
|
view (6 lines, 4 lines of output) |
my $str = "'11,12,13\n,14,15,16\n17,18,19'";
$str =~ s/[',]//g; # replace '' with ""
print $str;
|
view (5 lines, 3 lines of output) |
use constant EOL_CHAR => "\n";
my $str = '1,2,3\n,4,5,6\n7,8,9';
$str =~ s/,//g;
my @array = split(/\\n/,$str);
|
view (12 lines, 3 lines of output) |
use constant EOL_CHAR => "\n";
my @arr = qw( 123 456 789 ); # like bash and IFS
$\ = EOL_CHAR;
|
view (13 lines, 5 lines of output) |
use constant EOL_CHAR => "\n";
my @arr = qw( 123 456 789 ); # like bash and IFS
$\ = EOL_CHAR;
|
view (11 lines, 3 lines of output) |
str = String.new('1,2,3\n4,5,6\n7,8,9')
no_commas = str.gsub(/,/,'')
puts no_commas.split(/\\n/)
|
view (3 lines, 3 lines of output) |
str = String.new('1,2,3\n4,5,6\n7,8,9')
puts "Data:\n#{str}\n" # hash{var} gets value like in PHP
no_commas = str.gsub(/,/,'')
puts "\nNow:\n#{no_commas}\n\n"
|
view (8 lines, 9 lines of output) |
str = String.new('1,2,3\n4,5,6\n7,8,9')
puts "Data:\n#{str}\n" # hash{var} gets value like in PHP
no_commas = str.gsub(/,/,'')
puts "\nNow:\n#{no_commas}\n\n"
arr = no_commas.split(/\\n/)
|
view (6 lines, 9 lines of output) |
#no need to create array first
myStr = String.new("1,2,3\n4,5,6\n7,8,9")
puts "The data:\n#{myStr}\n"
nocom = myStr.gsub(/,/,'')
|
view (9 lines, 13 lines of output) |
<?php
$str = "1,2,3\n4,5,6\n7,8,9";
echo $str,"\n\n\n";
$arrStr = preg_split("/[\\n]+/", $str);
|
view (16 lines, 8 lines of output) |
printf("%s: %d %d\n", ("C" < "CZ")? "true C < CZ" : "false C > CZ", 'C', 'CZ');
printf("%s\n", ("C" lt "CZ")? "true: C lt CZ" : "false b/c C gt CZ");
printf("%s\n", ("D" lt "CZ")? "true: D lt CZ" : "false b/c D gt CZ");
|
view (11 lines, 5 lines of output) |
printf("%s: %d %d\n", ("C" < "CZ")? "true C < CZ" : "false C > CZ", 'C', 'CZ');
printf("%s: %d %d\n", ("C" lt "CZ")? "true C lt CZ" : "false C gt CZ");
printf("%s: %d %d\n", ("D" lt "CZ")? "true D lt CZ" : "false D gt CZ");
|
view (11 lines, 5 lines of output) |
printf("%s: %d %d\n", ("C" < "CZ")? "true C < CZ" : "false C > CZ", 'C', 'CZ');
printf("%s: %d %d\n", ("C" lt "CZ")? "true C lt CZ" : "false C gt CZ");
printf("%s: %d %d\n", ("D" lt "CZ")? "true D lt CZ" : "false D gt CZ");
|
view (4 lines, 3 lines of output) |
#no const keyword in Python, so:
def constant(f):
def fset(self, value):
raise SyntaxError
def fget(self):
|
view (24 lines, 3 lines of output) |
use constant EOL_CHAR => "\n";
$str = '1,2,3\n,4,5,6\n7,8,9';
$str =~ s/,//g;
@array = split(/\\n/,$str);
|
view (12 lines, 3 lines of output) |
use constant EOL_CHAR => "\n";
$str = '1,2,3\n,4,5,6\n7,8,9';
$str =~ s/,//g;
@array = split(/\\n/,$str);
|
view (12 lines, 3 lines of output) |
#no need to create array first
myStr = String.new('1,2,3\n4,5,6\n7,8,9')
puts "The data:\n#{myStr}\n"
nocom = myStr.gsub(/,/,'')
|
view (8 lines, 6 lines of output) |
#include <iostream>
#include <string>
#include <boost/algorithm/string.hpp>
#include <sstream>
|
view (32 lines, 3 lines of output) |
#include <iostream>
#include <string>
#include <boost/algorithm/string.hpp>
#include <sstream>
|
view (26 lines, 3 lines of output) |
#include <iostream>
#include <string>
#include <boost/algorithm/string.hpp>
#include <sstream>
|
view (26 lines, 3 lines of output) |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void convert_to_arr(char ** sv) {
|
view (63 lines, 7 lines of output) |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void convert_to_arr(char ** sv) {
|
view (63 lines, 7 lines of output) |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void convert_to_arr(char ** sv) {
|
view (64 lines, 7 lines of output) |
line="1,2,3\n4,5,6\n7,8,9"
clean = line.replace(',','')
words = clean.split('\n');
for nums in words:
print nums
|
view (5 lines, 3 lines of output) |
$str = "1,2,3\n,4,5,6\n7,8,9";
$str =~ s/,//g;
@array = split(/\n/,$str);
foreach( @array ) {
print $_,"\n";
|
view (7 lines, 3 lines of output) |
$string = "1,2,3\n,4,5,6\n7,8,9";
$clean =~ s/,//g;
@array = split(/\n/,$clean);
foreach( @array ) {
print $_,"\n";
|
view (7 lines) |
$string = "1,2,3\n,4,5,6\n7,8,9";
@array = split(/\n/,$string);
foreach( @array ) {
$_ =~ s/,//g;
print $_,"\n";
|
view (7 lines, 3 lines of output) |
$string = "1,2,3\n,4,5,6\n7,8,9";
@array = split(/\n/,$string);
$max = @array; # 3 elements
for ($i=0; $i < $max; $i++)
{
|
view (9 lines, 3 lines of output) |
line="1,2,3\n4,5,6\n7,8,9"
clean = line.replace(',','')
words = clean.split();
for nums in words:
print nums
|
view (5 lines, 3 lines of output) |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void convert_to_arr(char ** sv) {
|
view (64 lines, 7 lines of output) |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void convert_to_arr(int x,int y, char ** sv) {
|
view (66 lines, 7 lines of output) |
#include <stdlib.h>
#include <stdio.h>
int main()
{
printf("%d", "7.100000000000000" == "7.10000000000000001");
|
view (7 lines, 1 line of output) |
#include <stdlib.h>
#include <stdio.h>
int main()
{
printf("%d", 7.100000000000000 == 7.10000000000000001);
|
view (7 lines, 1 line of output) |
<?php
class Test { function __construct(){ var_dump($this);}}
$t1 = new Test;
$other = new stdClass;
$t2 = new Test;
|
view (6 lines, 10 lines of output) |
printf("False: empty string %s\n", (3 < 2));
printf("True (Relational): %d \n", (3 > 1));
if (!0) {
printf("Zero is false\n");
}
|
view (9 lines, 4 lines of output) |
printf("False: empty string %s\n", (3 < 2));
printf("True: %d \n", (3 > 1));
if (!0) {
printf("Zero is false\n");
}
|
view (9 lines, 4 lines of output) |
#include <stdio.h>
#include <stdlib.h>
int main() {
int a=1,b=2,c=3; // comma separator
printf("%d %d %d\n",a,b,c);
|
view (13 lines, 3 lines of output) |
int main() {
int i=0;
if("") printf("empty string is true");
if(!0) printf("\nZero is false");
|
view (10 lines, 2 lines of output) |
#include <stdio.h>
#include <string.h>
int main(void) {
if ("0") printf("\%s", "zero");
|
view (7 lines, 1 line of output) |
#include <stdio.h>
#include <string.h>
int mystrCmp(const char * a, const char * b);
int mystrCmp(const char * a, const char * b){
|
view (18 lines, 2 lines of output) |
#include <stdio.h>
#include <string.h>
int mystrCmp(const char * a, const char * b);
int mystrCmp(const char * a, const char * b){
|
view (18 lines, 2 lines of output) |
#include <stdio.h>
#include <string.h>
int mystrCmp(const char * a, const char * b);
int mystrCmp(const char * a, const char * b){
|
view (18 lines, 2 lines of output) |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int comp_string(char **a, char **b) {
|
view (18 lines, 1 line of output) |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*int comp_string(char **a, char **b) {
|
view (18 lines, 1 line of output) |
<?php
printf("%u\n",0xffffffff ); // 0
printf("%d\n",0xffffffff); // 0
printf("%f\n", hexdec("0xffffffff"));
printf("%f\n",pow(2,64)-1);
|
view (9 lines, 6 lines of output) |
name = "Wanda"
print "W"+"anda"
print name is "W"+"anda"
print name == "W"+"anda"
print name != False and name != True
|
view (7 lines, 5 lines of output) |
name = "Wanda"
print "W"+"anda"
print name is "W"+"anda"
print name == "W"+"anda"
print name != False and name != True
|
view (6 lines, 4 lines of output) |
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<limits.h>
#include<errno.h>
|
view (43 lines, 1 line of output) |
<?php
define("PHP_INT_MIN",~PHP_INT_MAX);
var_dump( PHP_INT_MIN );
var_dump( -PHP_INT_MAX-1 );
var_dump( (int) 0x80000000 );
|
view (5 lines, 3 lines of output) |
<?php
var_dump(dechex((float) "4294967295")); // 'ffffffff'
var_dump(dechex(0 + "4294967295")); // 'ffffffff'
|
view (5 lines, 2 lines of output) |
<?php
var_dump(dechex("4294967295")); // '7fffffff'
var_dump( hexdec("7fffffff")); // 2147483647
|
view (5 lines, 2 lines of output) |
<?php
var_dump( 0x001fffffffffffff ); // float 9.007199254741E+15
var_dump( (int) 0x001fffffffffffff); // int -1
|
view (4 lines, 2 lines of output) |
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
int main(){
printf("%lu\n",0xffffffff );// 4294967295
|
view (8 lines, 2 lines of output) |