Skip to content

Instantly share code, notes, and snippets.

View toanalien's full-sized avatar
🎯
Focusing

Thiên Toán toanalien

🎯
Focusing
View GitHub Profile
@toanalien
toanalien / 1433524868.cpp
Created June 5, 2015 17:21
sort an array using pointer
#include <stdio.h>
#include <conio.h>
#include <string.h>
#define MAXLEN 10
#define MAXNUM 5
int main()
{
char cname[MAXNUM][MAXLEN];
char *cptr[MAXNUM];
@toanalien
toanalien / 1433524868.cpp
Created June 5, 2015 17:35
pointer point to pointer
#include <stdio.h>
#include <conio.h>
#define ROWS 4
#define COLS 5
int main()
{
int table_i[ROWS][COLS] = {
{10,12,14,16,18},
{11,13,15,17,19},
@toanalien
toanalien / 1433528131.cpp
Created June 5, 2015 18:15
pointer point to struct
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 10
typedef struct SSTUDENT
{
char Name[10];
float Mark;
struct SSTUDENT *pNext;
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
using namespace std;
#define MAX 50
typedef struct SSTUDENT
{
char Name[30];
#include <stdio.h>
#include <stdlib.h>
struct node
{
int item;
struct node *next;
};
typedef struct node *listnode;
@toanalien
toanalien / 1433560158.cpp
Created June 6, 2015 03:31
separated string
// nguyen van b#8#9#10
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char *s1, *s2;
char s3[2];
@toanalien
toanalien / 1433606738.cpp
Created June 6, 2015 16:07
english-vietnamese dictionary extractor
/**
* download dictionary at http://blackberryvietnam.net/threads/du-lieu-tu-dien-cho-ung-dung-ddict.897/
*/
#include <stdio.h>
#include <string.h>
int main()
{
char s[300];
@toanalien
toanalien / 1433668831.cpp
Last active August 29, 2015 14:22
extract phrases from dictionary file and add to hash table
/**
* Created by toanalien on 6/7/2015.
*/
// download dictionary at http://blackberryvietnam.net/threads/du-lieu-tu-dien-cho-ung-dung-ddict.897/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 29
@toanalien
toanalien / 1434087604.sh
Last active August 29, 2015 14:22
seedbox
#!/bin/sh
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
@toanalien
toanalien / gist:baca180b2a036f1a8d05
Last active August 29, 2015 14:24
demo chatbox via tcp by nodejs
/**
* @toanalien
*/
var net = require('net');
var server = net.createServer();
var sockets = [];
server.on('connection', function(socket) {
console.log('got a new connection');