language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include<stdio.h> #include<string.h> #include<stdlib.h> #include<unistd.h> #include<arpa/inet.h> #include<sys/socket.h> #include<netinet/in.h> #include<netdb.h> int main(int argc, char **argv) { if(argc<2) { printf("[host] [puerto]\n"); return 1; } int puerto, conexion; char buffer[200]; /* ...
C
#include <stdio.h> #include <stdlib.h> typedef struct{ int top; int size; int a[1000]; }stack_t; int isFull(stack_t *s){ if(s->size == s->top) return 1; else return 0; } int isEmpty(stack_t *s){ if(s->top == 0) return 1; else return 0; } void push(stack_t *s, int ele){ if(isFull(s)){ printf("sta...
C
//#include <stdlib.h> /* * File: leds.h * Author: Fabio WD/Felipe Cabral * * Created on 12 de Junho de 2017, 08:48 */ // #define LED_ONOFF PIN_D0 #define LED_W_P2 PIN_D1 #define LED_W_P1 PIN_D2 #define LED_YELLOW PIN_D3 #define LED_RED PIN_D4 #define LED_GREEN PIN_D5 #define LED_BLUE PIN_D6 ...
C
#include<stdio.h> #include<stdlib.h> struct tree{ int data; struct tree *left; struct tree *right; }; struct tree* insert(struct tree* node, int data) { if(!node){ node=malloc(sizeof(struct tree)); node->data=data; node->left=node->right=NULL; return node; } else { if(data>node->data){ ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_atoi_base.c :+: :+: :+: ...
C
/****************************************************************************** cardtest4.c Sharon Kuo (kuos@oregonstate.edu) CS362-400: Assignment 3 Description: Unit testing for the council room card, as implemented in councilRoomCard(). Draws 4 cards to the player's hand, adds 1 buy, and each other player draws ...
C
/* * calc.h * Anirudh Tunoori netid: at813 */ #ifndef calc_h_included #define calc_h_included typedef enum id { binary, hexadecimal, octal, decimal,undefined } identity; //enum identity struct number_ { //number struct char* numStr; int sign; int value; char initialForm; enum id identity; }; ty...
C
/*#include <stdio.h> #include<sys/types.h> #include<unistd.h> #include<stdlib.h> int main() { pid_t pid; pid = fork(); switch(pid){ case 0: while(1) { printf ("a background process,childpid:%d,parentpid:%d\n",getpid(),getppid()); sleep(3); } case -1: ...
C
#include <stdio.h> #include <stdlib.h> void main() { int c, number=0; char op; FILE *fp; if((fp=fopen("test.txt","r"))==NULL) { perror("FILE open error"); exit(-1); } while(!feof(fp)) { while((c=fgetc(fp))!=EOF && isdigit(c)) number=10*number+c-'0'; if(c=='\n') continue; fprintf(stdout,"ope...
C
#include <linux/init.h> #include <linux/module.h> #include <linux/device.h> #include <linux/fs.h> struct class *hello_class; struct semaphore sem_open; struct semaphore sem_read; struct semaphore sem_write; int hello_open(struct inode *inode, struct file *filp){ //try to get semaphore sem_open if(down_trylock(&sem_...
C
#include "memory.h" #include "stdint.h" #include "print.h" #include "global.h" #include "debug.h" #include "string.h" #define PG_SIZE 4096 #define K_HEAP_START 0xc0100000 #define MEM_BITMAP_BASE 0xc009a000 #define PDE_IDX(addr) ((addr & 0xffc00000) >> 22) #define PTE_IDX(addr) ((addr & 0x003ff000) >> 12) struct pool...
C
/*conversion of Cartesian coordinates to Polar Coordinates */ #include<stdio.h> #include<math.h> int main(){ double x_abscissa , y_ordinates; double r,$; printf("Enter the X (ABSCISSA) : "); scanf("%lf",&x_abscissa); printf("Enter the Y (ORDINATES) : "); scanf("%lf",&y_ordinates); r=sqrt(x_ab...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <pthread.h> #include <sys/types.h> typedef struct process { int at, bt, tat, ct, wt; } process; int n; /// number of processes void FCFS(process p[]) { int cur = 0; /// Current time /// We execute in the given order ...
C
/*Car is traveling at a speed of 80 km/hr and a truck is stationed at a distance of 30 mts. Truck will start moving exactly after 3 second. If the car driver applies brake now find out whether car will hit the truck or not. (distance = ((initial velocity + final velocity )/2 ) * time ).*/ #include<stdio.h> #d...
C
#include <stdio.h> #include <math.h> #include <stdlib.h> #include <time.h> char *lines[]={ "3.25 -0.1 3.55 -0.1 0 start", "3.4 -0.1 3.4 0.5 0 l01", "3.4 0.5 3.7 0.8", "3.5 0.6 5.4 0.6 0 l03", "3.7 0.8 4.1 1.2", "4.0 1.1 5.6 1.1 0 l04", "5.6 0.80 5.6 2.2 0 l09", "4.1 1.2 4.1 1.6 0 l05" , "4.1 1.6 4....
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include "ft_list.h" void ft_list_foreach_if(t_list *begin_list, void (*f)(void *), void *data_ref, int (*cmp)()); void my_f(void *data) { printf("%s\n", (char*)data); } int ft_strcmp(char *s1, char *s2) { int c; c = 0; while ((*(s1...
C
#include "types.h" #include <stdio.h> #include <stdlib.h> s_int pop(stack *S); void push(stack *S, s_int value); node_t *new_node(s_int val); void debug_node(node_t *node); void debug_msg(const char* msg); int stack_empty(stack *S); void append(list *L,s_int value); int remove_val(list *L,s_int value); s_int p...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <getopt.h> #include <unistd.h> #include <string.h> #include "kmeans.h" #include "log.h" extern struct kmeans_config *kmeans_config; /** * Initialize a new config to hold the run configuration set from the command line */ struct kmeans_config *new...
C
#include <stdio.h> int main(){ //char* name char name[255]; int age; printf("Hello there, what's your name?:\n"); scanf( "%s" , name); printf("How old are you %s?\n", name); scanf("%d", &age); if (age<18){ printf("I'm sorry %s, you need to be 18+ to enter this website\n", na...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <netinet/in.h> #include <net/if.h> #include <arpa/inet.h> #include <netdb.h> #include <ifaddrs.h> #include <ctype.h> #include <fcntl.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/ioctl.h> #define AC ...
C
/* Ce programme produit une PDU-UDP destination du processus li au port UDP 6545 intervalle de temps calcul alatoirement */ #include <netinet/in.h> #include <netdb.h> #include <sys/socket.h> #define PORT 6545 int main( int argc, char **argv) { int socketfd; struct sockaddr_in SADDR; struct hoste...
C
#include "try.h" static int val; /* * Fonction try qui permet de simuler un setjump */ int try(struct ctx_s *p_ctx, func_t *f, int arg) { p_ctx->ctx_magic_number = MAGIC_NUMBER; asm("movl %%esp, %0\n\t" "movl %%ebp, %1" :"=r"(p_ctx->ctx_esp), "=r"(p_ctx->ctx_ebp)); return f(arg); } /* * Fonction throw qui...
C
#include <stdint.h> typedef union unichr { uint8_t c[2]; uint16_t u; struct { uint16_t uni_l : 5; uint16_t multibyte_mark : 3; uint16_t uni_r : 6; uint16_t multibyte_continue : 2; }; } unichr; void utf8_to_cp1251(char *str) { for (char *ptr = str;...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #define RESET "\033[0m" #define RED "\033[31m" /* Red */ typedef struct { int *array; size_t used; size_t size; } Array; typedef struct redblack redblack_t; typedef struct tree_node { int key; /* κλειδί αναζήτησης */ struct tree_node *l;...
C
#include <stdio.h> #include "holberton.h" /** * print_to_98 - prints all natural numbers from n to 98 * @n: Integer * Description: prints all natural numbers from n to 98 * * Return: 0 */ void print_to_98(int n) { int g = n; if (n > 98) { for ( ; g >= 98; g--) { printf("%d", g); if (g != 98) ...
C
#include <stdio.h> /* Ģ : + - * / % */ int main(){ // 2 Է int n1, n2; int result = 0; printf(" ΰ Է : "); scanf_s("%d %d",&n1,&n2); result = n1 + n2;// result printf(" : %d\n",result); // result = n1 - n2; printf(" : %d\n",result); // result = ...
C
#include <stdio.h> #include "header.h" int main(){ int nr=-1, nc, i,j,n=1,tmp_b,tmp_h,tmp_area, A[MAX_R][MAX_C]; leggiMatrice(A,MAX_R,&nr,&nc); if(nr==-1)return -1; for(i=0;i<nr;i++) for(j=0;j<nc;j++) if (riconosciRegione(A, nr, nc, i, j, &tmp_b, &tmp_h)){ tmp_area...
C
#ifndef OCNUMPYTOOLS_H_ // A few helper functions/defines for help for dealing with Numeric // (Python Numeric) #include "ocport.h" OC_BEGIN_NAMESPACE // Convert from a Val tag to a Python Numeric Tab inline const char* OCTagToNumPy (char tag, bool supports_cx_int=false) { switch (tag) { case 's': return "int8"...
C
/* El lenguaje de programacion C, R&K, (Prentice Hall, 2da. edicion, 1991) */ /* # 3.6 */ /* El siguiente programa muestra el ejemplo de la funcion itoa la cual comvierte un numero entero a una cadena de caracteres */ /* Esta funcion usa tres argumentos: el entero, la cadena para almacenar la conversion, y un ancho mi...
C
// C program to connect to the socket opened by php module // written by -- kartik #include<stdio.h> #include<sys/socket.h> #include<arpa/inet.h> #include<stdlib.h> #include<unistd.h> #include<string.h> #include<sys/types.h> #include<malloc.h> #include"myfunc.h" //#include<conio.h> //max buffer size #define buffer_s...
C
#include "strings.h" #include <stdio.h> int main(void) { char string[] = {'h', 'e', 'l', 'l', 'o', 0x00}; int number = 0xf00d; printf("%d as string is %s\n", number, int_to_ascii(10, number)); printf("%d as string is %s\n", -number, int_to_ascii(10, -number)); printf("%d as string is %s\n", number, int...
C
#include "usart.h" u8 USART_RX_BUF=0; u16 USART_RX_STA=0; void uart_init(u32 bound){ //GPIO˿ GPIO_InitTypeDef GPIO_InitStructure; USART_InitTypeDef USART_InitStructure; NVIC_InitTypeDef NVIC_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1|RCC_APB2Periph_GPIOA, ENABLE); //ʹUSART1GPIOAʱ ...
C
void merge(int arr[], int beg, int mid, int end) { int i=beg, j=mid+1, k=beg, temp[end+1],l; while((i<=mid) && (j<=end)) { if(arr[i] <= arr[j]) { temp[k] = arr[i]; i++; } else { temp[k] = arr[j]; j++; } k++; } while(j<=end) { temp[k] = arr[j]; j++; ...
C
/* $Header: array.c,v 2.0 88/06/05 00:08:17 root Exp $ * * $Log: array.c,v $ * Revision 2.0 88/06/05 00:08:17 root * Baseline version 2.0. * */ #include "EXTERN.h" #include "perl.h" STR * afetch(ar,key) register ARRAY *ar; int key; { if (key < 0 || key > ar->ary_fill) return Nullstr; return ar->ary...
C
/* Chapter 12 Exercise 9 */ #include <stdio.h> #define NUM 5 double inner_product(const double *a, const double *b, int n); int main(void) { double *a, *b, arr_a[NUM], arr_b[NUM]; printf("\nEnter %d numbers: ", NUM); for (a = arr_a; a < arr_a + NUM; a++) { scanf(" %lf", a); } printf("\nEnter %d number...
C
#include<unistd.h> #include<stdlib.h> #include<stdio.h> #include<string.h> #include<sys/shm.h> #define TEXT_SZ 2048 struct shared_use_st { int written_by_you; char some_text[TEXT_SZ]; }; int main() { int running = 1; void *shared_memory = (void *)0; struct shared_use_st *shared_stuff; in...
C
#include <stdio.h> #include <stdlib.h> void main () { char name[100], link[100]; printf("Welcome to hacktoberfest 2021!\n"); printf("Visit this link for join: https://hacktoberfest.digitalocean.com\n"); // Input your name printf("\nEnter your name: "); scanf(" %s", &name); // Input your g...
C
#include "matriz.h" void imprimirMatriz(matriz *M) { int i, k; if (M != 0) { for (i = 0; i < M->filas; i++) { for (k = 0; k < M->columnas; k++) printf("%f ", *((M->datos) + i * M->columnas + k)); //printf("%f ", *((M->datos) + i * M->filas + k)); ...
C
/* See LICENSE file for copyright and license details. */ #include <arpa/inet.h> #include <errno.h> #include <inttypes.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "arg.h" #include "util.h" static void usage(void) { die("usage: %s [-b colour]", argv0); } int main(int a...
C
#include<stdio.h> #include<string.h> //#include<stdbool.h> _Bool backspaceCompare(char* s,char* t); void processStr(char* str); int main() { char s[10]; char t[10]; printf("Enter string S:"); scanf("%s",s); printf("Enter string T:"); scanf("%s",t); if(backspaceCompare(s,t)) printf("S and T are equal."); }...
C
#include "shell.h" typedef int (*func_t)(char **argv); typedef struct { const char *name; func_t func; } command_t; static int do_quit(__unused char **argv) { shutdownjobs(); exit(EXIT_SUCCESS); } static char pathbuf[4096]; static int do_chdir(char **argv) { char *path = argv[0]; if (path == NULL) p...
C
#include "bookorder.h" void bookorder(char * clientdbfilename, char * orderinputfilename, char * categoriesfilename) { FILE * clients = NULL; FILE * orders = NULL; FILE * categories = NULL; //calculate lengths of files for buffers int client_bufferlen = filelengthwrapper(clientdbfilename); int order_bufferlen =...
C
#include <stdio.h> #include <stdlib.h> // definicion y prototipos funciones //variables y constantes // implementacion de funciones int main(int argc, char** argv) { float a, b, c, d; scanf("%f",&a); scanf("%f",&b); scanf("%f",&c); scanf("%f",&d); if(a>b && a>c...
C
#include <stdio.h> #include <stdlib.h> #include <signal.h> #include <sys/time.h> int reads = 0; void close_signal_handler(int sig) { printf("Completed %d reads in 5 seconds\n", reads); exit(0); } int main(int argc, char const *argv[]) { FILE *fp = fopen(argv[1], "rb"); int last_int = sizeof(int) * (1...
C
#include <daos.h> #include <file_table.h> #include <files.h> #include <logger.h> #include <definitions.h> #include <macro_utils.h> #include <app_errors.h> #include <request_response_definitions.h> #include <limits.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <dirent.h> #inc...
C
//ROI Image Convolution by 3x3 Mask ---> To be modified! void MyFrame::OnROIConvolve3x3Image(wxCommandEvent & event){ printf("ROI Convolving3x3..."); free(loadedImage); loadedImage = new wxImage(bitmap.ConvertToImage()); loadedImage2 = new wxImage(bitmap.ConvertToImage()); //mask3 matrix forma...
C
//Arif Burak Demiray //This code is compiled with C99 #ifndef PRODUCT_H //include guard #define PRODUCT_H typedef struct product { char product_name[30]; // (phone, tshirt, coke etc.) char product_type[30]; //(electronicDevice, clothing, market etc.) int price; // (can be integer between 1-100...
C
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> /* Project Euler: Problem 2 December 19th, 2015 Clay Gardner https://projecteuler.net/problem=2 Solved the above problem. Input: 1 4000000 Output: 4613732 Time: sys 0m0.003s https://www.hackerrank.com/contests/projecteuler/challenges/eule...
C
#include "oo_stack.h" #include "stdio.h" #include <sys/time.h> int main() { /* int i; Stack* stack = stack_new(); for (i = 0; i < 100000; i++) { struct Point p = {i, i+1}; stack->push(stack, i); } while (!stack->empty(stack)) { struct Point p = stack->top(stack); printf("%i %i\n", p....
C
#include <stdio.h> #include <stdlib.h> #include "gotoxy.h" #include "colores.h" #include <conio.h> void menu(); void dibujar_marco(); int main(int argc, char *argv[]) { system("portada.exe"); system("cls"); system("color 7"); color(1,7); dibujar_marco(); color(0,15); menu(); getch()...
C
bool args_parse(ARGUMENTS* args, int argc, char** argv){ int i,c; for(i=0;i<argc;i++){ if(argv[i][0]=='-'){ switch(argv[i][1]){ case 'v': for(c=1;argv[i][c]=='v';c++){ args->verbosity=c; } break; case 'f': if(i>=argc-1){ fprintf(stderr, "Missing config file name\n"); ...
C
// Leonardo Costa // Vilmar Rangel #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <pthread.h> #include <time.h> void* ThreadSoma(int* args) { int soma = args[0] + args[1]; int tempoSleep = args[2]; printf("Eu sou a thread SOMA (%d) e irei dormir por %d segundos\n", soma, tempoSleep); ...
C
#include "defs.h" #include "bitmaps.h" #include "polygon.h" #include "strings.h" #define VAR_SCROLL_Y 0xf9 u8 buffer8[4*320*200]; u32 pal32[16]; int done=0; extern float palette_rgb[48]; void set_palette(u8 *p, u8 v) { printf("set palette %d", v); int offset = 32 * v; for (int i=0; i<16; i++) { int color =...
C
/* server.c */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/socket.h> #include <netinet/in.h> #define MAXLINE 80 #define SERV_PORT 8100 int main(void) { struct sockaddr_in servaddr, cliaddr; socklen_t cliaddr_len; int listenfd,...
C
#include<stdio.h> // header file main(){ int n,arr[1000],i,temp; //datatypes assigned scanf("%d",&n); //reading value for(i=0;i<n;i++){ scanf("%d ",&arr[i]); // reading values and sorring in the array "arr[]" } for(i=0;i<n/2;i++){ temp=arr[i]; //swaping array elements ar...
C
/* * APICommand.c * * Created on: Dec 19, 2011 * Author: ParallelsWin7 */ #include <stdio.h> //not needed in CCS #include "APICommand.h" ////////////////////////////////////////////////////////////////////////// //////////// API CONSTRUCTORS ////////////// ////...
C
// Using operator sizeof to determine standard data type size #include <stdio.h> int main(int argc, char const *argv[]) { char c; short s; int i; long l; long long ll; float f; double d; long double ld; int array[20]; int *ptr = array; printf(" sizeof c = %u\tsizeof(char) = %u\n", sizeof...
C
#include<unistd.h> void ft_print(char printnumbr) { write(1, &printnumbr, 1); } void ft_putnbr(int nb) { int number; if (nb == -2147483648) { ft_print('-'); ft_print('2'); ft_putnbr(147483648); return ; } if (nb >= 0) number = nb; else { ft_print('-'); number = nb * -1; } if (number >= 10) {...
C
#include<stdio.h> #include<ctype.h> int main() { int count = 0; char ch; printf("Enter a sentence: "); while( (ch = getchar()) != '\n') { ch = toupper(ch); if (ch == 'A' || ch == 'E' || ch == 'I' || ch == 'O' || ch == 'U') { /* code */ count += 1; } } printf("Your sentence contains %d vowels\n...
C
#include "tort/fiber.h" #include <stdio.h> #include <stdlib.h> #include <assert.h> static tort_fiber_t *fiber_a, *fiber_b; static tort_fiber_func_DECL(a); static tort_fiber_func_DECL(b); static tort_fiber_func_DECL(a) { static int n = 10; assert(_tort_fiber_ptr->status == RUNNING); fiber_a = _tort_fiber_ptr; ...
C
// Name-Aman Kumar Kanojia // Roll no.-201851014 #include <stdio.h> #include <stdlib.h> int inverse(int a) { for(int i = 1; i < 27; ++i) { if((a*i)%26 == 1) return i; } return 0; } void Encryption(char arr[], int n, int a, int b) { printf("The cipher text is- "); for(int i = 0; i < n; ++i) { if(islowe...
C
// gcc consumer.c -o con.out // Include header files #include <string.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/shm.h> #include "shm_com.h" // header file containing the structure of shared memory // Main function int main() { // User de...
C
/* * key.c * * Created on: Apr 3, 2021 * Author: Francis */ #include "key.h" //按键扫描函数 //mode==1时,按键按下亮,松开灭 //mode==0时,按键按下亮,再次按下灭 uint8_t KeyScan(uint8_t mode) { static uint8_t key_up = 1; if(mode == 1){ key_up = 1; } if(key_up && (KEY0 == GPIO_PIN_RESET || KEY1 == GPIO_PIN_RESET || KEY2 == GPIO_PIN...
C
#include <stdio.h> #include <stdlib.h> int positivoNegativo(); int maiorNumero(); int calculadora(); int ordemCrescente(); int main() { int opcao = 1; while(opcao>0){ printf("\t\t=========== MENU ===========\n"); printf("\t\t1 - Numero Positivo/Negativo\n"); printf("\t\t2 - Maior de 3 nu...
C
/****************************************************************************** Online C Compiler. Code, Compile, Run and Debug C program online. Write your code in this editor and press "Run" button to compile and execute it. ***********************************************...
C
#include<stdio.h> #include<string.h> #include<stdlib.h> void encrypt(char* input, char* output); int main(int argc, char* argv[]){ if(argc != 3){ printf("USAGE: complement [input file] [output file]\n"); return 1; } encrypt(argv[1], argv[2]); return 0; } void encrypt(char* input, char* output)...
C
/* ע⵽ʵǶʽչʽϵn+1еn+1ֱC(n,0),C(n,1),C(n,2)....C(n,n) ִϹʽ C(n,0)=1 C(n,k)=(n-k+1)/k*c(n,k-1)*/ #include<stdio.h> void main() { int m,n,cnm,k; printf("The number of lines:");scanf("%d",&n); for(k=1;k<=40;k++) printf(" "); printf("%6d\n",1); //һ for(m=1;m<=n-1;m++) ...
C
/* Student: Joaquin Saldana Assignment 3 Testing the adventure card function code: int adventurerCard(struct gameState *state) { int drawntreasure = 0; int currentPlayer = whoseTurn(state); int cardDrawn; int temphand[MAX_HAND]; int z = 0; while(drawntreasure<2) { if (state->deckCount[curr...
C
#include "util.h" #include <stdarg.h> /** * Check if a bit is set in the bit field. */ BOOL HvUtilBitIsSet(SIZE_T BitField, SIZE_T BitPosition) { return (BitField >> BitPosition) & 1UL; } /** * Set a bit in a bit field. */ SIZE_T HvUtilBitSetBit(SIZE_T BitField, SIZE_T BitPosition) { return BitField | (1ULL <<...
C
#include<stdio.h> #include<stdlib.h> #include<arpa/inet.h> #include<sys/time.h> #include<sys/select.h> #include<sys/socket.h> #include<string.h> #include<unistd.h> void ErrorHandling(char *message){ fputs(message,stderr); fputs("\n",stderr); exit(1); } int main(int argc, char* argv[]){ int srvSock, cln...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #define TREE_MAX_SIZE 30 struct node { int data; struct node *lchild, *rchild; }; struct node *tree_creat(int *in, int *post, int len); void tree_destroy(struct node **root); void tree_level_walk(struct node *root); struct node *tre...
C
#include <stdio.h> #include <stdlib.h> int main(){ int arr[] = {1,2,3,4,5}; // int N = 0b11100; int nonDets[5]; for (int i=0;i<5;i++){ nonDets[i] = nondet_int(); __CPROVER_assume(nonDets[i]>=0&&nonDets[i]<5); } // __CPROVER_assume(N>0); int xorEd = 0; for(int x=0;x<3;x++){ // printf("%d %d\n",(N&(1<...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* padding_5.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> typedef enum{ OUT, EMPTY, SECRET,CHARA, ENEMY, WEAPON, DEATHENEMY, GDEATHENEMY, PRISON,EXIT, GUNS } squareKind; typedef enum{ NOWEAPON, HAVEWEAPON, GUN, FULL, QUIT } modeKind; typedef struct{ int enemy[3][2]; ...
C
/* -- PCF Operating System -- * See [docs\COPYRIGHT.txt] for more info */ /** @file system\kernel\fs\read.c @brief Virtual File System */ #include <errno.h> #include <string.h> #include <stdio.h> #include <kernel\console.h> int VfsRead(int fd, char *buffer, unsigned int len) { if(fd == STDIN_FD) { un...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/stat.h> #include "Header.h" void Files() { FILE *fh; FILE *fh2; printLn2(1,"これからファイル操作を試します",1); // printf : <stdio.h> printLn("> カレントディレクトリをホームに変更",1); chdir(getenv("HOME")); // chdir : <unistd.h> // getenv : <stdlib.h> // ファイル/フ...
C
#include <stdio.h> #define MIN 0 #define MAX 40 #define INTER 2 main() { int celsius; printf("Celsius, Fahr\n"); for (celsius = MIN; celsius <= MAX; celsius = celsius + INTER) printf("%5d %7.1f\n", celsius, ((9.0 * celsius) / 5.0 +32.0)); }
C
/** Header for HMC5883L ditigal compass driver Requirements: 1. the main file should include wire.h Pin layout: I2C: ANL 4 -> SDL ANL 5 -> SCL */ #ifndef compass_driver_h #define compass_driver_h #include "Arduino.h" #include <wire.h> //Define pins you're using for I2C communication #defin...
C
#include "memvirt.h" #include "simpletest.h" #define WS(a, b, c) \ if (a){ \ isEqual(a->avg_ws, b, c); \ } \ else isNotNull(a, c); #define PFRATE(a, b, c) \ if (a){ \ isNear(a->total_pf_rate, b, c); \ } \ else isNotNull(a, c); void tzero1 () { WHEN("eu tenho apenas um processo, 4 frames e um intervalo igual a 20"...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> int CPT = 0; bool FLAG = false; int main(int argc, char *argv[]) { // Open memory card (File *f = fopen(filename, "r");) // Repeat until end of card: // Read 512 bytes into a buffer (fread(data, size, number, inptr)) // If start of a new JPEG...
C
/* roman.c */ /* Author: Adam Reid */ /* Number - Roman Numeral Converter */ /* The program takes in a user entered number, and converts the number to roman numerals. *NOTE: The program will not convert any decimals, and will convert words to "" */ #include "romanTools.h" int main(int argc, char * argv[]) { conve...
C
#include "map.h" #include <stdio.h> #include <stdlib.h> // in binding=rr mode void mapping(int mycol, int type) { char H_Freq[7]={"2500000"}; // char M_Freq[7]={"1800000"}; char L_Freq[6]={"800000"}; FILE *fp; char *DVFS=L_Freq; if(type==1) DVFS=H_Freq; else if(type==0) DVFS=L_Freq; if(mycol==...
C
/** * File : main.c * Author : Ayana, Masa * Date : Fri 8 Feb 2019 */ #include <stdio.h> int vc_find_next_prime(int n) { if (n < 2) { return 0; } for (int i = 2; i < n; i++) { if (n % i == 0) { return vc_find_next_prime(...
C
/*Напишете програма аналог на спортния тотализатор. Използвайте функции. Насоки: 1. Давате право на избор на играча да избере тотализатор, в който ще си пробва късмета: (5 от 35), (6 от 42) или (6 от 49) 2. При всяко завъртане програмата изписва 1 произволно число, което не е извадено до момента. 3. Програмата вади чис...
C
#ifndef DATOS_H #define DATOS_H typedef struct args ARG; typedef struct type TYP; typedef struct type_tab TYPTAB; struct args{ int arg; ARG *next; }; typedef struct argum{ ARG *head; ARG *tail; int num; // numero de elementos en la lista }ARGUMS; typedef struct sym SYM; ...
C
#ifndef TD_REDBLACKTREE_C #define TD_REDBLACKTREE_C #include "../RedBlackTree.h" #include "../../DynamicArray/DynamicArray.h" #include <stdio.h> #include <time.h> #include <stdlib.h> char TD_RedBlackTreeComparator( RedBlackTreePayload leftNode, RedBlackTreePayload rightNode ) { // Return anything but (true or 1)...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> int getLine(char *inpt); int printSpeciali(char *s, int len); int xorFun(char *msg, char *key, char *xorred, int len); int printHex(char *mssgio, int len); int main(){ // messaggio da cifrare char msg[128]; printf("Inserisci il messag...
C
#include <stdio.h> #include <stdlib.h> #include "ponto.h" #include "caminho.h" struct caminho_{ ponto_ST *pontos; float distanciaCaminho; float distanciaPontoInicialParaPontoFinal; }; //Funções locais que não são exportadas para main float calcularDistanciaDeTodosPontos(ponto_ST * pontos, int quantidadeDe...
C
#include <signal.h> #include <unistd.h> #include <stdio.h> #include <errno.h> #include <stdlib.h> #include <string.h> #include "ft_strace.h" void do_child(int argc, char **argv) { char *args [argc+1]; for (int i=0;i<argc;i++) args[i] = argv[i]; args[argc] = NULL; kill(getpid(), SIGSTOP); execvp(args...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> struct ListNode { int val; struct ListNode *next; }; struct ListNode * insert(struct ListNode **head,struct ListNode * tail,struct ListNode *value); /* return tail node*/ struct ListNode * insert(struct ListNode **head,struct ListNode * tail,struct L...
C
/* * Copyright (C) 2017 by Benedict Paten (benedictpaten@gmail.com) * * Released under the MIT license, see LICENSE.txt */ #include <htslib/vcf.h> #include "htsIntegration.h" /* * Functions for reference prior probabilities */ stReferencePriorProbs *stReferencePriorProbs_constructEmptyProfile(char *referenceNa...
C
#include <stddef.h> #include <stdint.h> #include <stdbool.h> #include <stdlib.h> #include "eeprom.h" #include "setting_save.h" #include "console.h" #include "stdio.h" bool eepromInited = false; set_dev_t setting; uint8_t *settingBuf = NULL; //callback function void saveResult(epState_t result) { if(result =...
C
///////////////////////////////////////////// // // FILE: child.c // AUTHOR: Ryan Vollmer // PURPOSE: Child process functons for small shell. // ///////////////////////////////////////////// #include "smallsh.h" /** * Checks if command is for a background process * @param {char*} cmd - command to check...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> #include <time.h> #define N 200 #define LEARN_RATE 0.01 #define EPS 1e-11 double input[N], output[N]; void data(){ srand(time(0)); int i; double atom=M_PI_4/N; double x=-M_PI_4; for (i=0; i<N;++i){ x+=atom; ...
C
#include <stdio.h> int main() { unsigned int binary, divisor = 1, position_divisor = 10, decimal_weight = 1, decimal = 0, position_value; printf("Введите двоичное число вида 1001011: "); scanf("%d", &binary); while (divisor <= binary) { position_value = binary % position_divisor / divisor; decimal +...
C
#include <unistd.h> #include <sys/types.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> int main(int argc, char **argv) { // open /etc/passwd + error handling int fd = open("/etc/passwd", O_RDONLY); if(fd < 0) { perror(argv[0]); exit(1); } // lseek to the last ten bytes of the file + error handli...
C
/*! \file linkWatchLib.h \brief Utility library to help ease the watching of link directories April 2008, rjn@hep.ucl.ac.uk */ #ifndef LINKWATCHLIB_H #define LINKWATCHLIB_H // System Includes #include <time.h> #include <zlib.h> #include <stdio.h> #ifndef __CINT__ #include <dirent.h> #endif int setupLinkW...
C
/* * 938. Range Sum of BST * Given the root node of a binary search tree and two integers low and high, * return the sum of values of all nodes with a value in the inclusive range [low, high]. * * Example 1: * Input: root = [10,5,15,3,7,null,18], low = 7, high = 15 * Output: 32 * Explanation: Nodes 7, 10, and 15 are ...
C
#include <stdio.h> #include <string.h> #include <math.h> int main(){ int T, i, tam, num; long long unsigned int N = 0, P = 0; char NK[30]; scanf(" %d" , &T); while(T>0){ scanf("%d%s", &num , NK); tam = strlen(NK); N=num; i = 1; while(((num-(tam*i))>0) ){ P = (num...
C
/* Calcular el algoritmo que determine el número de puntos que lleva un equipo de fútbol en competición de liga en función del número de partidos ganados, perdidos y empatados. NOTA: un partido ganado son 3 puntos, uno empatado es 1 y uno perdido son 0. */ #include <stdio.h> void main() { // varia...