language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
// MUSTAFA ABDULLAH HAKKOZ - 150117509 #include <stdio.h> #include <string.h> #include <stdlib.h> #define SIZE 6 char forbiddenItems[SIZE][50]; unsigned int customers[500][2]; double transactions[500][730]; int searchCustomer(int customerNumber); void getContent(char content[], double *money); int checkFinish(c...
C
#include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <unistd.h> #include <netdb.h> #include <stdio.h> #include <string.h> #include <arpa/inet.h> #define MAXLINE 1024 int main(int argc, char **argv) { int sockfd; int n; int i,j,l; char temp; socklen_t len; char msg[1024], str[1024]; char* m;...
C
#include "holberton.h" /** * reverse_array - reverses the content of an array of integers * @a: pointer to array to be reversed * @n: number of elements of the array * * Return: void */ void reverse_array(int *a, int n) { int i = 0; --n; while (i < n) { a[i] ^= a[n]; a[n] ^= a[i]; a[i] ^= a[n]; i++...
C
// This program implements a vector addition using OpenCL // System includes #include <stdio.h> #include <stdlib.h> #include <string.h> // OpenCL includes #include <CL/cl.h> #include "vecadd_cl.h" #define GLOBAL_SIZE 1024 * 64 #define LOCAL_SIZE 64 inline void checkErr(cl_int err, const char * name) { if (err !=...
C
#include<stdio.h> int main() { char input_string[50]; int len, i; printf("\nEnter a string"); scanf_s("%[^\n]s", input_string); for (len = 0; input_string[len]; len++); for (i = 0; i < len; i++) { if ((input_string[i] <= 65) && (input_string[i] >= 90)) input_string[i] = input_string[i] + 32; if ((input_st...
C
/* Written by Kris Maglione <maglione.k at Gmail> */ /* Public domain */ #include "util.h" uint strlcat(char *dst, const char *src, uint size) { const char *s; char *d; int n, len; d = dst; s = src; n = size; while(n-- > 0 && *d != '\0') d++; len = n; while(*s != '\0') { if(n-- > 0) *d++ = *s; s++;...
C
#include <stdlib.h> #include <stdio.h> #include "cycleQueue.h" // // ʼж // bool InitQueue(CycQueue * q){ ElemType * tempP; tempP = (ElemType *) malloc(sizeof(ElemType) * INIT_SIZE); if(NULL != tempP){ q->data = tempP; } else { return false; } // ʼͷ β q->front = 0; q->rear = 0; // ʼΪ q->maxSize = INIT...
C
#pragma once #include "board.h" #include "move_type.h" #define START_ROW(m) (m >> 12U) #define START_COLUMN(m) ((m >> 8U) & 0b0000000000001111U) #define TARGET_ROW(m) ((m >> 4U) & 0b0000000000001111U) #define TARGET_COLUMN(m) ((m) & 0b0000000000001111U) #define APPLY_MOVE_WHITE(board, move) board[START_ROW(move)] ^...
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include<string.h> #include<stdlib.h> #define SWAP(x,y,t)((t)=(x),(x)=(y),(y)=(t)) #define MAX_SIZE 1000 #define MAX_MAJOR 100 #define MAX_NAME 100 #define MAX 10 typedef struct element { int key; char major[MAX_MAJOR]; char name[MAX_NAME]; int gr...
C
/*Author: Fernando Linhares 2018 - UENF*/ #include <stdio.h> #include <stdlib.h> /*Declarando variáveis*/ int dmissionarios = 3; //Emissários no lado direito do rio int emissionarios = 0; //Emissários no lado esquerdo do rio int dcanibais = 3; //Canibais no lado direito do rio int ecanibais = 0; //Canibais no...
C
#define UNITY_LONG_WIDTH 64 #include "unity.h" #include "timestamp-buffer.h" static timestamp_buf_t buffer; static const uint32_t buffer_size = 8; static const uint8_t FALSE = 0; static const uint8_t TRUE = 1; void setUp(void) { tstp_create_buffer(&buffer, buffer_size); } void tearDown(void) { } /** * @ingrou...
C
#include <stdio.h> #include <stdlib.h> int main(){ int idade1, idade2, idade3, res; printf("\n\t Enter three ages: "); scanf("%d %d %d", &idade1, &idade2, &idade3); //dentro esse scanf pego tres entradas, para que seja feita a soma logo abaixo res = idade1 + idade2 + idade3; //den...
C
#include <stdio.h> #include <pthread.h> #include <semaphore.h> volatile int j=0; sem_t sem; void *th_func1 (void * arg){ int i; for (i = 0; i < 10000 ; i++){ //El primero que llega aquí, si entra a la región crítica. Tras su paso, bloquea el semáforo //y lo desbloquea con el post sem_wait(&sem); j=j+1; se...
C
/* Author Joshua Immanuel Meza Magaña Version 1.0.0 Date 27/03/2020 Program who read and print an array with pointers */ #include <stdio.h> #include <stdlib.h> #include <time.h> #define N 3 void readArr(int (*)[N]); void printArr(int (*)[N]); int main(){ int x[N][N]; readArr(x); printArr...
C
#include "cache.h" #include "sha1-lookup.h" #include "refs.h" #include "commit.h" /* * An array of replacements. The array is kept sorted by the original * sha1. */ static struct replace_object { unsigned char original[20]; unsigned char replacement[20]; } **replace_object; static int replace_object_alloc, repl...
C
main() { int n; int k,p; scanf("%d\n",&n); char a[500]; gets(a); char b[501][5]={'\0'}; int i=1,j; if(n==2) { for(j=0;j<strlen(a)-1;j++) { b[j][0]=a[j]; b[j][1]=a[j+1]; } int c[500]; for(j=0;j<strlen(a);j++) { c[j]=1; } for(k=0;k<strlen(a)-1;k++) { for(p=k...
C
#ifndef _STAT_H #define _STAT_H #include "types.h" struct stat { dev_t st_dev; /* Device number */ ino_t st_ino; /* Inode number */ mode_t st_mode; /* Mode RWX for user, group and others */ short st_nlink; /* # of links */ uid_t st_uid; /* User ID */ gid_t st_gid; /* Group ID */ dev_t...
C
#include <stdio.h> #include <stdlib.h> #include "psig.h" int main(int argc, char *argv[]) { char *message = argv[1]; PRIVATE_KEY prikey; PUBLIC_KEY pubkey; SIGNATURE sig; if (argc < 2) return 1; private_key_init(prikey); public_key_init(pubkey); sig_init(sig); keygen(prikey, pubkey); printf("----------...
C
#include<stdio.h> #include<stdlib.h> //includes rand(), srand() #include<time.h> //includes time() int main() { int number; srand(time(0)); //to initialise the random number funciton number = rand()%100 + 1; // a random number between 1 and 100 printf("%d\n", number); return 0; }
C
#define _CRT_SECURE_NO_WARNINGS 1 //ģʵstrcmp #include<stdio.h> #include<assert.h> int my_strcmp(const char *str1, const char *str2) { assert(str1!= NULL); assert(str2!= NULL); while (*str1 == *str2) { if (*str1 == '\0') { return 0; } str1++; str2++; } return *str1 - *str2; } int main() { int ret = m...
C
#include<stdio.h> #include<conio.h> #include<string.h> void palin(char *a,int l,int i); void main() { char a[15],b[15]; int i=0,j=0; puts("Enter a string"); fflush(stdin); gets(a); while(a[i++]!='\0') { b[i-1]=tolower(a[i-1]); } b[i-1]='\0'; strcpy(a,b); palin(b,i-1,j...
C
#include <stdio.h> #include <math.h> void main() { int i,a,b,c,t,k=1; printf("===ˮɻ===\n"); printf("λˮɻΪ\n"); for(i=100;i<1000;i++) { a=i/100; b=i/10-10*a; //һϸģ c=i%10; t=pow(a,3)+pow(b,3)+pow(c,3); if(i==t) { printf("%5d",i); k++; } } if(k/5==0) printf("\n"); p...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* checker_main.c :+: :+: :+: ...
C
#include"stdio.h" #include"windows.h" char* reverse_string(char *str) { if (strlen(str) < 2) { return str; } char tmp = *str; int len = strlen(str) - 1; *str = *(str + len); *(str + len) = tmp; *(str + len) = '\0'; reverse_string(str + 1); *(str + len) = tmp; return str; } int main() { char Tmp[] = "hell...
C
#include <stdio.h> void clear(); void gotoxy(int x, int y); int main() { char input; int x = 5; int y = 5; clear(); //gotoxy(5,10); while ( 1 ) { int result = scanf("%c", &input); if ( input == 'j' ) { x--; } else if ( input == 'l' ) { x++; } else if ( input == 'i') { y--; } else if ( input...
C
/* Gives us high-resolution timers. */ #define _POSIX_C_SOURCE 199309L #include <time.h> #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> // **************************************** Timer based methods BEGIN **************************************** /** * @b...
C
#include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <math.h> #include "timer.h" int nprimos = 0; pthread_mutex_t mutexCounter, mutexPrimos; //variavel de lock para exclusao mutua long long int max, counter = 1; int ehPrimo(long long int n) { int i; if (n<=1) return 0; if (n==2) return 1; if (...
C
#include "auxFuncs.h" struct Dock * HandleSecondLine(char *line,int nD) { struct Dock * tmpDocks= (struct Dock *)malloc(nD * sizeof(struct Dock)); int i; char *token=strtok(line," "); for(i=0;i<nD;i++) { if(token!=NULL){ tmpDocks[i].id = i; sscanf(token, "%d", &(tmpDocks[i].ship_capacity)); tm...
C
bool passerexamen(int frais,int nbrs,int numd,int nume){ FILE *f; f=fopen("candidat.txt","r"); candidat k; bool passer=false; while(fread(&k,sizeof(candidat),1,f)){ if(k.nbrseance>=nbrs && k.exam[numd].frais==frais && k.num==nume){ passer=true; } } fclose(f); return passer; } void modifierexamen(int num...
C
/* vm_client.c : test program for forked vm block */ #include "csapp.h" static unsigned int port = 0; static unsigned int block_id= 0; static char host[] = "localhost"; static char block_header[] = "block_id"; int main (int argc , char *argv[]) { int clientfd; rio_t rio; char buf[MAXLINE]; int nobytes; if(a...
C
/* ** EPITECH PROJECT, 2019 ** my_put_nbr.c ** File description: ** Put nbr */ #include <stdarg.h> #include "../../include/printlib.h" int my_putchar(char c); int print_int(va_list list) { return my_put_nbr(va_arg(list, int)); } int print_unint(va_list list) { int nbr = va_arg(list, int); unsigned int u...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* navigate.c :+: :+: :+: ...
C
#include "x_string_list.h" StringList StringList_init() { StringList list; list.length = 0; return list; } void StringList_append(StringList* list, String value) { String* backup_storage = list->storage; list->storage = (String*) malloc(++list->length * sizeof(String)); if (!list->stora...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* node.c :+: :+: :+: ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_init_ps.c :+: :+: :+: ...
C
#include <stdio.h> void func1(int *x) { /* pointer as parameter */ } void func1(int x[10]) { /* sized array as parameter */ } void func1(int x[]) { /* unsized array as parameter */ } //the length of the array doesn't matter as //far as the function is concerned because C/C++ performs no bounds checking. // th...
C
/* ----------------------------------------------------------------------- * Test isGameOver() function * * ----------------------------------------------------------------------- */ #include "dominion.h" #include "dominion_helpers.h" #include <string.h> #include <stdio.h> #include <assert.h> #include "rngs.h" //...
C
/* JTSK-320111 Problem a3.p1.c Jonathan Rittmayer jo.rittmayer@jacobs-university.de */ /* The program below prints i is 8 i is 8 ... until you stop the execution by pressing Ctrl-C. Fix the program such that it prints 8, 7, 6, 5 and 4 as values for i. */ #include <stdio.h> int main(){ int i = 8; while (i >=...
C
#include <stdlib.h> #include "header.h" int *bits(int bit, int l) { int *bin = (int*)malloc(sizeof(int) * l); int base = 1; for (int i = 0; i < l; i++) { bin[i] = (bit & base) / base; base *= 2; } return bin; } int **pianoDecompress(struct s_bit *bit, int l) { int **ret = (int**)malloc(sizeof(int*) * l); ...
C
#include<stdio.h> #include<pthread.h> void *Primenumber (void *args) { int n,d=0; printf("All the prime number from 2 to 1000000: \n"); for (n=2;n<=1000000;n++) { d=0; for (int i=1;i<=n;i++) { if (n% i==0) d++; if (d>2) break; } if (d==2) printf("%d\n",n);} } void *fibo(void *args) { int a=1,...
C
/********************** * NAME: star.c * * PAGE NUM: 20 * * AUTHOR: SWAROOP * ***********************/ #include <stdio.h> int main(void) { int i, j; for (j=7;j!=0;j--) { for (i=0;i!=8;i++ ) { if (i == j) { printf("*\n"); ...
C
/********************************************************************* * Red Black Tree functions (threaded) * * rbt_new.c * ********************************************************************** * functions: * * RBT * rbt_new ( RBTDEF * def ) * void rbt_init( RBT * r, RBTDEF * def ) * void rbt_free( RBT * r...
C
#include "Hash.h" node* insert_node(List* parent, const char* buff, size_t size, size_t offset, uint64_t hash) { if (parent == NULL || buff == NULL) return NULL; errno = 0; node* new_node = (node*) calloc(1, sizeof(node)); if (new_node == NULL) { perror("[insert_node] Alloc error i...
C
#include<stdio.h> int MAX=100; int queue[100],front=-1,rear=-1; void enqueue(int data) { if(rear==MAX-1) { printf("full"); } else { if(front==-1) front=0; rear++; queue[rear]=data;printf("done\n"); } } int dequeue() { int t=0; ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* registers.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "tabela_de_simbolos.h" #include "token.h" int inserir_simbolo(struct tabela_de_simbolos *p_tabela, struct simbolo *p_simbolo) { if(p_tabela->inicio == NULL) { p_tabela->inicio = p_simbolo; } p_simbolo->prox = NULL; p_s...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* usages.c :+: :+: :+: ...
C
#include<stdio.h> int main(){ int a,b,c=0; scanf("%d",&a); if(a==1){ printf(""); } for(b=2;b<a;b++){ c=a%b; if(c==0){ printf(""); break; } } if(c!=0){ printf(""); } return 0; }
C
#include <stdio.h> #include <fcntl.h> /* File Control Definitions */ #include <termios.h> /* POSIX Terminal Control Definitions */ #include <unistd.h> /* UNIX Standard Definitions */ #include <errno.h> /* ERROR Number Definitions */ #include "serial.h" int main(int argc, char **argv) ...
C
#ifndef _XOPEN_SOURCE #define _XOPEN_SOURCE 700 #endif #include <errno.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <sys/shm.h> #include <sys/stat.h> #include <unistd.h> #include <assert.h> #include <stdio.h> static const char path[] = "."; static const int id = 'h'; #define T(f) assert((f)+1...
C
#include <stdio.h> #include <math.h> typedef struct { char name; int x; int y; } Point; float distance(Point p1, Point p2){ float delta; delta = sqrt(pow(p1.x-p2.x, 2) + pow(p1.y-p2.y, 2)); return delta; } int checkValid(Point p, Point p2, Point p3){ if ((distance(p, p2) =...
C
#include <stdlib.h> #include <stdio.h> int main() { char** words = malloc(10 * sizeof(char*)); //create an arrary of words, an array of char* s for (int i = 0; i < 10; i++) { //allocate memory at each location in w words[i] = (char*)malloc(15*sizeof(char)); } for (int i = 0; i < 10; i++) { //free every word...
C
#include "func.h" #include "tree.h" tree ordins(element el, tree t) { if (t ==NULL) return (cons_tree(el, NULL, NULL)); else { if (el <= t->value) t->left = ordins(el, t->left); else t->right = ordins(el, t->right); return t; } } void preorder(tree...
C
#include <stdbool.h> #include <string.h> #include <assert.h> #include "monitor.h" static void Monitor_Print(GRID *, GRID, GRID); static void Monitor_PrintLine(GRID *, GRID, GRID, int); static Food *Monitor_CreateValidFood(Snake *, GRID, GRID); static bool Monitor_IsFoodValid(Snake *, Food *); static bool Monitor_IsFoo...
C
#include <stdio.h> #include <stdlib.h> int get(unsigned x){ int n = 31; if(x == 0) return -1; if((x>>16) == 0) { n = n - 16; x = x << 16;} if((x>>24) == 0) { n = n - 8; x = x << 8;} if((x>>28) == 0) { n = n - 4; x = x << 4;} if((x>>30) == 0) { n = n - 2; x = x << 2;} if((x>>31) == 0) ...
C
#include<stdio.h> #include<stdlib.h> unsigned calculate_power(unsigned, unsigned); int main() { unsigned a,b; printf("enter the numbers a and b \n"); scanf("%d %d", &a,&b); printf("%d raise to %d is %d\n", a, b,calculate_power(a,b)); return 0; } //a^b = (a^b/2)*(a^b/2) --> recursion //also we can use dynamic pr...
C
/* ** EPITECH PROJECT, 2019 ** PSU_my_ls_2018 ** File description: ** my_strcmp */ #include "my.h" int my_strcmp(char *str, char *ptr) { int i = 0; int k = 0; for (i = 0; str[i] != '\0' && (str[i] == ptr[i]); i++); k = str[i] - ptr[i]; return (k); }
C
// ********** Derek Leung // ********** Built-in primitive operators /* * Functions here are called directly by evaluate() as primitive operators, so * they should all have the signature (struct obj*) (*function) (struct obj*). */ #ifndef BUILTINS_H_INCLUDED #define BUILTINS_H_INCLUDED #include "data.h" #include ...
C
#include <stdio.h> #include <sys/socket.h> #include <stdlib.h> #include <netinet/in.h> #include <string.h> #include <arpa/inet.h> #include <unistd.h> #include<string.h> #include<netinet/in.h> #include <netdb.h> //connect to server and send /* int connect_server(const char *host, const char *port){ // Create a s...
C
#include <stdio.h> double AdicioneNaMedia(double valor){ static double numeros; static int qtd; numeros += valor; qtd++; return numeros / qtd; } int main(void){ double valor, media; int qtd, j; printf ("Quantos valores serao lidos a seguir?\n"); scanf ("%d",...
C
// Using pointers (i.e., variables that contain addresses) directly in // a program. #include <stdio.h> int main() { int x; int *y; x = 5; printf("x = %d\n",x); printf("&x = %p\n",&x); printf("\n"); y = &x; printf("*y = %d\n",*y); printf("y = %p\n",y); printf("&y = %p\n",&y);...
C
/********************************************************************** p1elo931.c by Barry, Amadou (change the previous line for your abc123 ID and your name) Purpose: This program reads user data and displays that information in a human readable format. Command Line Arguments: p1 -u usersFileName Input: Stream...
C
#include <stdio.h> #include "tool.h" int fuc(int base) { int result = 1; int i; for (i = base; i > 0; i--) { result *= i; } return result; } int mod(int base) { int result = base; if (base < 0) { result *= -1; } return result; }
C
#include<stdio.h> int main() { int a,b,d,f,sum; printf("enter a 4 digit num: "); scanf("%d",&a,&b,&d,&f); a=(a%1000)/10; b=(b%1000)/10; d=(d%1000)/10; f=(f%1000)/10; sum=a+b+d+f; printf("the sum is %d"); }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #define DIMENSION 512 #define PI 3.141592654 int rgb[DIMENSION][DIMENSION][3]; int ycbcr[DIMENSION][DIMENSION][3]; int dct[DIMENSION][DIMENSION][3]; int dctQuant[DIMENSION][DIMENSION][3]; int zigZagArray[64]; short K1[8][8] ...
C
/***************************************************************/ /** **/ /** Marcos Kazuya Yamazaki 7577622 **/ /** Exercício-Programa 01 **/ /** ...
C
#include <stdio.h> #include <stdlib.h> #include <conio.h> #include "menu.h" #include "Usuarios.h" #include "Equipos.h" #include "Configuracion.h" int main(){ ListaE l_equipos=NULL; // Indice para el listado de equipos ListaU l_usuarios=NULL; // Indice para el listado de usuarios ListaC l_config=NULL; // In...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> #include <ctype.h> #include <getopt.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> int builtin_chdir(char* nam, char** argv, char** stdout) { assert(nam); assert(argv[0]); int ret = 0; if (argv[1] == N...
C
/* Sam Rack * Compilers - Parser * decl.c */ #include "decl.h" struct decl * decl_create( char *name, struct type *t, struct expr *v, struct stmt *c, struct decl *next ) { struct decl *d = malloc(sizeof(*d)); d->name = name; d->type = t; d->value = v; d->code = c; d->next = next; return d; } void decl_prin...
C
#include <stdio.h> int fib2(int a) { register int f0 = a; register int f1; register int f2; if(f0 < 2) { goto fin; } f1 = f0; f1--; f0 = fib2(f1); f2 = f0; f1--; f0 = fib2(f1); f2 += f0; f0 = f2; fin: return f0; } int main() { int a; scanf("%d",&a); printf("%d\n",fib2(a)); }
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include "tipoFila.h" #include "tipoPilha.h" struct tipoFila{ tipoNoF *prim; tipoNoF *ult; }; struct tipoNoF{ int vertice; struct tipoNoF *prox; }; int isEmpty(tipoFila *f){ if(f->prim){ return 1; }else{ return 0; } } void c...
C
/// ----------------------**************** TUTORIAL QUESTION ****************---------------------- #include <stdio.h> #include <stdlib.h> #include <stdbool.h> bool didReach(int *, int *, int, int, int, int, int, int); int main(){ int n,m; scanf("%d %d",&n,&m); int arr[n][m]; memset(arr,0,(sizeof(arr[0][0])...
C
#include "PriorityQueue.h" int main( void ){ PriorityQueue* PQ = PQ_Create( 3 ); PQNode Popped; PQNode Nodes[7] = { {34, (void*)"Coding"}, {12, (void*)"Client Meeting"}, {87, (void*)"Prepare Coffee"}, {45, (void*)"Documentation"}, {35, (void*)"Debugging"}, {66, (void*)"Clean Tooth"} }; PQ_Enqueue(...
C
#include <stdio.h> #include <stdlib.h> #include <limits.h> int checkInput() { int n; char term; do { fflush(stdin); char check = scanf("%d%c", &n, &term); if( check != 2 || term != '\n') printf("Enter again...Only accept number!!!\n"); else ...
C
#include <stdio.h> #include <stdlib.h> #include <mpi.h> #include <math.h> #define TIME(a,b) (1.0*((b).tv_sec-(a).tv_sec)+0.000001*((b).tv_usec-(a).tv_usec)) #define IDX(i,j,k) ((i)*ny*nz+(j)*nz+(k)) extern int Init(double *data, long long L); extern int Check(double *data, long long L); //Can be modified typedef stru...
C
#include "liblucy.h" #if TARGET_OS_IPHONE LMConnection * l_ipc_create_port(const char *name) { LMConnection *connection = malloc(sizeof(LMConnection)); strcpy(connection->serverName, name); return connection; } void l_ipc_free_port(LMConnection *connection) { free(connection); } typedef UInt8 byte_t;...
C
/////////////////////////////////////////////////////////////////////////////// // /// \file 04_compress_easy_mt.c /// \brief Compress in multi-call mode using LZMA2 in multi-threaded mode /// /// Usage: ./04_compress_easy_mt < INFILE > OUTFILE /// /// Example: ./04_compress_easy_mt < foo > foo.xz //...
C
/*! * @file * @brief This file contains implementation of queue for data types * * @author Lukáš Plevač, xpleva07@stud.fit.vutbr.cz */ #include <stdlib.h> #include "global_variables.h" #include "data_type_queue.h" #include "debug_tool.h" #if defined(DEBUG) void Data_type_queue_print() { Data_type_queue_...
C
//9.6 дһ3doubleĵַΪСֵһ //мֵڶ #include <stdio.h> double sort(double*, double*, double*); int main(void){ double a, b, c; scanf("%lf %lf %lf", &a, &b, &c); sort(&a, &b, &c); printf("after: %.2lf %.2lf %.2lf\n", a, b, c); return 0; } double sort(double *l, double *m, double *n){ double min, mid...
C
/* https://www.hackerrank.com/challenges/angry-professor */ #include <math.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <stdbool.h> #include <assert.h> #include <limits.h> #include <stdbool.h> bool class_canceled(int arrival_times[], int threshold, int students); int main() { int num_tes...
C
int change1(int n) { return n%10; } int change2(int n) { return n%100/10; } int change3(int n) { return n /100; } int main () { int n; cin>>n; char a[20]; int len,relen=0; cin>>a; relen+=strlen(a); cout<<a; for (int i=0;i<n-1;i++) { cin>>a; len=strlen(a); ...
C
/**********************************************************************************/ /* */ /* File Name : OS_prog.c */ /* ...
C
#include<stdio.h> int collatz(int n); int main(void) { int x; printf("Enter n: \n"); scanf("%d", &x); int cn = 1; cn = collatz(x); printf("CN: %d\n", cn); //return 0; } int collatz(int n) { if(n == 1) return 0; else if ((n % 2) == 0) return 1 + collatz(n/2); else return 1 + collatz(3*...
C
/* * octopi.c * * copyright (c) 2019-2020 HANATAKA Shinya * copyright (c) 2019-2020 Internet Initiative Japan Inc. */ #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <pcap/pcap.h> #include "octopi.h" #include "setproctitle.h" #include "command.h" #include "logging.h" /*...
C
#include "sort.h" /** * quick_sort_hoare - function sorts array of ints using quick sort method * * @array: ptr to array * @size: size of array * * Return: void */ void quick_sort_hoare(int *array, size_t size) { int pivot = array[size - 1]; unsigned int i, j; int temp; if (size >= 2) { for (i = 0, j = ...
C
#include <stdio.h> void rightShiftM(int N, int M, int arr[N][M], int T){ int i; int temp_arr[N][M]; T %= (N*M); for(i = 0 ; i < N*M ; i++) temp_arr[0][(i+T)%(N*M)] = arr[0][i]; for(i = 0 ; i < N*M ; i++) arr[0][i] = temp_arr[0][i]; } int main() { int i, j; ...
C
// COMP2521 20T2 Assignment 1 // Dict.c ... implementsation of Dictionary ADT #include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> #include <stdbool.h> #include <ctype.h> #include "Dict.h" #include "WFreq.h" #include "stemmer.h" typedef struct _DictNode *Link; typedef struct _DictNode { ...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <stdint.h> #include <math.h> #include <stddef.h> #include <stdbool.h> #include <GL/glew.h> #include <GLFW/glfw3.h> GLFWwindow *w; GLFWcursor *cursor; #ifndef Pi # define Pi 3.141592653 #endif #define GLFW_HAND_CURSOR 0x00036004...
C
#include <reg51.h> // ]treg51.hY #define SEGP P0 // wqܫH #define SCANP P2 // wq˫H void display(void); // ŧi˨ void DELAY1ms(int); // ŧiɨ // C`ܾsX char code TAB[10]={ 0xc0,0xf9,0xa4,0xb0,0x99, 0x92,0x83,0xf8,0x80,0x98}; // CAXʱ˽X char code SCAN_CODE[8]={0x7f,0xbf,0xdf,0xef, 0xf7,0xfb,0xfd,0...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_ppm_image_write.c :+: :+: :+: ...
C
/* ============================ rv_system_rwlock_holder_multiple.c ===================================== // rv_system_rwlock_holder_multiple.c maintains the lifecycle of one or more rwlocks // ============================ rv_system_rwlock_holder_multiple.c ===================================== */ //header ...
C
#include <stdio.h> int main() { int array[1024]; int i; int count=0; for(i=0;i<1024;i++) { array[i]=rand()%11; } for(i=0;i<1024;i++) { if(array[i]==3) count++; } printf("Count of 3s is:%d\n", count); return 0; }
C
#include <stdlib.h> #include <stdlib.h> #include "ObjectFiles.h" int main(int argc, char** argv) { //initialize 3 basic fields MachineState *theMachineState; ControlSignals *theControlSignals; DatapathSignals *theDatapath; //other variables FILE *output_file; char *obj_file_name; int i, num_obj_files;...
C
#include<stdio.h> #include<stdlib.h> #include"aac.h" #define AAC_CODE_VALUE_BITS 16 #define AAC_TOP_VALUE (((unsigned long)1<<AAC_CODE_VALUE_BITS)-1) #define AAC_FIRST_QTR (AAC_TOP_VALUE/4+1) #define AAC_HALF (2*AAC_FIRST_QTR) #define AAC_THIRD (3*AAC_FIRST_QTR) #define AAC_NO_OF_CH...
C
/* * arena linked-list */ #ifndef ALIST_H #define ALIST_H #include <stddef.h> /* size_t */ #include <cbl/arena.h> /* arena_t */ /* list node */ typedef struct alist_t { void *data; /* data */ struct alist_t *next; /* next node */ } alist_t; alist_t *alist_append(alist_t *, void...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include "common.h" //getcgidata() int login(char *input) { int i = 0, j = 0; char name[64]; char pass[64]; // ǻȡinputַµʽ // Username="admin"&Password="aaaaa" // "Username=""&Password="ǹ̶ // "admin""aaaaa"DZ仯ģҲҪȡ ...
C
#include "tercetos.h" #include <string.h> #include <stdlib.h> static int _idx_terceto = 0; Terceto NewTerceto(void) { return NULL; /* por compatibilidad con el futuro */ } int AddTerceto(Terceto t, TercEntry e1, TercEntry e2, TercEntry e3) { # define STRB_SZ 2048 char strb[STRB_SZ+1] = {0}; TercEntry entries[3] ...
C
// // Created by Hood on 5/22/2019. // /* * Vector implementation details: * For each prime $p$ we have the following fields: * bitlength -- how long each component of the vector is in bits * bitmask -- mask out the bottom bitlength bits of a uint64 (so this is 2^bitlength - 1) * entries...
C
/** * Machine Problem: Vector * CS 241 - Spring 2017 */ #include "vector.h" #include <assert.h> #define INITIAL_CAPACITY 10 #define GROWTH_FACTOR 2 struct vector { /* The function callback for the user to define the way they want to copy * elements */ copy_constructor_type copy_constructor; /* The fu...
C
#include<stdio.h> insertion(int *a,int n) { for(i=0;i<n;i++) { int key=a[i]; int j=i-1; while(j>=0 && a[j]>key) { a[j+1]=a[j]; j--; } } a[j+1]=key; } int main() { int a[50],t; ...