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
// 可以只寫單一if | |
if(條件){ | |
運算式 | |
} | |
// 也可以省略大括號,但是只會執行一行 | |
if(條件) | |
運算式; | |
// 也可以寫if / else |
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
int a = 1; | |
printf("%d\n",a++); | |
int b = 1; | |
printf("%d\n",++b); |
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 <string.h> | |
#include <ctype.h> | |
int main(int argc, const char * argv[]) | |
{ | |
int r,c; | |
char* a = "vs lbh pna frr guvf zrffntr, jrypbzr gb wbva gghpfp!"; | |
for(r=1;r<26;r++){ | |
for(c=0;c<strlen(a);c++){ | |
if(isalpha(a[c])){ |
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
from time import sleep | |
import RPi.GPIO as GPIO | |
GPIO.setwarnings(False) | |
GPIO.setmode(GPIO.BOARD) | |
GPIO.setup(13, GPIO.OUT) | |
GPIO.setup(15, GPIO.OUT) | |
GPIO.setup(16, GPIO.OUT) | |
GPIO.output(13,False) | |
GPIO.output(15,False) | |
GPIO.output(16,False) |
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 <string.h> | |
#include<stdlib.h> | |
#include <sys/stat.h> | |
int main(){ | |
FILE* file_a; | |
FILE* file_b; | |
FILE* file_c; | |
char buffer[1024]; | |
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> | |
#define M 5 | |
#define N 6 | |
int max(a,b){ | |
return a>=b?a:b; | |
} | |
int main(){ | |
int x[M] = { 1, 1, 2, 3, 2 }; | |
int y[N] = { 2, 2, 4, 3, 1, 2 }; | |
int c[M][N]; |
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
from threading import Thread | |
import RPi.GPIO as GPIO | |
x = 0 | |
def keyListen(): | |
stat = False | |
global x | |
while 1: | |
if GPIO.input(11) and not stat: | |
stat = True |
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> | |
#define swap(x,y) int t=x;x=y;y=t; | |
typedef unsigned long long ull; | |
ull foo(int a,int b){ | |
ull cycle; | |
ull c,n; | |
ull max = 0; | |
if(a>b){ | |
swap(a,b) | |
} |
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 <string.h> | |
int main(int argc, const char * argv[]) | |
{ | |
char num[1010] = {0}; | |
while(scanf("%s",num)!=EOF){ | |
if(strcmp(num, "0") == 0){ | |
break; | |
} |
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 <ctype.h> | |
struct node{ | |
int cn; | |
char c; | |
}; | |
typedef struct node Node; | |
int main(int argc, const char * argv[]) | |
{ | |
Node cc[26]; |
OlderNewer