Skip to content

Instantly share code, notes, and snippets.

View Bojne's full-sized avatar

Aaron (Yueh-Han) Huang Bojne

View GitHub Profile
#include "stdio.h"
int main(void) {
int leap_year(int y)
{
int is_leap;
is_leap = (y % 400 == 0) ||
((y % 4 == 0) && !(y % 100 == 0));
return is_leap;
}
@Bojne
Bojne / test.c
Created November 8, 2015 15:55
同學的程式
#include<iostream>
#include<cstdlib>
#include<stdio.h>
#include<conio.h>
#include<time.h>
using namespace std;
int main()
{
int monlife[5];
int action, target;

Week12_log

I learned a language called MarkDown and parcticing it now.

Mon / Science Maker (Co-teacher?)

  • "It's Monday again..." I thought. It's been one week past since last science-maker class. Once again, I didn't prepare for the class as I should.
  • We already tought two-third of the semester. But I feel that we're not controling the class. Are we going to teach them Math, Physics and English? Are the be able to learn the comtent in the way we tought? How can we make the class interesting and still contents some knowledge?
  • Bernard is the real teacher anyway, I shouldn't lead the class to much.
  • During the class this week, I'm annoyed by the people, not really angry with them, but it's becasue we didn't set the class well.
  • I know that if I just let the class go, things will still be fine. But I beliveve that I can improve the class, and I want to do it...
  • Any advice? Perhaps add some out-door class instead of sitting in the classroom for two hours, or have individual time to people w
# Week12_log
*I learn a language called MarkDown and parcticing it now.*
### Mon / Science Maker (Co-teacher?)
- *"It's Monday again..."* I thought. It's been one week past since last science-maker class. Once again, I didn't prepare for the class as I should.
- We already tought two-third of the semester. But I feel that we're not controling the class. Are we going to teach them Math, Physics and English? Are the be able to learn the comtent in the way we tought? How can we make the class interesting and still contents some knowledge?
- Bernard is the real teacher anyway, I shouldn't lead the class to much.
- During the class this week, I'm annoyed by the people, not really angry with them, but it's becasue we didn't set the class well.
- I know that if I just let the class go, things will still be fine. But I beliveve that I can improve the class, and I want to do it...
- Any advice? Perhaps add some out-door class instead of sitting in the classroom for two hours, or have individual time to people who
@Bojne
Bojne / prime.py
Last active June 11, 2016 12:58
#找到兩百萬以下所有質數的和
def prime_num_list(max_num):
x = 2 #最小的質數
prime = [2]
checkNum = None #用於檢測是不是質數,如果是 = True
while x < max_num:
checkNum = True
#檢查每個質數表裡的數,如果都不是表裡的倍數,x就是質數
for prime_num in prime:
if x % prime_num == 0: #發現x可被某數整除,不是質數
checkNum = False
@Bojne
Bojne / CH08EX02.cpp
Last active November 23, 2017 13:04
#include <iostream>
#include <string>
using namespace std;
string user_input;
string regis_year, campus, course, faculty;
void display(string regis_year,string campus,string course, string faculty);
int main(){
cout << "Please enter your registration number below and press enrer.\n";
#include<iostream>
using namespace std;
int* create2DArray(int rows,int columus){
int *int_p;
int_p = new int[rows*columus];
return int_p;
}
#include <iostream>
#include <string>
using namespace std;
class Instructor{
public:
Instructor();
Instructor(string faculty, string title, string name, char gendar);
@Bojne
Bojne / prob.py
Last active October 29, 2018 10:00
“In raquetball, a player continues to serve as long as she is winning; a point is scored only when a player is serving and wins the volley. The first player to win 21 points wins the game. Assume that you serve first and have probability .6 of winning a volley when you serve and probability .5 when your opponent serves. Estimate, by simulation, …
import numpy as np
# Parameters - First game and winning prob.
initial = np.array([0.6,0.4]) #first game
prob_matrix = np.array([[0.6,0.4],[0.5,0.5]])
# Calculate the n product of a vector and prob_matrix
def multiple_dot(vector, n):
if (n == 0):
df <- data.frame(Father = runif(200, min=150, max=190),
Mother = runif(200, min=140, max=180),
N = 10 * rnorm(200),
Kid = round(mother_h * 0.4 + father_h * 0.6 + noise,2))
print (df)