language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* * include/sys/dirent.h * * Copyright (C) 2016 ximo<ximoos@foxmail.com> */ #ifndef _SYS_DIRENT_H #define _SYS_DIRENT_H #include <sys/types.h> #define MAX_NAME_LEN 255 struct dirent{ ino_t d_ino; size_t d_reclen; char d_name[MAX_NAME_LEN+1]; }; typedef struct { int dd_fd; } ...
C
#include "lists.h" /** * insert_dnodeint_at_index - Insert a new node at position `idx` * @h: a double pointer to the first element of the list * @idx: the location of the new node in the list; idx begins at 0 * @n: the value of the new node * * Description: This function inserts a new node containing `n` at pos...
C
#include <stdio.h> #include <stdlib.h> #include "matriz.h" int **GeraMatriz(int L, int C, int key){ int i,j; int **m; m = (int**) malloc(L*sizeof(int*)); //Cria um vetor de vetores de ponteiros com a qtde de linhas for (i=0;i<L;i++){ m[i] = (int*) malloc(C*sizeof(int)); //Para cada vetor de ponteiro...
C
#include <string.h> char *CaseInsensitiveTest(char * str) { int len = strlen(str); char *re = malloc(len + 1); re[len] = '\0'; for (int i = 0; i < len; i++) { if (str[i] > 64 && str[i] < 91) { re[i] = str[i] + 32; } else { re[i] = str[i]; } } return re; }
C
/** * @file `level_streams.h` * * `level_streams.h` maps from log levels to streams. * * `level_streams.h` provides and manipulates the mappings * between logging levels and the streams logging messages * are sent to. * * The user can customise the streams using the functions * in this header. * * @aut...
C
/* ƕ_ */ #include <stdio.h> int main(void) { int n; double x; n = 9.99; x = 9.99; printf("int ^ϐ n̒l : %d\n", n); printf(" n / 2 : %d\n", n / 2); printf("double^ϐ x̒l : %f\n", x); printf(" x / 2.0 : %f\n", x / 2.0); return 0; }
C
#include "/players/jenny/define.h" inherit "/obj/treasure.c"; int x; reset(int arg) { if(arg) return; set_id("purse"); set_alias("purse"); set_short(WHT+"A purse"+NORM); set_long( "This is a plain looking white purse. It has lots of zippers and\n"+ "pockets. Who knows, if you 'rummage' thro...
C
/* SPDX-License-Identifier: BSD-2-Clause */ static int ramfs_stat_nolock(struct mnt_fs *fs, struct ramfs_inode *inode, struct k_stat64 *statbuf) { ASSERT(inode); if ((inode->parent_dir->mode & 0500) != 0500) /* read + execute */ return -EACCES; bzero(statbuf, sizeof...
C
#include <stdio.h> int main() { float bruto, impuesto, neto; printf("Salario bruto: "); scanf("%f", &bruto); impuesto = 0.19 * bruto; neto = bruto - impuesto; printf("Impuesto: %.2f\n", impuesto); printf("Salario neto: %.2f\n", neto); }
C
/* * Pizza * ----- * This program is a pizza ordering program. * * It creates a window, several fields for typing in your name, * and several checkboxes and radio buttons for choosing what * you want on the pizza. Having filled in all the information, * a "place order" button will print out the o...
C
//Programa para testear las cachés de directorios > 1 #include "directorios.h" #define DIFDIRS 2 //Se crearán tantos directorios como indique ese valor y dentro de cada uno también int main(int argc, char **argv){ char camino[256]; memset(camino, 0 , sizeof(camino)); unsigned int offset=0; unsigned int e...
C
/* * File name: bitops.h * * Created on: 2017年7月25日, 下午10:43:39 * Author: victor * Toolchain: * Language: C/C++ * description: */ #include <macros.h> #ifndef __INCLUDE_LINUX_BITOPS_H__ #define __INCLUDE_LINUX_BITOPS_H__ static inline int genericFindFirstBitSet(int x) { int r = 1; if (!x) ...
C
// // main.c // AES // // Created by Takahiro Kunii on 2015/11/03. // Copyright © 2015年 Takahiro Kunii. All rights reserved. // #include <stdio.h> #import <CommonCrypto/CommonCrypto.h> int main(int argc, const char * argv[]) { // 平文 const char* text = "Hello cipher\n"; // キー(256ビット=32バイト) i...
C
public class evenodd { public evenodd() { } import java.util.Scanner; public static void main(String args[]) int [] list = new int [20] int i; { for (i = 0; i < list.length; i++); System.out.println("Enter an integer to check if it is odd or even "); int input = keyboar...
C
/*gcc -o play_tri play_tri.c -lsoundio -lm*/ #define C1 261.63f #define D1 293.66f #define E1 329.63f #define F1 349.23f #define G1 392.0f #define A1 440.0f #define B1 493.88f #define C2 523.25f #include <soundio/soundio.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> static float second...
C
#ifndef _CHANNEL_SRC_HEADER_ #define _CHANNEL_SRC_HEADER_ #include <stdint.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <stdlib.h> #include "mapper.h" /* * +=====+=====+=====+=====+=====+=====+=====+=====+=====+ * TYPEDEFS * +=====+=====+=====+=====+=====+=====+=====+...
C
/* * AUTHORS : <jonathanmarpaung88@gmail.com> * VERSION : 1.0.0 * TYPE : Script * LICENSE : MIT */ /* Include header C */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/select.h> #include <termios.h> #include <fcntl.h> /* Include header */ #include "FGTL_System.h" ...
C
/* Rotate an array of N elements K steps */ struct Results { int *A; int N; }; struct Results solution(int A[], int N, int K) { struct Results result; int i, j; result.N = N; if (N == 0) return result; K %= N; result.A = malloc(N*sizeof(int)); for (i = 0, j = K; i<N; ...
C
//Name : ASHISH DONERIYA //COLLEGE : MANIT (BHOPAL, INDIA) #include<stdio.h> #include<string.h> int count=0; int charLast(char str[], char ch, int limit1,int limit2){ int i; for(i=limit2;i>=limit1;i--){ if(str[i]==ch) return i; } return -1; } void sendToLast(char str[], int limit1, int limit2){ int i; char...
C
#ifndef BONE_H_INCLUDED #define BONE_H_INCLUDED #include <stdint.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #define MAX_CHCOUNT 8 #define BONE_ABS_ANGLE 0x01 #define BONE_ABS_POSITION 0x02 #define BONE_ABS (BONE_ABS_ANGLE | BONE_ABS_POSITION) #define MAX_BONECOUNT 20 typedef struct _Bone{ char...
C
#include <stdio.h> int main() { int pt, dal, rice, ptc, dalc, ricec, totalc, remain; scanf ("%d%d%d",&pt,&dal,&rice); ptc=pt*70; dalc=dal*60; ricec=rice*50; totalc=ptc+dalc+ricec; remain=1000-totalc; printf ("total cost is %d tk/n Remain in hands %d tk", totalc, remain); return 0; ...
C
#include <stdio.h> #include <stdlib.h> int main() { // is okay char **s; // is okay char foo[] = "Hello World"; // have to allocate memory first s = malloc(sizeof(char *)); *s = foo; // have to add '*' before s, as we want to print the string itself printf("s is %s\n", *s); ...
C
//AとBの平均2乗誤差(MSE)を出力 double culc_complex_mse(int n,int m,gsl_matrix_complex * A,gsl_matrix_complex * B) { int num = n*m; int i,j; double ans = 0; for (i = 0; i < n; ++i) { for (j = 0; j < m; ++j) { ans += gsl_complex_abs2(gsl_complex_sub(gsl_matrix_complex_get(A,i,j),gsl_matrix_complex_get(B,i,j))); } }...
C
#include <stdio.h> #define WIRE_TYPE_VARINT 0 typedef unsigned char BYTE; main(){ BYTE tag; BYTE wire_type = WIRE_TYPE_VARINT; for(tag = 8;tag <=24;++tag) { if(tag>15){ BYTE byte1 = tag | 0x80; BYTE byte2 = ((BYTE)(tag/16) & 0x78) | wire_type; BYTE byte3 = (tag...
C
#include<stdio.h> void Temperatures(double); int main () { double hsd; printf("亲,输入华摄度值:"); while(scanf("%lf",&hsd)==1) { Temperatures(hsd); printf("亲,输入华摄度值:"); } printf("bey,bey\n"); return 0; } void Temperatures(double hsd) { printf("华氏度%.2f\t 摄氏度%.2f\t 绝对温度%.2f\n",hsd,hsd+32.0,hsd+32.0+237.16); }
C
/* convergence * * A iterated prisoners dilemma warrior for * * Strategy is to randomly chose an action based on the opponent's * history, weighting recent rounds most heavily. Important fixed * point, we should never be the first to betray. */ #include <stdio.h> #include <stdlib.h> #include <time.h> #include <u...
C
/* * Copyright 1998-2000,2002-2016 BitMover, Inc * * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable ...
C
/** * @brief An implementation to use 'space' data type * * Here all functions related to 'space' data types are implemented as well as the structure Object * * @file space.c * @version 1.0 * @date 17/02/2019 * @authors Alonso Aquino Ciro, Conache Alexandra */ #include <stdio.h> #include <st...
C
#include "lists.h" /** * free_list - frees a list * @head: First element list */ void free_list(list_t *head) { list_t *d_head; while (head != NULL) { d_head = head; head = head->next; free(d_head->str); free(d_head); } }
C
/** *\file ges_equipes.h *\brief Ce fichier contient les définitions des fonctions permettant de modifier les équipes. *\author Corentin Petit *\version 1.0 *\date 16/11/2016 */ int creer_perso(t_liste * equipe, t_classe classe, int joueur, int * PE, char mretour[100]); /** * \fn creer_perso(t_liste * equipe, t_class...
C
#include <stdlib.h> #include <stdio.h> void swap(int *a,int *b) { int temp; temp=*a; *a=*b; *b=temp; } void quick_sortf(int *sets,int left,int right) { if(left>=right)return (void) 0; int pivot=sets[left]; int pivot_pos=left; int org_right=right; while(left<right) { while(sets[le...
C
#include <stdio.h> #include <math.h> int main() { int a, b, c; int powed, sum; while (1) { printf("Enter three integers>> "); scanf("%d%d%d", &a, &b, &c); if (a == 0 || b == 0 || c == 0) break; if ((a > b) && (a > c)) { powed = a * a; ...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<stdint.h> #include"lkdsoc.h" enum TYPE{ _CHAR, _int32_t }; int32_t func_hash(void* keyvalue,uint32_t keylen,int arr_size); //int32_t hash_string(char *, int32_t arr_size); //int32_t hash_string(char *, int32_t str_len, int32_t arr_size); PLMAN hmap_...
C
/*** * Mutex test #1 * * Change Log: * 2003/10/22 ghort created * 2003/11/02 pallas cleaned up and integrated * 2004/10/25 pallas updated for new assignment specification */ static char * desc = "Semaphore test #1\n" "Creates a mutex, which is then repeatedly locked and\n" "unlocked by a single thread.\n\n";...
C
#include "nibble.h" #include <assert.h> static int read_nibble(unsigned long w, int i) { assert(i >= 0 && i < 16); unsigned long res = w >> (i * 4); return res & 0xf; } static void write_nibble(unsigned long *w, int i, int v) { assert(i >= 0 && i < 16); unsigned long mask = 0xf; mask <<= (i * 4); *w &=...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_unsigned.c :+: :+: :+: ...
C
// probex5-5.(難易度:★) // キーボードから2つの文字列を入力し、2つが同じものならば、「同じものです」と表示し、違うのならば、「違うものです」と表示するプログラムを作りなさい。ただし、文字列の比較にはstrcmp()関数を用いること。 // 期待される実行結果①(二つの文字列が同じ場合) // 文字列1:ABC ← キーボードから入力 // 文字列2:ABC ← キーボードから入力 // 同じものです // 期待される実行結果②(二つの文字列が異なる場合) // 文字列1:ABC ← キーボードから入力 // 文字列2:DEF ← キーボードから入力 // 異なるものです #include <stdio.h>...
C
#include "cds.h" typedef struct Object_ { int32_t iId; char *szName; } Object; void DestroyObject(Item item) { Object *pObj = (Object*)item; free(pObj->szName); free(pObj); } int main() { LinkedList *pList; /* You should initialize the DS before any operations. */ int32_t rc = Lin...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "list.h" /* OPERAZIONI PRIMITIVE */ list emptyList(void) /* costruttore lista vuota */ { return NULL; } boolean empty(list l) /* verifica se lista vuota */ { return (l == NULL); } list cons(Element e, list l) { list t; /* costruttore che...
C
/* * Copyright (c) 2012-2013 Spotify AB * * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in wr...
C
/* monster.c -- Implementation of monster actions */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <math.h> #include "dungeon.h" // for defining some monster types below that can be used in the game typedef struct { char name[20]; // Name of monster char sign; // character to show it on map ...
C
/*------------------------------------------------------------------------- * * unix_latch.c * Routines for inter-process latches * * The Unix implementation uses the so-called self-pipe trick to overcome * the race condition involved with select() and setting a global flag * in the signal handler. When a latc...
C
#include <stdio.h> int gcd(int n1, int n2) { if (n2) return abs(gcd(n2, n1 % n2)); else return abs(n1); } void funtion(int *a, int *b) //約分 { while(gcd(abs(*a), abs(*b)) != 1) { int g = gcd(abs(*a), abs(*b)); *a /= g; *b /= g; } if( ((*a)*(*b)) < 0 ) { *a = -abs(*a); *b = abs(*...
C
/* * send_test.c -- multicasts "hello, world!" to a multicast group once a second * * Created By: Antony Courtney 25/11/94 * Modified By: Steve Emmerson 2015-04-03 * Steve Emmerson 2019-02-11 */ #define _XOPEN_SOURCE 600 #include "send_recv_test.h" #include <arpa/inet.h> #include <netinet/i...
C
#include <stdio.h> #include <stdlib.h> #define MAX_SIZE 1000 int main( int argc, char* argv[ ] ){ int i; int number_of_points; long random_num; if( argc > 1 ) { number_of_points = atoi( argv[ 1 ] ); } else { i = scanf("%d", &number_of_points); } printf("%d\n",number_of_points); for(i=0;i<number_of_p...
C
#include <stdio.h> // Write a function called "GetSurface" that takes a RectangularCuboid // and returns it's surface // Write a function called "GetVolume" that takes a RectangularCuboid // and returns it's volume typedef struct rectangular_cuboid { double a; double b; double c; }rectangular_cuboid_t; d...
C
#include <stdio.h> #include<conio.h> #include<windows.h> char map_reading[30][30][5], map_undo[30][30], map_rn[30][30][5]; void load(); void undo(); void map_print(); void key_all(char); void key_hjkl(char); void rn_get(); void rn_put(); void level_clear(); void goal_get(); void player_name(); void file_save(); void fi...
C
#include "mathProcesing.h" #define STB_IMAGE_IMPLEMENTATION #include "../3rdParty/stb_image.h" Tensor *readImagineToTensor(char *filename) { int width, height, nChannels; unsigned char *data = stbi_load(filename, &width, &height, &nChannels, 0); Point point = {width, height, nChannels}; Tensor *tens...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/socket.h> #include <netinet/ip.h> #include <netinet/udp.h> #include <arpa/inet.h> #include <unistd.h> #include <errno.h> typedef struct iphdr iph; typedef struct udphdr udph; typedef struct { unsigned short id; // ID unsigned short flags; //...
C
#ifndef __HEAP_H__ #define __HEAP_H__ #include <stdlib.h> #include <math.h> /* We assume there is a defined primitive type Item. */ typedef struct { int prior; // Item priority Item data; // Item d }ItemType; typedef struct heap{ long maxHeapSize; // capacity long size; // number of elements Item...
C
#ifndef IRQ_H #define IRQ_H #include <stdinc.h> /* All the PIC related ports */ #define PIC1_PORT 0x20 /* IO base address for master PIC */ #define PIC2_PORT 0xA0 /* IO base address for slave PIC */ #define PIC1_COMMAND_PORT PIC1_PORT #define PIC1_DATA_PORT (PIC1_PORT+1) #define PIC2_COMMAND_PO...
C
/* ======================================== * * Copyright YOUR COMPANY, THE YEAR * All Rights Reserved * UNPUBLISHED, LICENSED SOFTWARE. * * CONFIDENTIAL AND PROPRIETARY INFORMATION * WHICH IS THE PROPERTY OF your company. * * ======================================== */ // functions for serial IO #include "Se...
C
#include <stdio.h> int maxCresc (int v[], int N){ int x, i, count, maior, p; maior = 0; for ( x = 0; x < N; x++){ count = 1; p = x+1; for (i = x; v[i] <= v[p]; i++){ p++; count++; } if (count > maior){ maior = count; } ...
C
#include <stdio.h> int main(){ int diainit,mesinit,diafinal,mesfinal; int resposta; scanf("%d %d %d %d", &diainit, &mesinit, &diafinal, &mesfinal); // se a data final estiver no passado if((mesfinal < mesinit) || (mesfinal == mesinit && diafinal < diainit)) { // um ano menos a diferenca entre o...
C
/* Rotary encoder readout * Encoder on statusport 1 bits 5-7 * GND on GND (pin 20) * Input patterns : cw: 1,0,2,6,7,5, ccw: 5,7,6,2,0,1 */ #include <stdio.h> #include <dos.h> #include <conio.h> int dataport, statusport, controlport; int counter; main(int argc, char *argv[]) { unsigned int encda...
C
#include <sys/time.h> #include <stdio.h> #include "hashdict.h" int time1000() { struct timeval val; gettimeofday(&val, 0); val.tv_sec &= 0xffff; return val.tv_sec * 1000 + val.tv_usec / 1000; } int main() { int best_ins = 9999, best_find = 9999, t, iters = 10; printf("running %i iterations\n", iters); fflush(0)...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strrchr.c :+: :+: :+: ...
C
#include<stdio.h> #include<conio.h> #include<unistd.h> #define N 10 typedef struct { int pid, at,bt,pp; int q, ready; } process_structure; int Queue(int time1) { if(time1==0 || time1==1 || time1==2 ||time1==3) { return 1; } else ...
C
/* 201512221:24:44 ĿģԱwhiledo whileѭ */ # include <stdio.h> int main() { int i, sum = 0; printf("please enter i, i="); scanf("%d", &i); while (i <= 10) { sum = sum + i; i++; } printf("sum=%d\n", sum); return 0; } /* please enter i, i=1 sum=55 Process returned 0 (0x0...
C
int* plusOne(int* digits, int digitsSize, int* returnSize){ int i = 0; for (i = digitsSize - 1; i>= 0; i--){ if (digits[i] < 9){ digits[i]++; *returnSize = digitsSize; return digits; } digits[i] = 0; } in...
C
/**************************** * InsertionSort Algorithm * Code by Lu-Dien Duong *****************************/ #include <stdio.h> void swap(int *a, int *b) { int tmp; tmp = *a; *a = *b; *b = tmp; } void InsertionSort(int arr[], int n) { int i, j; for(i=1; i<n; i++) { j = i; while(j>...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> const unsigned long long ZERO = 0ull; const unsigned long long ONE = 1ull; const unsigned long long TWELVE = 12ull; const unsigned long long THIRTEEN = 13ull; const unsigned long long FIFTY_TWO = 52ull; const unsigned long long FIFTY_THREE = 53ull; const unsig...
C
#include "lcd_driver.h" void LCD_init(void) { SYSCTL_RCGCGPIO_R |= 0x03; // Enable clock for GPIOA GPIOB GPIO_PORTA_DEN_R |= 0xE0; GPIO_PORTA_DIR_R |= 0xE0; // pins 5->7 output GPIO_PORTB_DEN_R |= 0xFF; GPIO_PORTB_DIR_R |= 0xFF; //pins output //initialization delayMs(20); LCD_command(0x30); ...
C
#include<stdio.h> #pragma warning(disable : 4996) int solve(int, int*); int flipadd(int); int ispalin(int); int flipadd(int num) { int cnt = 0; // ڸ int sum = 0; // int before, after = 0; // Լ , int divide[30] = { 0, }; // ڸ и int digit = 1; // ڸ(1, 10, 100, ...) before = num; // ù ʱȭ while (num != 0) { ...
C
#include "binary_trees.h" /** * binary_tree_inorder - print a binary tree using inorder traversal * @tree: tree pointer * @func: function pointer to use on value of node * Return: 1 if leaf, 0 if not */ void binary_tree_inorder(const binary_tree_t *tree, void (*func)(int)) { if (tree == NULL || (*func) == NULL) re...
C
#include<stdio.h> char code[102][1005];//储存字符串 int main() { int ans = 1005, distance;//ans为最后的最小值,初始值为1005 int n, m; scanf("%d%d", &n, &m); int i; for (i = 0; i < m; i++) { scanf("%s", code[i]); } for (i = 0; i < m; i++) { int j; for (j = i + 1; j < m; j++) { distance = 0;//注意变量的重新赋值 int k; ...
C
#include "holberton.h" /** * get_bit - this function returns the "n" bit of a number. * @n: the number, unsigned long int type. * @index: a given index, starting from 0 (less significative bit). * * Return: two possible outputs * 1. if successful, it returns the value of bit at index. * 2. if error, it returns ...
C
/* * WAP in C to add two complex numbers using the concept of structure. */ #include <stdio.h> struct complex { int re; int imz; } a, b, sum; int main() { printf("Enter the real and imaginary part of 1st number: \n"); scanf("%d%d", &a.re, &a.imz); printf("Enter the real and imaginary part of ...
C
// Searching in a Array #include<stdio.h> struct Array { int A[10]; int size; int length; }; void Display(struct Array arr) // O(n) { int i; printf("\nElements are\n"); for(i=0; i < arr.length; i++) printf("%d ",arr.A[i]); } void swap(int *x,int *y) { int temp= *x; *x= *...
C
#include <stdio.h> #include <stdlib.h> #define AA(a, b, c) int aa(int a, int b, int c =1) \ { \ printf("%d %d %d \n" , a, b ,c); \ return 0; \ } int bb (int a, int b, int c=1) { int z = a+b+c; printf("sum is %d\n", z); return 0; } int main() { bb(3,6); return 0; }
C
#include <stdio.h> #include <stdlib.h> //system() int main00(void) { int a[] = { 10, 7, 1, 9, 4, 6, 7, 3, 2, 0 }; int n = sizeof(a) / sizeof(a[0]); //Ԫظ int i = 0; printf("before sort: \n"); for (i = 0; i < n; ++i) { printf("%d ", a[i]); } printf("\n"); //ѡ /* 10, 7, 1, 9, 4, 6, 7, 3, 2, 0 7, 10,(10 > ...
C
int main(){ char computer; printf("ss"); printf("bb"); scanf("%c",&computer); switch (computer) { case 'a': printf("a computer"); break; case'b': printf("b computer"); break; default: printf("not good"); }re...
C
#include <stdio.h> #include <stdlib.h> int main() { int a=4; int b=6; int add=a+b; int sub=a-b; int mult=a*b; int div=a/b; int mod=a%b; printf("%d ",add); printf("%d ",sub); printf("%d ",mult); printf("%d ",div); printf("%d ",mod); }
C
#include<stdio.h> void main() { int v,j,i,rem,temp; int num=0; printf("enter the values"); scanf("%d%d",&v,&j); printf("armstrong between two intervals"); for(i=v+1;i<j;++i) { temp=i; while(temp!=0) { rem=(temp%10); num+=rem*rem*rem; temp/=10; } } if(i==num) { printf("%d",i); } }
C
#define ERROR_EXIT(rcode) \ do { \ printf("ERROR: %s:%s:%u: rcode=%d\n",__FILE__ , __FUNCTION__ ,__LINE__,rcode); \ fflush(stderr);\ exit(rcode); \ }while(0); #define ERROR_PT_EXIT(rcode) \ do { \ printf("ERROR: %s:%s:%u: rcode=%d\n",__FILE__ , __FUNCTION__ ,__LINE__,rcode); \ fflush(stderr);\ p...
C
#include "include.h" chaine_t *creerListe(int i) { chaine_t *liste = malloc(sizeof(chaine_t)); liste->val = i; liste->suivant = NULL; return liste; }
C
#include<stdio.h> #include<conio.h> void main() { int p,r,n; float ci; clrscr(); printf("\n enter value of p"); scanf("%d",&p); printf("\n enter value of r"); scanf("%d",&r); printf("\n enter value of n"); scanf("%d",&n); ci=p*(1+r/100)^n; printf("\n compound interest is %f ",ci); getch(); }...
C
/** * *cap_string - function that concatenates two strings. * @c: character validado * Return: *char */ char *cap_string(char *c) { int a, b; b = 0; if (c[0] >= 97 && c[0] <= 122) { c[0] = c[0] - 32; } a = 0; while (c[a] != '\0') { if (c[a] == 32 || c[a] == '\t' || c[a] == '\n' || c[a] == ',') b = ...
C
#include <iostream> #include <TRandom.h> #include <TCanvas.h> #include <TF1.h> #include <TRandom3.h> #include <TString.h> #include <TAxis.h> #include <algorithm> #include <math.h> Double_t getBaselineCurr( TRandom3* random=NULL) { Double_t scale=1.; if(random != NULL) { scale *= random->Gaus(1.,0.05); } return scal...
C
#include <stdio.h> #include <math.h> int sumOfSquares(int start, int end); int squareOfSums(int start, int end); int main() { int sum = sumOfSquares(0, 100); int square = squareOfSums(0, 100); printf("Sum Square Difference\n"); printf("The difference between the problems is: %d\n", square - sum); ...
C
#include <stdio.h> #include <stdlib.h> int main(void) { int highestRainfall = 0; int currentRainfall = 0; printf("%s", "Enter highest rainfall ever in one season: "); scanf("%d", &highestRainfall); printf("%s", "Enter rainfall for current year: "); scanf("%d", &currentRainfall); if (curr...
C
/*! * (c) 2006-2008 EPFL, Lausanne, Switzerland * Thomas Lochmatter */ #include "commandline.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <netinet/in.h> #include <sys/socket.h> #include <unistd.h> #include <netdb.h> // Algorithm parameters and results struct sAlgorithm { struct { int p...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include<string.h> //--SPLIT-- /** * @input a : Integer * @input b : Integer * * @Output Integer */ //-int uniquePaths(int a, int b) { //-} //--SPLIT-- int uniquePaths(int a, int b) { return 0; } //--SPLIT-- int main() { setbuf(stdout, NULL); int t...
C
#include "lists.h" #include <stdlib.h> /** *free_listint - frees the contents of a listint_t *@head:pointer to list *Return:void */ void free_listint(listint_t *head) { listint_t *temp; if (head == NULL) return; for (temp = head; temp; temp = temp->next) { free(temp); } }
C
#include <stdio.h> #include "locale.h" #include "stdbool.h" int n; void BubbleSort(A); void printArray(A); void check(A); void InsertionSort(A); void Shella(A); void menu() { printf("\n (*^_^*) "); printf("\n ==================| |===================\n"); printf(" ...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <unistd.h> #include "config.h" #include "entity.h" #include "patterns.h" #include "utils.h" int main(int argc, char* argv[]) { printf("CS:GO offsets dumper for Linux x64 (by foxadb)\n"); if (getuid() != 0) { fprintf(stderr, "Run the program as ...
C
#include<stdio.h> #include<conio.h> void main(){ int A=-10,B=20; int c,d,e,f; c=A&B; d=A|B; e=~A; f=A^B; printf("A&B=%d\nA|B=%d\n ~a=%d\nA^B=%d",c,d,e,f); getch(); }
C
#include<stdio.h> int main() { int a[12], i, j, k, l; //taking integer input in an array for(i=0; i<=10; i++) scanf("%d,", &a[i]); /*checking whether the integer is among the given integers or not and then assigning the values to k and l accordingly*/ for(j=0; j<10; j++) { if(a[j]==a[10]) { k = 1; ...
C
#include <unistd.h> #include <fcntl.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #include "parser.h" #include "array.h" #include "command.h" static int prefix(const char *pre, const char *str){ return strncmp(pre, str, strlen(pre)) == 0; } static int count_spaces (char* s){ int spaces=0; ...
C
#include <limits.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> #include "file_utils.h" char *get_working_directory () { char buffer[PATH_MAX]; char *result = malloc (sizeof (buffer)); if (getcwd (buffer, sizeof (buffer)) != NULL) { sprintf (result, "%s", buffer); ...
C
#include <math.h> #include "anims.h" #include "eases.h" static const int frames_per_sec = 60; void * init_context () { pthread_mutex_lock (&mutex); cairo_t *cr = cairo_create (surface); cairo_set_source_rgb (cr, 1, 1, 1); cairo_rectangle (cr, 0, 0, surface_width, surface_height); cairo_fill (cr);...
C
#include "stdio.h" #include "stdlib.h" #include <execinfo.h> #include "colors.h" #include "assert.h" int main() { Dims dimensions; dimensions.cols = 1; assertEquals(1, dimensions.cols); printf(GREEN "All tests passed!\n" RESET); }
C
/* * The Python Imaging Library. * $Id$ * * decoder for Targa RLE data. * * history: * 97-01-04 fl created * 98-09-11 fl don't one byte per pixel; take orientation into account * * Copyright (c) Fredrik Lundh 1997. * Copyright (c) Secret Labs AB 1997-98. * * See the README file for information on usage and...
C
#include "headers.h" extern int opterr; extern int optopt; extern int optind; /* * Display file details similar to the ls -l command * it recognises -i (inode), -l (long ) options */ void print_headings(void); void showfile(const char*); int lflag = 0, iflag = 0; int main(int argc, char *argv[]) { int i; ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* fd_agregator.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> struct Kisi{ char ad[100][80]; int yas; }; int main() { char tisimler[100][80], tmp[80]; struct Kisi* kisiler; int sayi; printf("Kisi sayisini giriniz:"); scanf("%d",&sayi); kisiler=malloc(sayi * sizeof(struct Kisi)); for(int i=...
C
#include<stdio.h> #include<stdlib.h> #include<sys/types.h> #include<sys/stat.h> #include<fcntl.h> #include<unistd.h> int main(int argc, char *argv[]) { int fd; char buf[] = "test for log.txt of unlink functioni!\n"; if( (fd = open("log.txt", O_RDWR|O_CREAT)) <0) { printf("open log.txt error!\n"); ...
C
// cf_cstl_pair.h #ifndef __CF_CSTL_PAIR_H #define __CF_CSTL_PAIR_H #include "cf_cstl_iterator.h" #include "cf_cstl_memory.h" #define c_pair _c_pair #define c_ppair _c_ppair #define c_iter_bool_pair _c_iter_bool_pair #define c_piter_bool_pair _c_piter_bool_pair #define c...
C
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward d...
C
#ifndef EXCEPT_H_ #define EXCEPT_H_ #include <setjmp.h> //定义异常对象,只能放到全局环境 typedef struct Except_T{ char *reason; } Except_T; typedef struct Except_Frame Except_Frame; struct Except_Frame{ Except_Frame *prev; jmp_buf env; const char *file; int line; ...