language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* * aes.c * ߼ܱ׼Advanced Encryption Standard: AESұ׼뼼оԺNIST * 2001꽨˵ݵļܹ淶 * ǶԳƼӽ㷨㷨֮һһַܱ׼ * ÿܿСΪ128λԿΪ128192256λֻECBCBCCFBOFBּģʽ * * Created on: 2019115 * Author: luozhiyong */ #include <rtthread.h> #ifdef TINY_CRYPT_AES #include <tiny_aes.h> #include <stdlib.h> typedef unsigned char uchar; /** * ECBģʽֳ...
C
/** * @file LEDMat.h * @author Hamilton Lee & Zoltan Csaki * @copyright All rights reserved, 2020 * * This file holds definitions for a fully functional driver for * the Adafruit 8x16 Matrix ADAFRUIT 1.2' LED Matrix. * * URL: https://www.adafruit.com/product/2035 * * DRIVER chip: HT16K33 * * @warning This f...
C
/* ** Copyright 2015, Bart Kampers */ #include "MeasurementTable.h" #include <stdlib.h> #include <string.h> #include <math.h> /* ** Private */ #define ENABLED_MASK 0x01 MeasurementTable measurementTables[MAX_MEASUREMENT_TABLES]; int measurementTableCount = 0; Status InitMeasurementTable(MeasurementTable* meas...
C
/* * * refactor using pigpio * *********************************************************************** */ #include <stdio.h> #include <string.h> #include <errno.h> #include <stdlib.h> #include <limits.h> #include <pigpio.h> #include <unistd.h> #include <time.h> int max_timeout = 15000; //15 sec max interrupt tim...
C
#include<stdio.h> #include<stdlib.h> struct BST{ int data; struct BST *left; struct BST *right; } *temp= NULL, *root = NULL; typedef struct BST NODE; NODE* create(NODE* root ,int info){ if(root == NULL){ temp = (struct BST *)malloc(sizeof(struct BST)); temp->data = info; temp->left = NULL; temp->right = ...
C
/* For each of the following pairs of scanf format strings, * indicate whether or not the two strings are equivalent. * If they're not, show how they can be distinguished. * (a) "%d" versus " %d" * (b) "%d-%d-%d" versus "%d -%d -%d" * (c) "%f" versus "%f " * (d) "%f,%f" versus "%f, %f" */ #include...
C
#include <stdlib.h> #include <stdio.h> #include "parsing.h" #include <stdbool.h> #include "except.h" #include "assert.h" #include <inttypes.h> #include "bitpack.h" const int UINT32_SIZE = 32; const int BYTE_SIZE = 8; void parsing_test(FILE *input); FILE* getFile(int argc, char *argv[]); int main(int argc, char *ar...
C
/* * UniformMovement.c * * Created on: 01.07.2018 * Author: Dominik * Author: Adam */ #include <stdio.h> #include "UniformMovement.h" Weg s(Geschwindigkeit v, Zeit t, Zeit t0) { return v * (t - t0); } Weg uaS(Geschwindigkeit v, Geschwindigkeit v0, Beschleunigung a) { return (v ...
C
/* Copyright (c) 1992 by AT&T Bell Laboratories. */ /* Advanced C++ Programming Styles and Idioms */ /* James O. Coplien */ /* All rights reserved. */ class Stack { public: Stack() { } ~Stack() { } int pop() { return 1; } void push(int) { } }; class CountedStack { public: CountedStack(): rep(new CountedStackR...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> int arraySum(int *ptr, const int n); int main(void) { int values[120] = {3, 7, -9, 3, 6, -1, 7, 9, 1, -5, 8, 1, 5, 5}; printf("The sum is %i\n", arraySum(values, sizeof(values) / sizeof(int))); return 0; } int arraySum(int ...
C
#include "3-calc.h" /** * get_op_func - manage the option * @s: symbol of operator (string) * * Return: int */ int (*get_op_func(char *s))(int, int) { int pos = 0; op_t ops[] = {{"+", op_add}, {"-", op_sub}, {"*", op_mul}, {"/", op_div}, {"%", op_mod}, {NULL, NULL}}; while (ops[pos].op) { if (!(strcmp(ops[...
C
/* * @Author: obsidian * @Date: 2016-03-05 15:51:29 * @Last Modified by: obsidian * @Last Modified time: 2016-03-10 14:50:18 */ #include "numstr.h" #include "driver/math/inc/math.h" #include "demo.h" #include "lcd_struct.h" #include "lcd_global.h" void num_init(); void num_input(char key); void num_show(unsigned ...
C
#include <Wire.h> struct { char Year; char Month; char Date; char Day; char Hour; char Min; char Sec; char TempYear; char TempMonth; char TempDate; char TempDay; char TempHour; char TempMin; char TempSec; } DS3231_Data; void DS3231_ReadData() { Wire.beginTransmission(0x68); Wire.write...
C
#include<stdio.h> #include<stdlib.h> struct node{ int info; struct node* link; }; struct node* first; void insert_rear(){ struct node* temp; temp=(struct node*)malloc(sizeof(struct node)); printf("Enter the integer\n"); scanf("%d",&temp->info); temp->link=NULL; if(first==NULL){ first=temp; } ...
C
// Take substring of some variable string and give it to another function? // Concatenate two strings and branch on value of the string given that it // matches some other string (both variable and fixed) #include <stdlib.h> #include <stdio.h> #include <string.h> #include <klee/klee.h> #define SIZE 3 char* strin...
C
#ifdef _MSC_VER #define _CRT_SECURE_NO_WARNINGS #endif #include <stdlib.h> #include <stdarg.h> #include "lista_nos_internos.h" void imprime_nos_internos(int d, TListaNosInternos *lc) { int i; for (i = 0; i < lc->qtd; i++) { imprime_no_interno(d, lc->lista[i]); } } TListaNosInternos *cria_nos_internos(int d, i...
C
int f(int x) { switch(x) { case 1: x = 2; break; case 2: x = x + 1; default: x = x*2; } return x; }
C
/* Sets and query's used by lightsaber */ set_ignited(int i){ ignited = i; } query_ignited(){ return ignited; } adj_wep_life(int i) { wep_life += i; } set_wep_life(int i){ wep_life = i; } query_wep_life(){ return wep_life; } query_wep_color(){ return wep_color; } set_is_jedi(int i){ is_jedi = i; } query_is_jedi(){ ...
C
// // main.c // Cyborg Project // // Created by Zachary Downing on 2/5/20. // Copyright © 2020 Zachary Downing. All rights reserved. // #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <ctype.h> #include "encode.h" #include "decode.h" #include "utils.h" int encodeMode(const ...
C
#include "header.h" unsigned int clearBits(unsigned int parkingRow, int n) { for (int i = 0; i < n; i++) { parkingRow &= ~(1 << i); } return (parkingRow); }
C
/*Joo Vitor Moura Int. programao, turma 01 Item 07 Lista 5 */ #include <stdio.h> float Media_aritmetica(float,float,float); float Media_ponderada(float,float,float); float Media_harmonica(float,float,float); int main(){ int opcao; float nota1, nota2, nota3, media; printf("O programa clacula 3 ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_lstmap.c :+: :+: :+: ...
C
#include<stdio.h> void main() { int b,h; float area; scanf("%d %d",&b,&h); area=0.5*b*h; printf("\n AREA=%f",area); }
C
//******************************************************************* // FIRST NAME: Angad Pal // LAST NAME: Dhanoa // kernel.c // Phase 0, Prep 4, Timer Event Handling //******************************************************************* #include <spede/flames.h> // some SPEDE stuff that helps... #includ...
C
#include "variadic_functions.h" #include <stdio.h> #include <stdlib.h> #include <stdarg.h> /** *print_strings - prints a string *@separator: string to be printed between numbers *@n: number of integers passed to the function *Return: always 0 **/ void print_strings(const char *separator, const unsigned int n, ...)...
C
#include "main.h" // No borrar bool _mas_de_mitad(int *arr, size_t inicio, size_t fin, size_t n, int *contador) { if (*contador > n / 2) return true; int elem = arr[inicio]; while (inicio <= fin) { if (elem == arr[inicio]) *contador++; inicio++; } size_t medi...
C
#pragma once #include <GL/glew.h> /************************ERROR HANDLING************************/ /* A backslash allows you to define a macro over multiple lines. */ /* If the x which is parsed into ASSERT() returns false, a debug break will occur which stops the process of the program and shows us where the ...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #define COMMON_DIVISOR "1011" char xor(char a, char b); char* divide(char* dividend, char* divisor); char* encode(char* data); void decode(char* data); void main() { char data[7]; printf("Enter 4-bit data : "); scanf("%s", data); printf("Data to send : %s...
C
/* ********************************* * Using typedef with struct * ******************************** */ #include <stdio.h> #include <string.h> int main() { struct person { char name[50]; int iq; }; struct person me; strcpy(me.name,"George Calin"); me.iq=100; printf("%s h...
C
#include <stdio.h> #include <stdlib.h> #define m 2 #define n 3 int main() { int i,j,k,(*m1)[n],(*m2)[m],a[m][n],b[n][m],sum=0; m1=a; m2=b; printf("Enter first matrix:\n"); for(i=0;i<m;i++) { for(j=0;j<n;j++) { scanf("%d",(*(m1+i)+j)); } } printf("En...
C
/* * https://www.geeksforgeeks.org/array-rotation/ * * Program for array rotation * * Write a function rotate(ar[], d, n) that rotates arr[] of size n by d elements. * Input = 1,2,3,4,5,6,7 * Rotation of the above array by 2 will make array * Output = 3,4,5,6,7,1,2 */ #include <stdio.h> #include <stdlib.h>...
C
// // countWord.c // Pointer // // Created by Harun Öz on 11/26/18. // Copyright © 2018 Harun Öz. All rights reserved. // #include <stdio.h> int countWord(char * s1){ int count=0; int len=strlen(s1); if(isalnum(*s1)){ count=1; } for(int j=1; j<len;j++){ if(isalnum(*(s1+j)...
C
#include <stdio.h> #define BOUND 1000000 #define SQUARES_CACHE_SIZE 1000 #define PRIMES_SIZE 1000000 int primes[PRIMES_SIZE]; int num_primes = 0; int squares_cache[SQUARES_CACHE_SIZE]; int sum_cache[PRIMES_SIZE]; int max_sequence = 6; int max_prime = 41; int squares(int n) { if (squares_cache[n] == 0) squares_cac...
C
#include <stdio.h> #include <stdlib.h> #include <strings.h> #include <conio.h> #include <ctype.h> #include "funciones.h" int main() { EMovie* peliculas; FILE* pFile; EMovie* aux; int validacion = 0; int cont=0; char seguir='s'; int opcion=0; int* contador=&cont; int...
C
#include <stdio.h> int main() { char kadi[20], pass[20]; tekrar: printf("Username: "); scanf("%s", &kadi); printf("Password: "); scanf("%s", &pass); if (strcmp(kadi, "admin") == 0 && strcmp(pass, "12345") == 0) { printf("Giris Basarili!"); } else { printf("Hatali Giris\...
C
/** @file * Implements Grover's algorithm for unstructured search, * using only X, H and multi-controlled Z gates * * Compile and run from within the build folder, using: cmake .. -DUSER_SOURCE=../examples/grovers_search.c \ -DOUTPUT_EXE=grovers make ./grovers * * * @author Tyson Jones */ #include <st...
C
#include <stdio.h> #include <cs50.h> #include <string.h> #include <ctype.h> #include <math.h> int count_letters(string text); /* function for counting letters*/ int count_words(string text); /* function for counting words*/ int count_sentences(string text); /* function for counting sentences*/; int main(void) { f...
C
#include<stdio.h> main() { // Integar int x = 7; // declaration and initialization int y = 8; // declaration and initialization int z = 9; // declaration and initialization // single output printf("The Number Is Equal to %d \n", x); // multiple output printf("X = %d \t Y = %d \t Z = %...
C
#include<stdio.h> #include<conio.h> void main() { int i,a,b,x,y; clrscr(); printf("\n enter the numbers "); scanf("%d%d",&a,&b); x=a*b; for(i=0;i<(x/2);i++) { y=i*i; } if(y==x) printf("\nyes "); else printf("\n NO "); }
C
#include<stdlib.h> #include<stdio.h> #include<string.h> #include<time.h> #include "chtbl.h" int list_dest_elm(void *key, void *data); char* list_print_elm(void *key, void *data); int vstrcmp(void *key1, void *key2); int chtbl_init(CHTbl *htbl, int buckets, unsigned long (*h)(const void *key), int (*match)(const void ...
C
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <cilk/cilk.h> int main(int argc, char * argv[]) { int n = (argc > 1 ) ? atoi(argv[1]) : 1000; double * x = malloc(n*sizeof(double)); assert(x!=NULL); double * y = malloc(n*sizeof(double)); assert(y!=NULL); for (int i=0; i<n; i++) { ...
C
#include <stdio.h> #include "func.h" extern fbscr_t fb_v; int fb_one_pixel(int x, int y, u32_t color) { *((u32_t *)fb_v.memo + x + y*fb_v.w) = color; return 0; } int square(int x, int y, int len, u32_t color) { int i = 0; int j = 0; for(j=0; j<len; j++) { for(i=0; i<len; i++) { fb_one_pixel(x+i, y+j, ...
C
/* ************************************************************************** */ /* */ /* :::::::: */ /* exec_create_files.c :+: :+: ...
C
/** boot.h ====== Header file relative to boot information **/ #ifndef BOOT_H #define BOOT_H /** Includes -------- - define.h - types.h **/ #include <define.h> #include <types.h> /** Constants: types of memory in a memory map ------------------------------------------- **...
C
#include <stdio.h> #include <stdlib.h> #define TAM 2 void mostrarAlumnos(int leg[], int age[], char sex[], int n1[], int n2[], float prom[], int tam); void mostrarAlumno(int leg, int age, char sex, int n1, int n2, float prom); int main() { char sexos[TAM]; int legajos[TAM]; int edades[TAM]; ...
C
/* * main.c * * Created: 3/10/2021 9:56:16 AM * Author: rik vos */ #include <avr/io.h> #include <util/delay.h> #include <avr/interrupt.h> #define BIT(x) (1 << (x)) int enabled = 0; ISR(INT0_vect){ enabled = !enabled; } // wait(): busy waiting for 'ms' millisecond // Used library: util/delay.h void wait( int...
C
#include <stdio.h> #include <cs50.h> int main(void) { long number = get_long("Number: ");; int counter = 0; long sumOfOdd = 0; long sumOfEven = 0; long first = 0; long second = 0; while (number > 0) { second = first; first = number % 10; if (counter % 2 == 0) { // Ev...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> #include <signal.h> struct pw_element { int len; const char *str; int flags; }; /* * Flags for the pw_element */ #define CONSONANT 0x0001 #define VOWEL 0x0002 #define DIPTHONG 0x0004 #define NOT_FIRST 0x0008...
C
/** * Copyright (C) 2017-2019 Jakob Riedle <riedle@validas.de>, Validas AG * * This file is part of the ForeC++ Target Framework. * * All Rights reserved. Unauthorized copying of this file via any medium * is strictly prohibited. Proprietary and confidential. */ #ifndef _TARGET_UNITTEST_UTILITY_BIGFLOAT_COMPARI...
C
/* Combustivel */ #include <stdio.h> int main (void) { float litros; int quilometragem, horas,distancia; scanf("%d", &horas); scanf("%d", &quilometragem); distancia = quilometragem * horas; litros = distancia / 12.0; printf("%.3f\n", litros); return 0; }
C
#include <stdio.h> int main (void) { //Faz um comentário com / /*Faz outro comentário, mas precisa terminar no final do texto e pode ter várias linhas*/ printf ("comida\n boa.\n"); // "/n" pula linha return 0; }
C
#include <unistd.h> int main(){ if((write(1, "Welcome to System Programming", 27)) != 27) write(2, "A write error has occurred on file descriptor 1\n", 47); exit(0); }
C
#include <stdio.h> extern int sum(int a, int b); int main() { int a = 10, b = 2; int c = sum(a, b); printf("This is 'C'\n"); printf("result = %d\n", c); return 0; }
C
/************************************************************************* > File Name : alloc.c > Author : lirongwei > Mail : a2413044193@gmail.com > Created Time : 2020/07/08 11:00:41 ************************************************************************/ #include <stdio.h> #include <stdl...
C
#include <stdio.h> int main(void) { int a; for(a = 1; a < 21; a= a + 2){ if(a != 5){ if (a != 11){ if(a !=15){ printf("%d \n",a); } } } } return 0; }
C
#include "graph.h" t_graph *init_graph(size_t size) { t_graph *graph; t_lst **arr; graph = (t_graph *)malloc(sizeof(t_graph)); check_malloc(graph); arr = (t_lst **)malloc(sizeof(t_lst *) * size); check_malloc(arr); for(size_t i = 0; i < size; i++) { arr[i] = NULL; } graph->arr = arr; graph->V = size; re...
C
#include <stdio.h> #include <winpr/crt.h> #include <winpr/path.h> #include <winpr/tchar.h> #include <winpr/winpr.h> static const TCHAR testExtDot[] = _T(".exe"); static const TCHAR testExtNoDot[] = _T("exe"); static const TCHAR testPathNoExtension[] = _T("C:\\Windows\\System32\\cmd"); static const TCHAR testPathExten...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { int n; char v[6]; scanf("%d ", &n); while(n!=0) { gets(v); if(strlen(v)>=5) { printf("3\n"); } else { if((v[0]='o' && (v[1]=='n' || v[2]=='e')) || (v[1]=...
C
#include<stdio.h> #include<string.h> void main() { char s[20],s2[20]; printf("enter the strings:\n"); scanf("%s\n%s",&s,&s2); strcat(s,s2); printf("%s",s); }
C
/* *************************************************************************** Name: Max N. Philip Student Number: 836472 Login ID: mphilip1 Program written by Max Philip for Assignment 2 of Computer Systems (COMP20023) Semester 1, 2018. C program that reads in a CSV file of paths to TLS certificate fil...
C
#include <stdio.h> #include <stdlib.h> #include <mpi.h> int main( int argc, char**argv) { MPI_Init(&argc,&argv); const int N = 20; int *array[N]; int *new_array[N]; for (int i=0;i<N;i++) { array[i] = malloc(sizeof(int)); new_array[i] = malloc(sizeof(int)); } for (i...
C
#include <stdio.h> int main() { int p1,p2,q1,q2; double v1,v2; scanf("%i %i %lf", &p1, &q1, &v1); scanf("%i %i %lf", &p2, &q2, &v2); printf("VALOR A PAGAR: R$ %.2lf\n", (q1 * v1) + (q2 * v2)); return 0; }
C
#define _GNU_SOURCE #include <stdio.h> #include <sys/stat.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> #include "debugutil.h" #define GPIO_PATH "/sys/class/gpio/" /*New! now with static stack memmory allocation!:*/ #define FNAMEBUFFSZE (64) int set_gpio_toval (int gpionr, int val) { char filenam...
C
//#include <iostream> //#include <math.h> //#include "imesh2D.h" //#include "additional.h" int bigger(double x,double y,double s,double b){ double y2=s*x+b; if(y > y2) return 1; else return 0; } void segmentedCircle(Delaunay & dt,double xc,double yc, double r){ for(Finite_faces_iterator it = dt.finite_faces_begin...
C
#include "keyboard.h" #include "egpio.h" /* Must be power of 2 */ #define KBD_SCAN_SIZE 4 typedef enum { ksNone = 0, ksSelectRow, ksWaitSelectRow, ksGetValue, ksWaitGetValue, } kbd_state_t; static kbd_state_t _kbd_state = ksNone; static uint8_t _kbd_row_index; static uint8_t _kbd_scan_prev[KBD_...
C
// Compute kernel for a "scale" cell. A port of MATLAB's imresize using bicubic interpolation. // Note: this kernel is separable and could therefore be rewritten as two stages. #BLOCKSIZE 16 16 LAYER_PTR z = PZS(0); // Compute scaling factors. float pySpace = LAYER_Y_SPACE(z); float pxSpace = LAYER_X_SPACE(z); floa...
C
/* 13.03.2017 Pawel Swora Program wywietla zakresy minimalne i makksymalne zmiennych cakowitych ze znakiem i bez zbaku. */ #include <stdio.h> int main() { char zm_char=1; unsigned char zm_uchar=1; printf("Char ze znakiem \n\n"); printf("Wielkosc char w bajtach: %d\n...
C
/* * bno055.c * * Created on: Jun 24, 2021 * Author: by */ #include <bno055.h> extern UART_HandleTypeDef huart4; void BNO055Read(uint8_t reg, uint8_t* data, uint8_t resp_byte, uint16_t bytes) { //Concatenate data uint8_t read_command[4]; read_command[0] = 0xAA; read_command[1] = 0x01; read_command[2] =...
C
#include <stdio.h> #include <stdlib.h> #include "stack.h" void matsolve(); void maze(); FILE *fptr; int main(){ int c; print("MAze generate : 0\nMAze Solve : 2\n"); scanf("%d",&c); if(c==0) maze(); else matsolve(); printf("\n"); return 0; } void maze(){ printf("\nMAze generation nxn : Enter...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_toolbox.c :+: :+: :+: ...
C
#include <stdio.h> int GCD(int n,int m) { if(m==0) return n; return GCD(m,n%m); } int main() { int n,m,gcd; printf("Enter first number: "); scanf("%d",&n); printf("\nEnter second number: "); scanf("%d",&m); gcd=GCD(n,m); printf("\nGCD of %d and %d is: %d",n,m,gcd); retu...
C
#include "heuristic_solver.h" #include <stdlib.h> #include <stdio.h> #include <config/config.h> #include "log/verbose.h" #include "utils/str_utils.h" #include "utils/time_utils.h" #include "utils/assert_utils.h" #include "utils/mem_utils.h" #include "timeout/timeout.h" #include "finder/feasible_solution_finder.h" void...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> int computerGame (int); //Main program for the computer version of Mastermind. Can be called from website, as it is not interactive. The function computerGame is called. int main(int argc, char* argv[]) { if (argc != 2) { printf("Error - program %s exp...
C
/** * @file queue.h * @author Ask and Sivaranjith * @brief Get the next floor and interact with the linked list, an queue wrapper for linked list * @version 0.1 * @date 2021-02-22 * * @copyright Copyright (c) 2021 * */ #ifndef QUEUE_H #define QUEUE_H #include "linked_list.h" typedef enum{ QUEUE_DIRECT...
C
#include "includes.h" //̳߳е߳ void *qc_subthread_loop(void *arg) { qc_pthread_detach; if (! arg) { return NULL; } short witch = *((short *)arg); free(arg); char readbuf[10]; sleep(1); if (! qc_threadpool_check(witch, pthread_self())) { LOG_ERROR_INFO("not self!\n"); exit(-1); } while (1) { ...
C
/* * Saba Ramadan * Assignment 8 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "myGrep.h" FILE *f; char S[M]; char C[M]; char L[M]; char *x; int l = 0; int c = 0; int wc = 0; int n = 0; int temp = 0; W *h = NULL; W *t = NULL; int main(int argc, char *argv[]) { if (argc != 3) { ...
C
/*Done By:- Frankline Bosire // Simeon Kengere // Iyvonne Bett Maluki Muthusi Gerry Kyalo */ #include<stdio.h> #include<stdlib.h> //Initialize variables int semaphore = 1, full = 0, empty = 0, x = 0, choice; //Prototype functions void producer(); void consumer(); int wait(int); int signal(int); /...
C
#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <fcntl.h> #include <sys/mman.h> /* This code shows how to create a new file and then mmap it to put data inside of it. It creates the file in /hugepages, which should be where you have setup your hug...
C
/** @file msort.c */ #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <string.h> //struct to contain inputs necessary for multi-threaded qsort typedef struct qsort_inputs { int * list; int num_to_sort; } qsort_inputs; //struct to contain inputs necessary for multi-threaded merge typedef struc...
C
#include <cs50.h> #include <ctype.h> #include <stdio.h> #include <string.h> int main( int argc, string argv[]) { if (argc != 2) // validate the arguments { printf("Usage: ./substitution key\n"); return 1; } else if (strlen(argv[1]) != 26) { printf("Key must contain 26 chara...
C
#include<stdio.h> #include<stdlib.h> typedef struct node { int data; struct node *left,*right; } node; void inorder(node *root) { if(root) { //printf("traverring...%d\n",root->data); //getch(); inorder(root->left); printf("%d",root->data); inorder(root->right); } else return; } ...
C
#include <stdio.h> #include "quadrado.h" static int quadrado_valido(quadrado_t q); static int quadrado_valido(quadrado_t q){ if(q.l<=0){ printf("Não é um quadrado! Lados negativos ou nulos.\n"); return 0; } return 1; } quadrado_t cria_quadrado(void){ printf("Digite o lado do quadrado: "); quadrado_t q; do...
C
#include<stdio.h> #include<conio.h> #include<windows.h> int gotoxy(short x, short y){ COORD coord; HANDLE h_stdout; coord.X = x; coord.Y = y; if((h_stdout = GetStdHandle(STD_OUTPUT_HANDLE)) == INVALID_HANDLE_VALUE) return 0; if(SetConsoleCursorPosition(h_stdout, coord) == 0) r...
C
#include "queue.h" #include <stdlib.h> #include <string.h> Queue* create(int typeSize, int noOfElements) { Queue *queue = malloc(sizeof(Queue)); queue->elements = calloc(noOfElements,typeSize); queue->noOfElements = noOfElements; queue->elementSize = typeSize; queue->front = 0; queue->rear = -1; return queue; ...
C
/* * ===================================================================================== * * Filename: object.h * * Description: * * Version: 1.0 * Created: 02/01/2014 12:20:59 PM * Revision: none * Compiler: gcc * * Author: Neophytos Demetriou (), * ...
C
/* A Fast 2D Point-On-Line Test by Alan Paeth from "Graphics Gems", Academic Press, 1990 */ #include "GraphicsGems.h" int PntOnLine(px,py,qx,qy,tx,ty) int px, py, qx, qy, tx, ty; { /* * given a line through P:(px,py) Q:(qx,qy) and T:(tx,ty) * return 0 if T is not on the line through <--P--Q--> * ...
C
#include "ht.h" #define INITIAL_SIZE 32 #define MAX(A, B) (A > B ? A : B) #define FNV_OFFSET 14695981039346656037UL #define FNV_PRIME 1099511628211UL static size_t hash(const char* key) { size_t hash = FNV_OFFSET; for (const char* p = key; *p; p++) { hash ^= (size_t)(unsigned char)(*p); hash *...
C
#include "quiz.h" #include <stdio.h> #include <stdlib.h> #include <string.h> void parseCSVStruct(struct quiz given[],unsigned fileLength,const char * fileName){ //standard file opening char temp[100]; FILE *f = fopen(fileName,"r"); if (f == NULL){ printf("The file cannot be found"); exi...
C
#include<stdio.h> int main() { int a=10,b=20,sum; sum=a+b; printf("sum=%d",sum); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include "indxlook.h" struct tree_node /* node in tree */ { struct tree_node *l_ptr, *r_ptr; /* left and right pointers */ INDEX *data_ptr; /* data pointer */ }; typedef struct tree_node TREE_NODE; void wri...
C
#include <string.h> #include "is_winning.h" #include "player.h" #include "graph_struct.h" #include <dlfcn.h> #include <getopt.h> #include <time.h> #define NB_PLAYERS 2 #define MAX_TURN 300 #define TRUE 1 #define FALSE 0 #define FAILURE 1 static char shape = 'h'; static int m = 9; void parse_...
C
/* Tutti II sound emulation (C)2015-7 Cameron Kaiser. All rights reserved. */ #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include "SN76489AN.h" #if defined(__clang__) || defined(__GNUC__) # define LIKELY(x) (__builtin_expect(!!(x), 1)) # define UNLIKELY(x) ...
C
inherit "room/room"; static searched; string bush_desc; string ldesc; object sob; reset(arg) { if(arg) return; if(!searched) { bush_desc = "The bushes are deformed and twisted with somekind of dark magic.\nOne of bushes is moving and demonic roar can be heard from there"; ldesc ="This gloomy ...
C
#include <stdio.h> /* Hazrlayan : Muhammed Erdin - muhammederdinc.com */ int main() { int ilksayi=0,ikincisayi=1,i,son; printf("0 - 1 -"); for(i=0; i<=15; i++){ son = ilksayi+ikincisayi; ilksayi = ikincisayi; ikincisayi = son ; printf("%d - ",son); } return 0; }
C
typedef enum { ES_NO_EVENT, ES_SUBJECT_INPUT, ES_ENCODER_DATA } ES_EventTyp_t; typedef struct ES_Event_t { ES_EventTyp_t EventType; // what kind of event? uint16_t EventParam; // parameter value for use w/ this event }ES_Event; /*************************...
C
#pragma once #include <glm/vec2.hpp> /** * Represents a cell in the maze */ struct Cell { glm::vec2 location; float g_cost; // Distance from start cell float h_cost; // Distance from end cell float f_cost; // g cost + h cost Cell* previous = nullptr; };
C
/* * Test for salvager() */ #include "dominion.h" int failure = 0; int myassert(int x,char* msg) { if (x == 0) { printf("Assertion failed: %s\n",msg); failure = 1; return 0; } } void checkasserts() { if(!failure) { printf("Test successful! \n"); } } int main() { struct gameState gametime; int ...
C
#include <stdio.h> #include <stdlib.h> #include <malloc.h> // b 表示模式串,m 表示模式串的长度,本函数用于获取next数组 int* getNexts(char* b, int m) { int* next = (int*)malloc(sizeof(int)*m); next[0] = -1; int k = -1; for (int i = 1; i < m; ++i) { while (k != -1 && b[k + 1] != b[i]) { //如果b[k+1]!=b[i],则需要在i-1的最长匹配前缀子串中找到i-1的次长匹...
C
#include <stdio.h> #include <stdlib.h> #include <stdio.h> int main() { int num,base,mul=1,k; printf("Input the base value : "); scanf("%d",&num); printf("Input the value of power : "); scanf("%d",&base); k=power(num,base,mul); printf("The value of %d raised to the power %d is : %d",num,base,k)...
C
//Some Parts Provided by Darrell Long # include "hash.h" # include <string.h> //# include "aes.c" # include "ll.c" static inline int realLength(int l) { return 16 * (l / 16 + (l % 16 ? 1 : 0)); } uint32_t hash(hashTable *h, const char *key) //Will return the position that it needs to get stored in { uint32_t outp...