Skip to content

Instantly share code, notes, and snippets.

View pinglunliao's full-sized avatar

pinglunliao pinglunliao

View GitHub Profile
//----------------------------------------------------------------
// first.s: Output "Welcome to Assembly World."
//
// compile using: $ as first.s -o first.o
// link using: $ ld first.o -o first
// execute using: $ ./first
//
//----------------------------------------------------------------
.section .data
//----------------------------------------------------------------
// Holan.s: print the 'Holan' in ascii code
//
// compile using: $ as Holan.s -o Holan.o
// link using: $ ld Holan.o -o Holan
// execute using: $ ./Holan
//
//----------------------------------------------------------------
.text # this section is program
.global _start # entry point
//----------------------------------------------------------------
// sum.s:
//
// compile using: $ as sum.s -o sum.o
// link using: $ ld sum.o -o sum
// execute using: $ ./sum
//
//----------------------------------------------------------------
.text # this section is program
.global _start # entry point
public class Expressive {
public static void main(String args[]) {
Expressive puzzler = new Expressive();
puzzler.Oddity();
puzzler.Chage();
puzzler.LongDivision();
puzzler.Elementary();
puzzler.JoyOfHex();
.text
.globl start
.code16
start:
movb $0xE, %ah # write character in text mode for int 10h
movb $'H', %al # write 'H', 'o', 'l', 'a', 'n', ' ', 'w', 'o', 'r', 'l', 'd'
int $0x10
movb $'o', %al
int $0x10
AS = as
LD = ld
OBJCOPY = objcopy
.s.o:
$(AS) -a $< -o $*.o > $*.map
all: disk.img
disk.img: holanBoot.out
qemu-system-i386 -hda disk.img
@pinglunliao
pinglunliao / d010.cpp
Last active November 5, 2019 08:22
d010: 盈數、虧數和完全數 FYI: https://yunlinsong.blogspot.com/2016/01/blog-post_44.html
#include <iostream>
#include <cmath>
using namespace std;
void prtMsg(const int &s, const int &n)
{
if( s == n )
cout << "完全數";
else if( s > n )
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
using namespace std;
int main(){
string input;
#include <iostream>
#include <sstream>
using namespace std;
int main()
{
string str;
while(getline(cin, str))