This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Ex { | |
public static List<object> Flatten(this List<object> list) { | |
var result = new List<object>(); | |
foreach (var item in list) { | |
if (item is List<object>) { | |
result.AddRange(Flatten(item as List<object>)); | |
} else { | |
result.Add(item); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
bool a(bool in) | |
{ | |
cout << "a" << endl; | |
return in; | |
} | |
bool b(bool in) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<iostream> | |
#include<conio.h> | |
#include<iomanip> | |
using namespace std; | |
const int ROW = 5; | |
const int COL = 5; | |
class matrix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use 26 since it’ll never actually equal 26 | |
# Floor will return integers; stores in vector | |
nums <- c(floor(runif(20, min=-10, max=26))) | |
# Give the chart file a name | |
png(file = “boxplotrand.png”) | |
# Plot the graph, using vector nums from first question | |
boxplot(y ~ x, data = nums, xlab = “X Values”, | |
ylab = “Y Values”, main = “Values”) | |
# Save the file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"fmt" | |
"os" | |
"strings" | |
) | |
func main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <signal.h> | |
main () | |
{ | |
void (*oldHandler) (); /* To hold old handler value */ | |
int count = 0; /* Loop counter, initialized at 0 */ | |
oldHandler = signal (SIGINT, SIG_IGN); /* Ignore Control-C */ | |
printf ("I've started looping and I can't be killed with ^C\n"); | |
while(1) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
declare -i counter sum | |
declare -a -i var | |
declare -a order | |
order=([0]="first" [1]="second" [2]="third" [3]="fourth" [4]="fifth") | |
counter=0 | |
sum=0 | |
while(($counter < 5)) | |
do | |
echo "Enter the ${order[$counter]} number to add:" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <ctype.h> | |
int main(){ | |
int year; | |
printf("Type a year (up to 4 digits) to determine if it's a leap year:"); | |
scanf("%d",&year); | |
getchar(); | |
if(((year<0)||(isalpha(year))||(year>9999))){ | |
printf("Invalid year. Try again.\n"); |
OlderNewer