language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* ** EPITECH PROJECT, 2018 ** my_compute_factorial_it ** File description: ** Returns the factorial of the number */ int my_compute_factorial_it(int nb) { int tmp = 1; if (nb < 0 || nb > 12) return (0); if (nb == 1) return (1); for (; nb > 1; nb--) tmp *= nb; return (tmp);...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct rb_node{ struct tree_node *left, *right; int red; char *key; char *def; }rb_node; typedef struct rb_tree{ rb_node *root; }; int is_red(rb_node *root){ return root != NULL && root->red == 1; } rb_node *rota_single(rb_node *root,...
C
/* edwAddQaContamTarget - Add a new contamination target to warehouse.. */ #include "common.h" #include "linefile.h" #include "hash.h" #include "options.h" #include "options.h" #include "encodeDataWarehouse.h" #include "edwLib.h" void usage() /* Explain usage and exit. */ { errAbort( "edwAddQaContamTarget - Add a ...
C
#include <stdio.h> #include<stdio.h> int main() { int n,originalN,reversedN=0,remainder; printf("Enter a number\n"); scanf("%d", &n); remainder=n%10; printf("%d", remainder); return 0; }
C
#include <stdlib.h> #include <unistd.h> #include <memory.h> #include "queue.h" #include "linked_list.h" #define QUEUE_INSTANCE queue *q = (queue *)_q; typedef struct queue { linked_list_t *list; int size; size_t sizeof_elem; } queue; void *queue_create_impl_by_linked_list(void *size, void *dump) { qu...
C
#pragma warning(disable : 4996) #include "stdafx.h" #include "DllShowProc.h" #include<Windows.h> #include <tlhelp32.h> #include <stdio.h> #include <Winnt.h> const char* author = "Ilya Huzei"; const char* description = "This is a DLL that sends list of processes to the given listbox"; BOOLEAN GetAuthor(LPSTR buffer, ...
C
#include <stdio.h> #include <time.h> void floyd(int a[100][100],int n) { int i,j,k; for(k=1;k<=n;k++) { for(i=1;i<=n;i++) { for(j=1;j<=n;j++) { a[i][j]=a[i][j] || (a[i][k] && a[k][j]); } } } } int main() { int a[100][100]; int n,i,j,t=1; clock_t start, stop; printf("Enter the number of Nodes\n"); scanf("%...
C
// // Created by shrey on 11-11-2019. // #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include "GraphColorSolution.h" int FrequencyAllocation() { // declaration and null initialization of the graph structure and the adjacency matrix bool **graph = NULL; // struct Graph* GRP = NULL; prin...
C
#include <stdio.h> #include <stdlib.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char *argv[]) { int x[7][7],i,n; int s=0; for(i=0;i<=6;i++) for(n=0;n<=6;n++) { printf("\nNhap vao mang x[%d][%d]: ", i,n); scanf("%d", &x...
C
#include "fs.h" unsigned char fs_init(unsigned char* buf) { // ustawienie wskazanego bufora na operacje I/O fs_buf = buf; return fs_is_medium_ok(); } unsigned char fs_open(fs_file* file, unsigned char* name, unsigned char params) { // numer sektora unsigned long sector; // d...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_key_press.c :+: :+: :+: ...
C
void print_pascal_triangle(int limit) { int i=0; while(i < 10) { int j=0, num = 1; int max = (2*i)+1; while(j < max ) { printf("%d ", num); if(j < max/2 ) num += 1; else num -= 1; j += 1; } puts(""); if(i > limit) { break; } i += 1; } } int main()...
C
#include<stdio.h> #include<string.h> int main() { int a,i,n; char ch [200]; scanf("%d",&a); for (i=0;i<a;i++) { scanf("%s",ch); scanf("%d",&n); if(ch[0]=='T' && ch[1]=='h' && ch[2]=='o' && ch[3]=='r') printf ("Y\n"); else printf ("N\n...
C
#include <lib.h> #include <unistd.h> #include <stdlib.h> #include <sys/types.h> #include <stdio.h> #include <sys/wait.h> int main(int argc, char **argv) { char* name = "topic5"; pid_t temp = getpid(); message m1; m1.m1_i1 = 1; message m2; m2.m1_i1 = 2; message m3; m3.m1_i1 = 3; topicCr...
C
#include <stdio.h> int main(void){ int c=1; while(c != EOF){ c = getchar(); if ('A' <= c && c <= 'Z'){ c = (((c-'A')+13)%26)+'A'; } if ('a' <= c && c <= 'z'){ c = (((c-'a')+13)%26)+'a'; } putchar(c); } return 0; }
C
#include <stdio.h> int main(){ /* x+y x ve y degerlerini toplar x-y x degerinden y degerini kartr x*y x ve y degerlerini arpar x/y x degerini y degerine bler x%y x'in y ile blmnden kalan verir +x x degerini + ile arpar ve sonuc deimez -x x degerini - ile arpar ve x eksi bir deer ise art olur ,x art deger i...
C
#include <assert.h> #include <stdio.h> #include <stdlib.h> #if !defined(__GNUC_PREREQ__) # if defined(__GNUC__) # define __GNUC_PREREQ__(x, y) \ ((__GNUC__ == (x) && __GNUC_MINOR__ >= (y)) || \ (__GNUC__ > (x))) # else # define __GNUC_PREREQ__(x, y) 0 # endif #endif /* * __unused: Note that item or funct...
C
/* Program 8.8, modified to pass epsilon to function */ #include <stdio.h> float absoluteValue(float x) { if (x < 0) x = -x; return x; } // Function to calculate square root of a number float squareRoot(float x, float epsilon) { float guess = 1.0; while (absoluteValue(guess * guess - x) >=...
C
#include "holberton.h" /** * swap_int - Function that swap values of two integers. * @a: Integer as a value. * @b: Integer as a value2. * Return: Always 0. */ void swap_int(int *a, int *b) { int swapp; swapp = *a; *a = *b; *b = swapp; }
C
#include "holberton.h" /** * _strpbrk - the print of the table * @s: the punters contain the caractert * @accept: punters result the operation * * Return: accept. */ char *_strstr(char *haystack, char *needle) { unsigned int i, c; for (i = 0; haystack[i] != '\0'; i++) { for (c = 0; needle[c] != '\0'; c++)...
C
#include <stdio.h> int main (void){ printf("short int=%d\n",sizeof(short int)); printf("int=%d\n",sizeof(int)); printf("long int= %d\n",sizeof(long int)); printf("float=%d\n",sizeof(float)); printf("double=%d\n",sizeof(double)); printf("long double =%d\n",sizeof(long double)); return 0; }
C
#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <stdio.h> int main(int argc,char* argv[]) { int fd = 0; char buf_r[100]; size_t count_r=100; char buf_w[100]; size_t count_w=100; //main open fd = open("/dev/mychrdev",O_RDWR); if(fd < 0) ...
C
// // Created by Shiraz Butt on 03/06/2016. // #ifndef ARM11_39_GENERICLISTMAPITERATOR_H #define ARM11_39_GENERICLISTMAPITERATOR_H #include <util/GenericListMapNode.h> #define ListMap(K, V) ___ListMap__##K__##V #define ListMapIterator(K, V) ListMap(K, V)___Iterator #define ListMapIteratorInitWithListMap(K, V) List...
C
/* SHASHANK SAXENA 1601CS42 11/04/2017 Objective : To construct binary tree from inorder and postorder */ #include <stdio.h> #include <stdlib.h> typedef struct node { int data; struct node* left; struct node* right; }node; char* inorder; //global variables char* postorder; FILE* fo;//pointer to open output fil...
C
#include <pthread.h> #include <stdio.h> #include <stdlib.h> #define NUM_THREADS 8 typedef struct data { int thread_id, sum; char *msg; } data_t; data_t data_array[NUM_THREADS]; void *PrintHello(void *arg) { data_t *mine = (data_t *)arg; sleep(1); printf("Thread %d : %s Sum=%d\n", mine->thread_id, mine->ms...
C
/* * Program to generate "trap-door primes". * Generates primes for use with "index" program * * Hard to find factors of the product of two of them n=p.q * - but easy to find discrete logs wrt p & q * See "Non-Interactive Public-Key Cryptography", Maurer & Yacobi * Eurocrypt '91 * */ #include <std...
C
#include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <sys/stat.h> #include <sys/mman.h> #include "utils.h" unsigned long person_length, knows_length, interest_length; unsigned long person_new_length, knows_new_length, interest_new_length; Person *person_map; unsigned int *knows_map; unsigned short *int...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "hash.h" #define INITIAL_STATES_NUMBER 8192 #define INITIAL_TRANSITIONS_NUMBER 2048 #define FREE_NUMBERS_SIZE 64 #define MAXIMUM_WORD_SIZE 64 #define MAXIMUM_LINE_SIZE 128 // wc -L file - the length of the longest line in the file #define FIRST_CHAR...
C
#include<stdio.h> int main(){ float i=1,n,sum=0; printf("Enter an integer:\n"); scanf("%f",&n); while(i<=n){ sum=sum+(1/(i*i)); i++; } printf("%f",sum); return 0; }
C
#include "P11.h" void P11() { int a = makeChan(10,11);//left int t = 0; void* send; int next = 0; for(int i=0;i<10;i++){ next = *((int *) readChan(a)); printf("%d\n",next); } printf("Pipeline sort finished!\n"); while(1){} } void (*entry_P11)() = &P11;
C
#include <stdlib.h> #include "darray.h" #include "graphics.h" #include "maths.h" #include "mesh.h" #include "scene.h" #include "skeleton.h" #include "texture.h" scene_t *scene_create(vec3_t background, model_t *skybox, model_t **models, float ambient_intensity, float punctual_intensity, ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdint.h> typedef int64_t slot_t; #define SLOT_SIZE 8 /** * Runtime support for While on X86. Implemented in C for simplicity. */ int widthof(slot_t *type) { slot_t tag = *type; switch(tag) { case 0: // void break; case 1: cas...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "dynprtd.h" int parse_options(struct parsed_options *, int, char **); void init_parsed_options(struct parsed_options *); /* Command-line option parsing */ int cmd_parse_options(struct parsed_options *options, int argc, char *argv[]) { int c; whi...
C
#include <stdio.h> #include <stdlib.h> #define MAX 60 void sort(int n, int data[]); void prt(int n, int data[]); int main(void) { //freopen("ar12_test.in","r",stdin); //freopen("testout.out","w",stdout); int data[MAX]; int ncase; int i, n; scanf("%d",&ncase); while(ncase--) { i = 0; do{ scanf("%d",&dat...
C
#include <stdio.h> #include <conio.h> #include <stdlib.h> #include <time.h> typedef struct n{ int x; struct n*sag; struct n*sol; }node; void agaciYazdir(node *r){ if(r == NULL){ return; } agaciYazdir(r->sol); printf("%d ",r->x); agaciYazdir(r->sag); } int arama(node *agac,int...
C
#include "holberton.h" #include <stdio.h> /** * set_bit - sets de value of a bit to 1 at a given index. * @n: the number to be changed. * @index: the position of the bit to be changed strating from 0. * Return: 1 if it worked, -1 if an error ocurred. */ int set_bit(unsigned long int *n, unsigned int index) { uns...
C
/** * @file em.c * @authors SSGL * @version 0.1 * @details * * DESCRIPTION: ksjhfaifbsis * * Compile as: * gcc -0 em em.c -Wall -pedantic -lm * * Usage: * ./em * */ #include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #define M 600 #define K 2 //idk the real value ??? Sepideh, ...
C
#include<stdio.h> int main() { int a[10],n,i,j,flag=0,prime[10],t=0,k=0; printf("How Many Numbers You Want\n "); scanf("%d",&n); printf("\nEnter Numbers in Array:\n\n"); for(i=0;i<n;i++) scanf("%d",&a[i]); for(i=0;i<n;i++) { flag=0; for(j=2;j<a[i];j++) ...
C
/* Print the following text and nothing else: <html> <body> <p>HTML is kinda annoying</p> </body> </html> I'm happy I'm not a web developer. The catch? Your code must fit the template: print(<?>), where ? can be any group of characters. You can paste your completed code (with the print(<>) part) into this ...
C
#include<stdio.h> void main() { int a=10,b=19; int *p; p=&a; int *q; q=&b; printf("%d %d\n",a,b); printf("%d %d\n",*p,*q); printf("%d %d\n",&a,&b); printf("%d %d\n",p,q); }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <stdbool.h> #include "log.h" #ifndef LOG #define LOG false #endif log_type _log_type; char _log_filename[128]; char* time_string() { time_t rawtime; time(&rawtime); struct tm t = *gmtime(&rawtime); char* timestr = malloc(...
C
#include <stdio.h> #include "freertps/freertps.h" #include "std_msgs/uint32.h" #include "freertps/RTOSInterface.h" //If use PID is set to 1 the program use closed loop control, if not the program use open loop control #define usePID 0 //PID control task static void ctrlTask( void *parameters ); //Voltage publisher ta...
C
#include <stdio.h> #include <stdlib.h> #include "BSTree.h" BSTree BSTreeInsert(BSTree t, int val) { if (t == NULL) { // allocate a new node BSTree new = malloc(sizeof(*new)); if (new == NULL) { fprintf(stderr, "Insufficient memory!\n"); exit(EXIT_FAILU...
C
#include <stdio.h> int main (void) { int a; printf ("Dwse enan akeraio arithmo: "); scanf ("%d", &a); printf ("O akeraios arithmos einai: %d", a); return 0; }
C
#include "AreaIndicator/AreaIndicator.h" #include <stdio.h> #include "MyTypes.h" static Area* AreaIndicator_findIncludedArea(AreaIndicator* indicator, S32 distance); void AreaIndicator_create(AreaIndicator* indicator, SonarSensor* sonar) { indicator->currentAreaCount = 0; indicator->sonar = sonar; } void AreaIndi...
C
/* hapmapAlleleFreq.c was originally generated by the autoSql program, which also * generated hapmapAlleleFreq.h and hapmapAlleleFreq.sql. This module links the database and * the RAM representation of objects. */ /* Copyright (C) 2014 The Regents of the University of California * See README in this or parent di...
C
/** * Write a program to print all input lines that are longer than 80 characters. */ #include <stdio.h> void print_long_line(); #define LIM 80 int main(void) { print_long_line(); return 0; } void print_long_line() { int len, i, c; len = 0; char line[LIM]; while((c = getchar()) != EOF) ...
C
#include <stdio.h> #include <stdlib.h> void soma_vetor(float *vetor1, float *vetor2, float *vetor3, int quant) { for (int x = 0; x < quant; x++) { vetor3[x] = vetor1[x] + vetor2[x]; } } int main() { float *vetor1, *vetor2, *vetor_soma; int taman1, taman2; printf("Tamanho prim...
C
#include<stdio.h> void main() { int a,b,c,d; printf("enter the all numbers values"); scanf("%d%d%d",&a,&b,&c); d=a+b+c; printf("sum=%d",d); }
C
#include <stdio.h> #include <stdlib.h> #include "BinaryTree.h" void test() { int VLR[] = { 1,2,-1,-1,3,-1,4,5 }; int size = 8; int UsedSize = 0; pBTree root = CreateBTree(VLR, size, &UsedSize); preOrder(root); printf("\n"); midOrder(root); } int main() { test(); system("pause"); return 0; }
C
#include "image.h" #include<stdio.h> #include<stdlib.h> #include<string.h> int main(int argc, char *argv[]){ int verifica; if(strcmp(argv[1], "-open") == 0){ int verifica = extension(argv[2]); if(verifica == TXT){ verifica = openTxt(argv[2]); if(verifica == ERROR_OPENING_FILE)...
C
#include <stdio.h> #include <sys/types.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <sys/time.h> #include <errno.h> #include <time.h> #include <arpa/inet.h> #include <pthread.h> #include <signal.h> #define...
C
#ifndef __PARAMETRICEQ_H__ #define __PARAMETRICEQ_H__ #ifdef __cplusplus extern "C" { #endif typedef enum { PEAK=0, NOTCH=0, LOWSHELF=1, HIGHSHELF=2 } filterT; /* Parametric EQ filter * * float freq; frequency in Hz * float q; q * float gain; ...
C
/** * @file * @brief Assertion points implementation. * * @date 25.03.11 * @author Eldar Abusalimov */ #ifndef LIBC_ASSERT_IMPL_H_ #define LIBC_ASSERT_IMPL_H_ #include <util/location.h> #include <linux/compiler.h> #ifdef NDEBUG /* Do nothing. * * Implementation note: casting zero to typeof(condition) in the...
C
#include <curses.h> #include "defines.h" #include "keyboard.h" #include "screen.h" #include "snakey.h" #include "sound.h" #define SEL_START 0 #define SEL_HS 1 #define SEL_CREDS 2 #define SEL_QUIT 3 int current_selection; int menu_top; bool title_drawn; bool menu_drawn; void draw_title() { attron(COLOR_PAIR(2))...
C
#include <stdio.h> #include <stdlib.h> #include "ADTList.h" #include "allfunc.h" // Δεσμεύει μνήμη για έναν ακέραιο, αντιγράφει το value εκεί και επιστρέφει pointer int* create_int(int value) { int* pointer = malloc(sizeof(int)); // δέσμευση μνήμης *pointer = value; // αντιγραφή του value στον νέο ακέραιο re...
C
/* ------------------- counter.c --------------------- This program is the C version of the program to generate a running up-counter on the LEDs of PORTD. ---------------------------------------------------*/ #include <p18f452.h> #include "../PIC18F452Config.h" // Configuration bits setting for PIC #include "../SnA....
C
#include <sys/time.h> #include "global.h" #include "maze.h" const char version[] = "1.0"; const char copyright[] = "Copyright (C) 2004 Serge Vakulenko"; char *progname; int verbose; int trace; int debug; extern char *optarg; extern int optind; void usage () { fprintf (stderr, "Maze Generator, Version %s\n%s\n", ve...
C
/*********************************************************************** *Processo: Oficial Refeitorio Soldado General *Ficheiro:signal.c *Data: Dezembro 2005 ***********************************************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <signal.h> #inc...
C
#include "stats.h" #include <stdio.h> #include <stdlib.h> // takes in array and its length // returns max int find_maximum(int arr[],int n) { int i; // Initialize maximum number int max = arr[0]; // Traverse array from the second number and // compare every number with biggest seen so ...
C
/** vertexShader - an OpenGL shader that implements Phong shading. */ #version 150 // vertex properties in vec3 vPosition; in vec3 vNormal; in vec3 ambientColor; in vec3 diffuseColor; in vec3 specularColor; in float shininess; // light properties uniform vec3 lightPosition; uniform vec3 lightColor; uniform vec3 l...
C
// // binaryGrayCode.c // // // Created by Brad Lackey on 2/4/17. // // #include <stdio.h> #include <stdlib.h> #include "binaryGrayCode.h" const int n = 4; int *array; int main(){ int i; array = (int *) calloc((1<<n), sizeof(int)); array[0] = 0; code(1,n); for (i=0; i<(1<<n); ++i) { printf("%d %3d...
C
#include<stdio.h> # pragma pack (1) struct school { double a; int b; char h; // int c; // char d; }; int main() { struct school students; printf("size of struct %d \n",sizeof(students)); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <conio.h> #include "lib.h" void inicializarClientes (eCliente clientes[], int tam) { int i; for (i=0;i<tam;i++) { clientes[i].estado=0; } } void inicializarTipos(eTipoEquipo tipo[], int tam) ...
C
// // alloc.c // PhylogeneticTreeBuilder // // Created by Maxim Aliev on 06/05/2018. // Copyright © 2018 maxial. All rights reserved. // #include <stdlib.h> #include "alloc.h" phylogenetic_tree * alloc_tree(const int n) { phylogenetic_tree * tree = (phylogenetic_tree *)calloc(1, sizeof(phylogenetic_tree)); ...
C
/* qflta.c * Utilities for extended precision arithmetic, called by qflt.c. * These should all be written in machine language for speed. * * addm( x, y ) add significand of x to that of y * shdn1( x ) shift significand of x down 1 bit * shdn8( x ) shift significand of x down 8 bits * shdn16( x ) shift signi...
C
/* * UART.h * * Created on: Apr 5, 2016 * Author: lbs1 */ #ifndef UART_H_ #define UART_H_ /************/ /* UART */ /************/ // UARTx (UART0, UART1, UART2 or UART3) // - Use Init_UART to setup UARTx, baud rate, enable clock gate, enable Receive Full interrupt, enable Tx and Rx...
C
#include<stdlib.h> #include<stdio.h> struct _retire_info { int months ; //months this is applicable for double contribution; // dollars contributed or spent in month double rate_of_return; //rate of interest }; typedef struct _retire_info retire_info; void print_month_info(int months, double balance) { //prin...
C
/* ** EPITECH PROJECT, 2019 ** SYN_jetpack2Tek3_2018 ** File description: ** animator */ #include "animator.h" static const animator_t default_conf = { &update_frame, 0 }; animator_t *initialize_animator(sfTexture *text, float frame_offset, float framerate) { animator_t *this = malloc(sizeof(...
C
#define _GNU_SOURCE #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <getopt.h> #include <time.h> #include <pthread.h> #include <string.h> volatile int* spin_lock = 0; pthread_mutex_t lock; int opt_yield = 0; long long* pointer; struct arg_s { int num_iter; char lock_type; }; void add(long lon...
C
/*ΪǸ߾ȼӷ Աõ ÿһλ ׼5 2֣ ijȣΪҪнλǷĴ ǰ *****עҪӵijȲһ**** rΪc = a + bʱȽA[0]B[0]ӣнλѽλ͵ʮλrѺ͵ĸλC[0]C[0](A[0]+B[0])%10ȻA[1]B[1]ӣʱӦλֵrҲC[1]ӦA[1]B[1]rĺͣнλԿɽµĽλ뵽rУ͵ĸλ浽C[1]СƣCλ ӵֵһ */ #include "stdio.h" #include "string.h" int main() { char m[100], n[100]; int i, len_m, len_n, len_max, r; int a[100] = { 0 }, b[100] = { 0 }, ...
C
#include <stdio.h> main () { int x,y,z; printf ("------Descubra se as medidas formam um triangulo--------\n\n"); printf("Digite o primeiro valor: "); scanf ("%d",&x); printf ("Digite o segundo valor: "); scanf ("%d",&y); printf ("Digite o terceiro valor: "); scanf ("%d",&z); if (x<y+z && y<z+x && z<...
C
#include<stdio.h> int main() { int i,factorial=1,n; printf("Enter a number"); scanf("%d",&n); for(i=1;i<=n;i++) { factorial=factorial*i; } printf("factorial of %d = %d",n,factorial); return 0; }
C
#include "pustaka.h" void CreatEmpty(List *L){ Firt(*L)=Nil; } boolean IsEmpty(List L){ return (First(L)==Nil); } address Alokasi(infotype X){ address P; P = malloc(sizeof(ElmtList)); if(P!=Nil){ Info(P)=X; Next(P)=Nil; } return (P); } void insertFIrst(List ...
C
#include <semaphore.h> typedef struct synchq { char** data; int head; int size; int done; sem_t open; sem_t filled; sem_t mutex; } sq; /* * sq_init * * initializes the given queue * * in: q - sq* - a sq pointer to the queue to be initialized */ extern void sq_init(sq* q); /* * sq_enq * * performs the e...
C
#include<stdio.h> #include<string.h> #include<stdlib.h> #include<ctype.h> #define TAILLE 130 #define ROUGE(c) printf("\033[31m%c\033[0m", c) void main() { char ligne[TAILLE]; printf("%s", "saisir une chaine: "); fgets(ligne, TAILLE, stdin); // parcours de la chaine pour détecter les chiffres int cpt; int lo...
C
//reverse a string #include<stdio.h> void main() { char name[30],rev[40]; int lenth,j,i; printf("Enter the stuff:\n"); scanf("%s",name); lenth=strlen(name); j=lenth-1; for(i=0;i<lenth;++i) { rev[i]=name[j]; j-- ; } printf("%s",rev); }
C
#include <stdio.h> #include <stdlib.h> // per la funzione exit() #define MAX 50 #define MAT "mat.txt" #define VISITED (-1) // legge la matrice e salva by reference le sue dimensioni void leggiMatrice(int M[MAX][MAX], int n, int *rows, int *cols); // data una casella [r][c], scansione la matrice sottos...
C
/* Fichero: basehabi.c Autor: aul Fecha: 31/03/2013 Descripcin: base de las habitaciones de la posada. */ #include "./path.h" inherit BREE_ROOM; create() { ::create(); SetIntShort("una habitacin"); switch(d6()){ case 1: SetIntLong("Ests en el interior de una habitacin amuebl...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* project.c :+: :+: :+: ...
C
// Graph_Dijkstra // // : // // , // . // . . // // source.c , . // // : // : -13 // #define _CRT_SECURE_NO_WARNINGS #include <locale.h> #include <malloc.h> #include <stdio.h> #include <stdlib.h> #include "mygraphlib.h" void main() { int ** adjMatrix; // . int verticesAmou...
C
#include <stdio.h> #include <assert.h> void testFunctions (void); long gcd (long x, int y); long lcm (long x, int y); int main (int argc, char *argv[]) { testFunctions(); int i = 2; long result = 1; while (i <= 20) { result = lcm (result, i++); } printf ("Smallest common multiple = %li\n", result); return 0;...
C
/* Name: phoneFunc.c ver 1.7 * Content: 전화번호 컨트롤 함수 * Implementation: PHS * * Last modified 2018/11/21 */ #include "common.h" #include "phoneData.h" #include "screenOut.h" #define LIST_NUM 100 int numOfData=0; //phoneData phoneList[LIST_NUM]; phoneData * phoneList[LIST_NUM]; void StoreDataToFileInStruct(v...
C
// // LCBXXZDChapterEightAlgorithmDesignElevenTwelve.c // DataStructurePractice // // Created by ly on 2018/7/13. // Copyright © 2018年 LY. All rights reserved. // #include "LCBXXZDChapterEightAlgorithmDesignElevenTwelve.h" int DijkstraInALGrpahPrivate(ALGraph *graph,int startVertex,int endVertex) ; void displayDi...
C
int nGetSize(char *pszFileName, unsigned int *pnDimX, unsigned int *pnDimY, unsigned short *BytePorPixel, unsigned int *CabeceraSize) { FILE *fp; char type[2]; unsigned int nVals[4]; unsigned short TMP; fp = fopen(pszFileName, "rb");...
C
#include <stdio.h> #include <stdlib.h> #define MAX 10000000000 int main (void) { int n, k, i, j; long sum_g_L = 0; // int sum_g_R = 0; long max_g = 0; long s = 0; long min_x = MAX; // int max_x = 0; int count = 0; //get numbers of buildings and waling distance scanf("%d %d", &n, &k); int *x = (int*)malloc...
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
// 19BDS0042 SAMARTH GUPTA #include<semaphore.h> #include<stdio.h> #include<stdlib.h> #include<unistd.h> #include<pthread.h> sem_t x,y; pthread_t tid; pthread_t writerthreads[100],readerthreads[100]; int readercount = 0; void *reader(void* param) { sem_wait(&x); readercount++; if(readercount==1) sem_wait(&y); sem_po...
C
#include <stdio.h> #include "fahrtocels.h" #define LOWER 0 #define UPPER 300 #define STEP 20 //Prints a fahrenheit to celsis conversion table, from top to bottom void fahr_to_cels_rev() { for(int fahr = UPPER; fahr >= LOWER; fahr = fahr - STEP) printf("%3d %6.1f\n", fahr, (5.0/9.0)*(fahr-32)); } //Print...
C
#include <stdio.h> #include <sys/time.h> //timeval,itimer等 #include <signal.h> #include <unistd.h> /************************************** * FUNCTION:mygettimeofday(struct timeval *tv) * DESCRIPTION:利用进程实时定时器ITIMER_REAL,每秒产生一个信号,并且计算已经经过的秒数 * *************************************/ static int passed_sec = 0; static...
C
#include <stdio.h> #include <math.h> #include <stdbool.h> #define MAX 440000000 int cache[10]; bool is_munchausen(const int number) { int n = number; int total = 0; while (n > 0) { int digit = n % 10; total += cache[digit]; if (total > number) { return false; ...
C
#include <stdio.h> int main (void) { while(1) {printf("Hey\tYou!\n");} return 0; }
C
#include <stdio.h> #include <stdlib.h> #include "com112_ArvoreAVL.h" void menu(int op, int data, int valor) { do { ArvAVL *avl; printf("\nEscolha uma das operacoes:\n"); printf("1.Criar arvore\n2.Liberar arvore\n3.Inserir elemento\n4.Remover elemento\n5.Consultar elemento\n6.Imprimir percurso pre-ord...
C
// Copyright © 2018, Bryan Greener (https://github.com/bryangreener). #include "qsolve.h" // Mathod that calculates the roots of the quadratic equation. // Takes in three doubles a, b, and c for the equation. // Returns a tuple of two roots calculated. Tuple qsolve(double a, double b, double c){ // LOGGING START wr...
C
#include <stdio.h> int main() { char a[5] = {'F', 'i', 's', 'h', 'C'}; printf("字符串为%s\n", a); printf("Hello World!"); return 0; }
C
int printf(const char*,...); int scanf(const char*,...); void main() { int a,n,d,sum; printf("Starting element: "); scanf("%d",&a); printf("Number of elements: "); scanf("%d",&n); printf("Common difference: "); scanf("%d",&d); sum = a; for(int i=0;i<n;i++){ printf("%d ",sum); sum += d; if(i!=n-1) pri...
C
#include <stdio.h> struct st_table { unsigned int entries_packed : 1; unsigned int num_entries : 31; }; /* * 08/04/09: The ++ operator didn't work for bitfields */ int main() { struct st_table s; s.entries_packed = 0; s.num_entries = 127; printf("%d\n", !s.num_entries); printf("%d\n", !!s.num_entr...
C
#include "float_exp.h" // given the 32 bits of a float return the exponent uint32_t float_exp(uint32_t f) { // e.g. 1 0000 0000 1111 1111 1111 1111 1111 111 uint32_t exp = (f >> 23) & 0b011111111; return exp; }
C
//2.1 Write code to remove duplicates from an unsorted linked list. //FOLLOW UP //How would you solve this problem if a temporary buffer is not allowed? #include <stdio.h> #include <stdlib.h> typedef struct node { int data; struct node * next; }node; node * createFirstNode(int newdata) { node * LL; L...
C
/** \file moncmd.c: * \brief The guts of the moncmd UDP client. * \author Ed Sutter esutter@lucent.com * * This tool is used to support simple UDP communication between a host and * a target running MicroMonitor. The target is listening on port * IPPORT_MONCMD (777) for incoming command strings just as they wou...