Skip to content

Instantly share code, notes, and snippets.

View taishi41228's full-sized avatar

Taiyaki taishi41228

View GitHub Profile
@taishi41228
taishi41228 / C_sample.c
Created January 20, 2013 04:52
「hello world」を表示するC言語の初歩的なプログラム。入門書でよく見られる。
#include <stdio.h>
int main(int argc, char *argv[]) {
printf("hello world\n"); // 「hello world」を表示し, 改行を一度行う.
return 0;
}
@taishi41228
taishi41228 / mystrcmp.c
Created January 20, 2013 06:59
文字列探索のサンプルプログラムstring_search.c strlen,strncmp関数を再現した自作の関数
int mystrncmp(char str[], char str2[], int n) {
int i;
for (i = 0; i < n; i++) {
if (str[i] != str2[i]) {
return 1;
}
}
return 0;
}
#include <stdio.h>
int Russian (int x, int y){
int m;
if (x % 2 != 0) {
m = y;
} else {
m = 0;
}
IBOutlet NSMenuItem* item1;
IBOutlet NSMenuItem* item2;
IBOutlet NSMenuItem* item3;
IBOutlet NSMenuItem* item4;
if ([item1 state]) { // item1を選択済み
str3 = [str1 stringByAppendingString:str2];
[textView3 setString:str3];
} else if ([item2 state]) { // item2を選択済み
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
double bekijo(char str[]) {
int operator, count = 0;
double num1, num2;
for (int i = 0; str[i] != '\0'; i++) {
if (str[i] == '+') {
operator = 0;
<?php
echo($_POST['text1']);
?>
int findInt (int a[], int n, int x){
int i;
for (i=0; i < n; i++) {
if (a[i] == x) {
return 1;
} else {
return 0;
}
}
return -1;
#include <stdio.h>
#include <stdlib.h>
struct node{
char data;
struct node* next;
};
/* リストの検索 */
int listSearch( struct node* head, char str ){
@taishi41228
taishi41228 / AppDelegate.c
Created March 5, 2013 00:44
ステータスメニューの表示 ref: http://qiita.com/items/f79e27ddfbe3251669ef
#import <Cocoa/Cocoa.h>
@interface AppDelegate : NSObject <NSApplicationDelegate>
@property (assign) IBOutlet NSWindow *window;
@end
int factorial(int n){
if(n == 1){
return 1;
}
return n * factorial(n-1);
}