language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdlib.h> #include <unistd.h> #include "../includes/exit.h" #include "../includes/libft.h" #include "../includes/get_next_line.h" static void end_of_fct_export (t_list_gnl **root, char *newline, int done, int todo) { int todocpy; BOOL found; found = 0; todocpy = todo; if (!*root || !newline) return...
C
/** * Given a string, find the length of the longest substring without repeating characters. * * Example 1: * * Input: "abcabcbb" * Output: 3 * Explanation: The answer is "abc", with the length of 3. * Example 2: * * Input: "bbbbb" * Output: 1 * Explanation: The answer is "b", with the length of 1. * ...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int numero, j, resul; do { printf ("Entre com um numero inteiro nao-negativo \n\n"); scanf("%d", &numero); } while(numero < 0); srand(time(0)); j = rand()%2; // rand somente numeros inteiros printf("\...
C
#include <winpr/crt.h> #include <winpr/synch.h> #include <winpr/thread.h> static BOOL test_mutex_basic(void) { HANDLE mutex; DWORD rc; if (!(mutex = CreateMutex(NULL, FALSE, NULL))) { printf("%s: CreateMutex failed\n", __func__); return FALSE; } rc = WaitForSingleObject(mutex, INFINITE); if (rc != WAIT_...
C
#include <stdlib.h> #include "holberton.h" /** * array_range - print from min to max * @min: number of elements * @max: type of elements * Return: nothing */ int *array_range(int min, int max) { int *p = NULL; int i, res = 0; if (min > max) return (NULL); res = max - min; p = malloc((res + 1) * sizeof(int)...
C
#ifndef _STOPPER_H_ #define _STOPPER_H_ #include <time.h> /** stopper tipus*/ typedef struct stopper { clock_t begin; /// stopper futasanak kezdete clock_t end; /// stopper futasanak vege } stopper; /** stoppper inditasa * @param st az inditando stopper cime */ void startS(stopper* st); /** stopper megallita...
C
/* This file is part of the Avalon programming language * * Copyright (c) 2018-2019 Ntwali Bashige Toussaint * * 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....
C
#include <stdio.h> int countbit(unsigned int x); void print_in_binary(unsigned int x); unsigned int multiply(unsigned int x, unsigned int y); int main(void) { unsigned int i = (0x12345678 >> 8) & ~(~0u << 8); //i = i >> 1; //i = ~i; printf("i = %d\n", i); // 检查int类型是否是4个字节32位 //printf("sizeof(i) = %ld\n", sizeo...
C
#include<sys/types.h> #include<sys/socket.h> #include<netdb.h> #include<string.h> #include<stdio.h> #include<stdlib.h> #include <unistd.h> #define MAXL 1024 int main(int argc,char **argv[]) { int i,addrsize;////////////////for gen int sock_udp,sock_tcp; int b_in;////binding dec char sn_ip[20]; struct sockaddr_in udpser...
C
#include <vfs.h> #include <ff.h> #include <os_error.h> #include <printf_debug.h> #include <sys_init_fun.h> #include <myassert.h> #include <fs.h> /** * this file is used for fat to fit the vfs */ #define FAT_ROOT "/fat" #define FAT_NAME "fat" static FIL f; static char fat_path[100] = "1:"; static unsigned int fat...
C
//P34 void MERGESORT(A,p,r) if p<r{ q=(p+r)/2 MERGESORT(A,p,q) MERGESORT(A,q+1,r) // can not parse q+1 MERGE(A,p,q,r)} | void MERGE(A,p,q,r) n1=q-p+1 n2=r-q let L[1..n1+1] and R[1..n2+1] be new arrays //for i=1 to n1 i=1 while i<n1{ L[i]=A[p+i-1] i=i+1} j=1 while j<n2{ //f...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* print_map_with_colors.c :+: :+: :+: ...
C
#include "a1.h" void processImage(int width, int height, RGB *image) { // simple image "processing" int i = 0; int start = image; int end = start+width*height*sizeof(RGB); //RGB *topleft = (RGB*)malloc(width*height*sizeof(RGB)); RGB *topleft = image-width-1; RGB *top = image-width+i; RGB *topright ...
C
#include "net_exp.h" int main(int argc, char **argv) { /* 建立套接字 */ int sockfd; if ((sockfd = socket(/* Placeholder */)) == -1) { perror("socket error"); return 1; } /* 建立tcp连接 */ struct sockaddr_in server_addr; memset(&server_addr,/* Placeholder */); server_addr.sin_fa...
C
#ifndef _TYPE_H #define _TYPE_H #include <stdio.h> #include <stdbool.h> struct node; #define TYPE_BASIC 1 #define TYPE_VOID 2 #define TYPE_POINTER 3 #define TYPE_ARRAY 4 #define TYPE_FUNCTION 5 #define TYPE_LABEL 6 #define TYPE_WIDTH_CHAR 1 #define TYPE_WIDTH_SHORT 2 #define TYPE_WIDTH_INT ...
C
// // 结构体类型定义以及变量定义.c // CTestProject // // Created by JasonLu on 16/10/2. // Copyright © 2016年 JasonLu. All rights reserved. // #include <stdio.h> #include <stdlib.h> #include <string.h> //typedef void (*fptrDisplay)(void* data); //typedef void (*fptrFree)(void* data); // ////结构体定义 //typedef struct _teacher{ // ...
C
#define _CRT_SECURE_NO_WARNINGS 1 #include <stdio.h> #include <stdlib.h> #include <assert.h> int my_strcmp(const char *dest, const char *src) { int ret = 0; assert(dest&&src); while (!(ret = *(unsigned char*)dest - *(unsigned char*)src) && *src) { dest++; src++; } if (ret > 0) ret = 1; else if (ret < 0) ...
C
#ifndef SD_ENTITY_H #define SD_ENTITY_H #include "sword/assets.h" #include "sword/def.h" #include "sword/math.h" typedef struct SDEntity SDEntity; typedef SDEntity *SDEntityRef; typedef enum SDComponentType { SD_COMPONENT_Transform = 0, SD_COMPONENT_Sprite, SD_COMPONENT_COUNT, } SDComponentType; typedef struc...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_process_nbrs.c :+: :+: :+: ...
C
#include<stdio.h> int main() { int n, x, i, j, tag=0; scanf("%d", &n); if (n>=1&&n<=100){ for (i=0; i<n; i++){ scanf("%d", &x); for (j=2; j<x; j++){ if (x%j==0){ tag++; break; } else ...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> int main(int argc, char const *argv[]) { int func; scanf("%d\n", func); if (func = 1){ media_de_matriz(); } else if (func = 2) { vetorBinario(); } else if (func = 3) { Binario_para_decimal(); } return 0; } //=====================...
C
#include <hc/HammingCode.h> #include <stdlib.h> #include <stdio.h> #include <string.h> void print_hex(const char* prefix, const char d[], unsigned long long length) { int i; printf("%s hex : ", prefix); for (i = 0; (d[i] != 0 && length == 0) || i < length; ++i) printf("%02x", d[i]); printf("00\n"); } void print...
C
/* * CSE121 Project 1: File System * * Copyright(c) 2005 Alex C. Snoeren <snoeren@cs.ucsd.edu> * Calvin Hubble * Kiran Tati <ktati@cs.ucsd.edu> * */ #include <math.h> #include <stdio.h> #include <fcntl.h> #include <stdlib.h> #include <string.h> #include <assert.h> #include <sys/types.h> #include <sys/stat.h> #...
C
/* Includes ------------------------------------------------------------------*/ #include "movingAvgFilter.h" /* MOVING FILTER -------------------------------------------------------------*/ void movingFilter(uint16_t adcData, struct movingAvgFilter* filter){ double bufferVals[filter->buffer]; double sum =0; int ...
C
#include<stdio.h>. int main() { for(int j = 1;j<=92;j+=1) { double sum = 0, item = 0; unsigned long long temp1 =1 ,temp2 = 2; int sign = 1; for(int i =1;i<=j;i++) { item = sign*(double)temp2/temp1; sum+=item; sign *= -1; temp2+=temp1; temp1=temp2-temp1; } printf("%.17f\n",sum); } ...
C
#include <stdlib.h> #include <stdio.h> #include <pthread.h> #define RANDMAX 101 /* PROTOTYPES */ void *producer(void *param); void *consumer(void *param); /* GLOBALS */ pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t buf_full = PTHREAD_COND_INITIALIZER; pthread_cond_t buf_empty = PTHREAD_COND_IN...
C
#include "smaa.h" #include <stdlib.h> #include <string.h> // Compare 0-terminated arrays of ints static int smaa_nAlt; static int smaa_cmpintarr(void const *p1, void const *p2) { return memcmp(*(void const **)p1, *(void const **)p2, sizeof(int) * smaa_nAlt); } /* * Count unique rankings * @param m * N matrix of ...
C
#include <sys/time.h> #include <sys/mman.h> #include <stdlib.h> #include <signal.h> #include <string.h> #include <limits.h> #include <stdio.h> #include <errno.h> #include <stddef.h> #include "sched.h" #include "adjstack.c" #define STACK_SIZE 65536 #define SCHED_NPROC 511 // (maximum pid)-1 #define SCHED_READY ...
C
/******************************************************************** * * PROJECT: COMP 411 Assignments * MODULE: Problem 2-2b * AUTHOR: Nathan Fiedler, Sept 25, 1995 * * DESCRIPTION: * This is an algorithm to find the smallest and largest * elements in an array of N ele...
C
#include "queue.h" #include "skel.h" #include <sys/stat.h> #include <fcntl.h> #include <string.h> #define MAX_DIM_RT 65000 #define MAX_DIM_ARPT 6 struct rtable_entry { uint32_t prefix; uint32_t next_hop; uint32_t mask; uint32_t interface; }; struct arp_table_entry { uint32_t ip; uint8_t mac[ETH_ALEN]; }; /* ...
C
#include "general.h" #include "io.h" #include "video.h" void out8(unsigned short port, uint8_t data) { __asm__ volatile ("outb %0, %1" : : "a"(data), "d"(port)); } uint8_t in8(unsigned short port) { uint8_t value; __asm__ volatile ("inb %1, %0" : "=a"(value) : "d"(port)); return value; } void out16(u...
C
#include "quick_sort.h" #include "swap.h" #define ADDR(A, i, key_size) (A+(i)*(key_size)) pair_type tri_partition(void *A, unsigned int pivot, unsigned int left, unsigned int right,const size_t elem_size, total_order leq) { pair_type pair; swap(ADDR(A,pivot,elem_size),ADDR(A,left,elem_size),elem_size); piv...
C
/* * Check the declaration of enum-specifier works well, where * tag-name of enum-speicifier is omitted. */ #include <stdio.h> enum { A0, A1, A2 = 20, A3 }; void test000(void) { printf("`test000' called\n"); printf("%d, %d, %d, %d\n", A0, A1, A2, A3); } void test001(void) { printf("`test001'...
C
#include<stdio.h> #include<string.h> int main(void) { int letters; char word[40]; printf("Give me a word, any word: "); scanf("%s", word); letters=strlen(word); while(letters>=0) { printf("%c", word[letters]); letters--; } printf("\n"); return 0; }
C
#include "stdio.h" #define LENGTH 101 void PlusMinus(void); int main() { PlusMinus(); return 0; } void PlusMinus(void) { int i; int n, arr[LENGTH]; float postive=0, negative=0, zeros=0; scanf("%d",&n); for (i=0;i<n; i++) { scanf("%d",&arr[i]); ...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <LinearAlg.h> void MaxVec(double *a,int dim,double *value,int *index) { int i; //double value; value[0] = a[0]; index[0] = 0; for(i=1;i<dim;i++) { if(a[i]>value[0]) { value[0] = a[i]; index[0] = i; } } } void MaxAb...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* completion.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <async/Emitter.h> #include <async/test.h> #include <async/rc.h> int acc = 0; int acc2 = 0; int acc3 = 0; void callback(void* data) { acc = *(int*)data; } void callback2(void* data) { acc2 = *(int*)data; } void callback3(void* data) { a...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <sys/time.h> typedef struct credit_card { long long int card_number; char bank_code[6]; char expiry_date[8]; char first_name[30]; char last_name[30]; } CREDIT_CARD; typedef struct credit_card* CREDIT_CARDS; struct records { C...
C
#include "emulator/cpu/cpu_flag.h" #include <assert.h> #include <stdbool.h> #include <stdint.h> #include "emulator/cpu/cpu.h" #include "emulator/cpu/register_index.h" #include "util/logging.h" static bool _cpuFlagBitsetTest(const FlagIndexBitset bitset, const FlagIndex index) { retur...
C
#include <stdio.h> #define N 10 int main(int argc, char const *argv[]) { FILE *fp; int i, temp[N], temp2[N], count = 0; fp = fopen ("data.txt", "wt"); printf("Entering and write to data.txt, with %d number\n", N); for (i = 0; i < N; i ++) { scanf ("%d", temp + i); } for (i = 0; i < N; i ++) { fprintf(fp...
C
#include "motors.h" extern TIM_HandleTypeDef htim2; extern TIM_HandleTypeDef htim3; static float speedXval, speedYval; void enableMotors(void) { speedXval = 0; speedYval = 0; HAL_GPIO_WritePin(MOTOR_A, GPIO_PIN_SET); HAL_GPIO_WritePin(MOTOR_B, GPIO_PIN_SET); HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_1); HAL_TI...
C
#include <stdio.h> #include <math.h> long largestPalindromeProduct(int small, int big) { int i = big; int j = 0; long largestPalindrome = 1; int isPlalidrome = 0; for(i=big; i>=small; i--) { for(j=i; j<=big; j++) { if((i*j)>largestPalindrome) { isPlalidrome = isAPalindrome(i*j); if(isPlalidrome =...
C
/* Stack.h Description: Header file which contains function signatures for a stack Author: Kohdy Nicholson Date: 2020-06-14 */ #ifndef STACK_H #define STACK_H #include <stdio.h> #include "Point2D.h" #include "Link.h" // Struct typedef typedef struct stack{ pLink top; int...
C
#include <stdio.h> #include <time.h> #include <stdlib.h> int main() { FILE *fp; int small = 25000; int medium = 50000; int large = 100000; srand(time(NULL)); // Initialization, should only be called once. fp = fopen("datasets.h", "w+"); fprintf(fp, "#ifdef SMALL_DATASET\n#define INPUT {"); ...
C
#include<stdio.h> #include<string.h> int i, j, m, n, c[1000][1000]; char x[1000], y[1000], b[1000][1000]; int ile = 0; void LCS_LENGTH(char *x, char *y) { m = strlen(x); n = strlen(y); for(i = 0; i <= m; i++) c[i][0] = 0; for(j = 0; j <= n; j++) c[0][j] = 0; for(i = 1; i <= m; i++) { for(j = 1;...
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
// ó Ʈ Ver 0.03 #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <time.h> #include <Windows.h> // ȼ ִ . #include <math.h> #include <io.h> /////// Լ (̸ ) void print_menu(); void openImage(); unsigned char** malloc2D(int, int); void displayImage(); void freeInputImage(); void freeOutput...
C
#include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <string.h> #include <sys/types.h> #include <time.h> int main(int argc, char *argv[]) { int listen_fd = 0; int conn_fd = 0; struct sockaddr_in serv_addr; cha...
C
/* ** ETNA PROJECT, 13/10/2018 by soubri_j ** main ...
C
#include <stdio.h> void printArray(char s[]) { int i; for(i = 0; i < 10; i++) { printf("%d, ", s[i]); } printf("\n"); return ; } int main(void) { char buf[10] = {0, 1, 2, 3, 4}; char *p = buf; char *p0 = &buf[0]; char *p1 = &buf[1]; char *p2 = &buf[2]; *p1 = 9; p2 += 1; // *p2 = 100; prin...
C
#include <string.h> #include <stdlib.h> #include "hash.h" #include <stdio.h> #define SETEO_CAPACIDAD (capacidad_inicial >= TAM_MINIMO_HASH) ? capacidad_inicial : TAM_MINIMO_HASH #define HASH_ELEMENTO_OBTENIDO (hash->tabla[posicion]) ? hash->tabla[posicion]->valor : NULL #define HASH_CONTIENE_CLAVE hash_obtener(hash, c...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> //socket #include <sys/types.h> #include <sys/socket.h> //inet_ntop #include <netinet/ip.h> #include <netinet/in.h> #include <arpa/inet.h> //libevent #include <event2/buffer.h> #include <event2/bufferevent.h> #include <event2/listener.h> #define SERVER_PORT...
C
#include <stdio.h> #include <string.h> #include "student.h" int main() { struct Student studentArr[50]; int studentnumber; char input[256]; printf("How many students?"); fgets(input, 256, stdin); sscanf(input, "%d", &studentnumber); int count = 0; while (count < studentnumber) { char firs...
C
/* 1003 我要通过! (20 分) “答案正确”是自动判题系统给出的最令人欢喜的回复。本题属于 PAT 的“答案正确”大派送 —— 只要读入的字符串满足下列条件,系统就输出“答案正确”,否则输出“答案错误”。 得到“答案正确”的条件是: 字符串中必须仅有 P、 A、 T这三种字符,不可以包含其它字符; 任意形如 xPATx 的字符串都可以获得“答案正确”,其中 x 或者是空字符串,或者是仅由字母 A 组成的字符串; 如果 aPbTc 是正确的,那么 aPbATca 也是正确的,其中 a、 b、 c 均或者是空字符串,或者是仅由字母 A 组成的字符串。 现在就请你为 PAT 写一个自动裁判程序,判定哪些字符串是可以获得“答案...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> int main(void) { time_t cur_time = 0; char *cur_t_string; cur_time = time(NULL); if (cur_time == ((time_t)(-1))) { fprintf(stderr, "Failure to get the current time.\n"); exit(EXIT_FAILURE); } cur_t_string = ctime(&cu...
C
#include "GL/freeglut.h" #include "GL/gl.h" float _angle = 0.0f; void drawShape() { glClearColor(0.3, 0.4, 0.0, 0.0); glClear(GL_COLOR_BUFFER_BIT); glRotatef(_angle, 0.0, 0.0, 1.0); //constant value for self rotation glColor3f(1.0, 0.0, 1.0); glOrtho(-1.0, 1.0, -1.0, 1.0, -1.0, 1.0); g...
C
#include <windows.h> #include "dictionary.h" VR_ERROR _stdcall file_to_buffer_internal(HANDLE file, unsigned char** buffer, DWORD* size) { VR_ERROR result =VR_NO_ERROR; DWORD size_high; DWORD bytes; do { *size =GetFileSize(file, &size_high); if(size_high) { result =VR_FILE_TOO_LARGE; break; } ...
C
#include <pthread.h> #include <stdlib.h> #include <stdio.h> #include <sched.h> #include <time.h> #include <syslog.h> #define NUM_THREADS 2 pthread_mutex_t simple_mutex; typedef struct { int threadIdx; } threadParams_t; typedef struct{ struct timespec time_stamp; double x; double y; double z; ...
C
#include <unistd.h> #include <stdio.h> #include <string.h> #include <stdlib.h> int main (int argc, char **argv){ FILE * pipe = popen("sort", "w"); char buffer[128]; char * status = gets(buffer); //wait for ctrl+d while (status != NULL) { fprintf(pipe, "%s\n", buffer); status = gets...
C
#include<stdio.h> #include<string.h> int main() { char str[20]; gets(str); int i=0; while(str[i]!='\0'){ i++; } int len = strlen(str); printf("Length Without In-built Function : %d\n",i); printf("Length With In-built Function : %d\n",len); return 0; }
C
//#pragma once // ///* // Serial interface for the HackHD via arduino // N. Seymour-Smith 25/09/13 // // This program should keep the HHD on standby at all times // and take commands from serial to record. Set "auto = 0" to // avoid this, and let the HHD remain off // // Send number command by serial (no newl...
C
/********************************************************************* * * * FICHIER: CLIENT_TCP * * * * DESCRIPTION: Utilisation de TCP s...
C
/*linux Ӳк*/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/ioctl.h> #include <fcntl.h> #include <linux/hdreg.h> int main(int argc,char *argv[]) { static int open_flags = O_RDONLY|O_NONBLOCK; static int errno = 1; static struct hd_driveid id; ...
C
#include<stdio.h> int main() { int a,b,i,flag; { printf("enter the range"); scanf("%d%d",&a,&b); printf("primr no between %d and %d are:",a,b); while(a<b) { flag=0; for(1=2;i=a/2;i++) { if (a%i==0) { flag=1; break; } } if(flag==0) printf("%d",a); ++a; } getch(); }
C
#include <stdio.h> #include <stdlib.h> main() { int salario, acrecimo, novoSalario; printf("\n Digite o seu salario para analise: "); scanf( "%d", &salario); if (salario <= 800) acrecimo = salario * 0.10; else acrecimo = salario * 0.20; novoSalario = salario + acrecimo; ...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <stdint.h> #include <stdbool.h> #include <unistd.h> #include "queue.h" #define TOPBIT(x) ((x) >> 31) struct trieNode { struct trieNode* n[2]; int t; //terminal symbol unsigned int net; unsigned int mask; }; struct trieNode* createNode(void) { s...
C
#include <stdio.h> //#include"bib_Tipos.h" //Definição dos nós da pilha typedef struct dado { //int a; lista_simb* tbl; struct dado* ant; //Apontador pro elemento empilhado abaixo do atual } dado; //Definição da pilha typedef struct pilha{ dado* topo; //Apontador pro topo da pilha } pilha; //Função de in...
C
#include<stdio.h> #include<stdlib.h> int check(int *a); int main() {  int a[13]; int i = 0; int result; printf("Please type ISBN number\n"); for (i = 0; i < 13; i++)  scanf("%d", &a[i]); result = check(a); if (result == 1) printf("It is valid number"); else if (result == 0)  pr...
C
// Print a number in reverse order #include <stdio.h> void main() { int num = 256, digit; while (num > 0 ) { digit = num % 10; // take last digit printf("%d", digit); num /= 10; // remove last digit } }
C
#include<stdio.h> #include<conio.h> void main() { int i, no_p, sum=0,count=0, y; int quant, wt=0, tat=0, at[10], bt[10], temp[10]; float avg_wt, avg_tat; clrscr(); printf("Total number of process in the system: "); scanf("%d", &no_p); y = no_p; for(i=0; i<no_p; i++) { ...
C
// main function for evaluation expression exercise #include <stdio.h> #include <stdlib.h> #include <string.h> #include "evalexp.h" // tree construction functions struct exp *mkvar(char *cp) { struct exp *ep = malloc(sizeof(struct exp)); ep->tag = isvar; strncpy(ep->var, cp, 8); return ep; } struct exp *mk...
C
#include<stdio.h> #include<string.h> #include<unistd.h> #include<fcntl.h> #include<errno.h> #include<stdlib.h> #include<sys/wait.h> #include<signal.h> void sys_err(char *str) { perror(str); exit(1); } int main(int argc, char* argv[]) { pid_t pid; pid = fork(); if(pid < 0) { sys_err("fork error"); } else if(...
C
// local #include "tools/alerts.h" #include "tools/tools.h" #include "tools/proxy_alerts.h" #include "proxy.h" // getrlimit() #include <sys/time.h> #include <sys/resource.h> // open() #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> //==================================================================...
C
#pragma once #include <windows.h> #include <stdio.h> #include <conio.h> #include <tchar.h> #include"plog\Log.h" #include"DefenitionConstants.h" int PipeMain(char *message) { LOG_DEBUG << "Start Pipe whith message : "<< message; HANDLE hPipe; LPTSTR lpvMessage =(LPTSTR)message; wchar_t ProviderAnswer[128]; BOOL ...
C
#include <stdio.h> #include <math.h> #include <stdlib.h> double Integrate_Trapezoid(double a,double b,int n,double (*func)(double)) { double h = (b-a)/(double)n,ans=0.0; for(int i=0;i<n;i++) { ans += ((((*func)(a+i*h+h))+((*func)(a+i*h)))/2)*h; } return(ans); } double adapt(double eps,double a,double b,int...
C
#include<stdio.h> #include<stdlib.h> int main(void) { int x=0; int y = 1; while (y>0) {printf("%d %d ",x,y); x = x + y; y = x + y; } system("pause"); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <limits.h> #include <math.h> #include <time.h> #define bool int // Function returns floor of square root of x int floorSqrt(int x) { // Base cases if (x == 0 || x == 1) return x; // Staring from 1, try all numbers until // i*i is greater than or equal to x. int i...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* create_cat_arr.c :+: :+: :+: ...
C
#include <stdio.h> #include<stdlib.h> struct node{ int data; struct node* next; }; struct node* head=NULL; struct node* tail=NULL; void create(){ struct node* newnode,*tail; int x,choice=1; while(choice){ newnode=(struct node*) malloc(sizeof(struct node)); printf("enter data in lis...
C
// constructors scmval make_bool(bool); static inline scmval s_bool(bool b) { return b ? scm_true : scm_false; } // predicates static inline bool is_bool(scmval v) { return type_of(v) == SCM_TYPE_BOOL; } static inline bool is_true(scmval v) { return is_bool(v) && v.b; } static inline bool is_false(scmval v) { return i...
C
#include<stdio.h> #include<stdlib.h> typedef struct Node { int pow; int coef; struct Node* next; }node; node* head; node* read_poly() { node* temp; temp = (node*)malloc(sizeof(node)); int co,po; printf("Enter the Coefficiennt and power\n"); scanf("%d%d",co,po); temp->pow = po; temp->coef = co; temp->next =...
C
/* ************************************************************************** */ /* */ /* :::::::: */ /* u_convert_4.c :+: :+: ...
C
// -------------------------------------------------------------------------------- // Ovladac tepelne soustavy v jazyku C: top_kl25z.C // Pro Freedom board FRDM-KL25Z (Kinetis MCU) // // Pouziva pin C9 pro ovladani topeni. // Snimani vyuziva ovladac pro SMT160, ktery pouziva piny A12 a A13 // Tedy HW propojeni: // P...
C
/* * Slave_4bits.c * * Created on: 15 de mai de 2018 * Author: gabrielfl */ /* Includes ------------------------------------------------------------------*/ #include "Slave_4bits.h" #include "gpio.h" void Read_Address_Request(int *AddrRead) { int InputArray[4]; /* Clean variable */ ...
C
//WAP for armstrong. #include<stdio.h> #include<conio.h> void main(){ long int a,b,cube=0; while(a>0){ b=a%10; a=a/10; cube=cube+b*b*b; } if(cube=a) printf("It is armstrong number"); else printf("It is not an armstong number"); getch(); }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_advanced_sort_wordtab.c :+: :+: :+: ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* checking.c :+: :+: :+: ...
C
/* Sia data una struttura dati dinamica di tipo lista semplicemente concatenata. Ogni nodo della lista contiene un numero intero come valore. Si scriva la funzione che, dato un vettore di N numeri interi, restituisce la lista contenente gli N elementi del vettore; l’elemento di indice 0 va in testa alla lista, ecc....
C
#include <SDL2/SDL.h> #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include "color.h" #include "debug.h" #include "error.h" #include "settings.h" #include "sdladdon.h" SDL_Window *window = NULL; SDL_Surface *surface = NULL; SDL_Surface *image = NULL; char figure_1[] = FIGURE_DIR"/eye_1.png"; char figur...
C
// // CKCalendarMonthCellStates.h // MBCalendarKit // // Created by Moshe Berman on 4/10/13. // Copyright (c) 2013 Moshe Berman. All rights reserved. // #ifndef MBCalendarKit_CKCalendarCellContextIdentifier_h #define MBCalendarKit_CKCalendarCellContextIdentifier_h /** These states represent the possible uses (or...
C
/* * File: pa1Strings.h * Description: Header file containing strings that are displayed to the user. * * XXX DO NOT EDIT THIS FILE * */ #ifndef PA1_STRINGS_H /* Header guard */ #define PA1_STRINGS_H #define INVALID_ARGS "Incorrect number of args.\n" #define FILTER_ERR "Error opening input filter file\n" #defi...
C
#include<stdio.h> #include<stdlib.h> typedef struct { double altura; char nome[30]; } modelo; double module(double x); int busca_binaria(const modelo *vet, double h, int len); int c_busca_binaria(const modelo *vet, double h, int len); int main() { int n, i = 0; double hi = 0; scanf("%d", &n); scanf("...
C
#include <stdio.h> #include <time.h> #include <termios.h> #define FIELD_WIDTH 32 #define FIELD_HEIGHT 32 #define AREA_MAX 16 #define AREA_SIZE_MIN 8 typedef struct { int x, y, w, h, i; } AREA; AREA areas[AREA_MAX]; int area_cnt = 1; int getch(void) { char c; struct termios t; tcgetattr(0, &t); t.c_l...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> double main() { float largura=0; float comprimento=0; float area=0; printf("Calculo da area de um retangulo\n"); printf("Entre a largura:\n"); scanf("%f", &largura); while (largura<=0){ printf("Valor invalido, impo...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* tools.c :+: :+: :+: ...
C
#include <stdlib.h> #include <stdio.h> struct _retire_info { int months; double contribution; double rate_of_return; }; typedef struct _retire_info retire_info; void printCurrentBalance(int age, double balance) { printf("Age %3d month %2d you have $%.2lf\n", age / 12, age % 12, balance); } double accountCa...
C
#include<stdio.h> #include<fcntl.h> int main(int argc, char *argv[]){ if(fork()){ int status; wait(&status); int fd = open(argv[1], O_RDONLY); int bytes = 1; char buff[1]; int size = 1; int flag = 1; while(bytes > 0){ bytes = read(fd, buff, size); if(flag != 0){ flag = 0; write(1, buff, ...
C
#include <stdio.h> int main() { int cars; int computers; int music; printf("on a scale of 1 to 10, what is the user's level of interent in cars?: "); scanf("%d", &cars); printf("on a scale of 1 to 10, what is the user's level of interent in computers?: "); scanf("%d", &computers); print...
C
#include<stdio.h> #include<stdlib.h> typedef struct dlnode_tag { int data; struct dlnode_tag *prev; struct dlnode_tag* next; }dlnode_type; dlnode_type *dlmakenode(int data) { dlnode_type *new_node = ( dlnode_type *) malloc(sizeof(dlnode_type)); new_node->data = data; new_node->prev =...