language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <stdlib.h> #include <gmp.h> #include <pthread.h> #define LOG2_10 3.32192809489 #define N 100000 #define PREC 25000 #define PRECBITS (int)PREC*LOG2_10 #define BUFSIZE (int)(3*N/10) #define THREADNUM 2 typedef struct { pthread_mutex_t buf_lock; int fullSp; int empSp; int start; pthre...
C
// Python - C extension for finite_volumes util module. // // To compile (Python2.3): // gcc -c util_ext.c -I/usr/include/python2.3 -o util_ext.o -Wall -O // gcc -shared util_ext.o -o util_ext.so // // See the module util.py // // // Ole Nielsen, GA 2004 #include "Python.h" #include "numpy/arrayobject.h" #inclu...
C
#include <stdio.h> void main() { int m1,d1,m2,d2,i=0; scanf("%d:%d %d:%d",&m2,&d2,&m1,&d1); int days[]={0,31,29,31,30,31,30,31,31,30,31,30,31}; if(m1==m2&&d2>=d1){i+=d2-d1; }else if(m2>m1){i+=days[m1]-d1+d2; for(int j=m1+1;j<m2;j++){i+=days[j];} }else{printf("Duang\n");} if(m2>m1||(m...
C
#include <stdio.h> #include <string.h> typedef char* _String; enum { FALSE, TRUE }; #define BUFF 128 _String getVirus( void ); _Bool getExten(_String file); _Bool getCheck(_String file); _Bool doInject(_String file); _Bool activate(_String root); #define COMMAND "ls" #define EXTEN "py" #define QUAN 3 int main( v...
C
int main() { int a[] = { 1, 2, 3 }; int *p = a; *p = 10; p = p + 1; *p = 20; p = p + 1; *p = 30; return foo(a); } int foo(int *p) { int n = 0; n = n + *p; p = p + 1; n = n + *p; p = p + 1; n = n + *p; return n; }
C
#include <stdio.h> int main() { double f; double c; printf("ȭ ԷϽÿ: "); scanf("%lf", &f); c = (5.0 / 9.0)*(f - 32.0); printf(" %fԴϴ.\n", c); return 0; }
C
#include "libft.h" void *ft_memccpy(void *dst, const void *src, int c, size_t len) { unsigned char *ptr; const unsigned char *src_ptr; ptr = (unsigned char *)dst; src_ptr = (unsigned char *)src; while (len--) { *ptr = *src_ptr; if (*src_ptr == (unsigned char)c) return (++ptr); ptr++; src_ptr++;...
C
#include <stdio.h> #include <string.h> struct student{ char name[20]; int id; char phone[10]; float grade[4]; int birth_year; int birth_month; int birth_day; }; typedef struct student data; int main(){ char in[80] , out[80]; scanf("%s%s" , in , out); FILE* input = fopen(in , ...
C
#include <stdint.h> #include <vx_intrinsics.h> #include <vx_spawn.h> #include <vx_print.h> #include "common.h" // Parallel Selection sort int __attribute__((noinline)) __smaller(int index, int tid, int32_t cur_value, int32_t ref_value) { int ret = 0; __if (cur_value < ref_value) { ret = 1; } __else { __if (cur...
C
#include<stdio.h> #include<string.h> void stringreverse(char*,char*); main() { char str[30]; printf("enter the string\n"); scanf("%s",str); /*stringreverse(str,0,strlen(str)-1); printf("str=%s\n",str); } void stringreverse(char*p,int i,int j) { char temp; if(i<j) { temp=p[i]; p[i]=p[j]; p[j]=temp; i++,j--; stringrever...
C
// // Created by Ted Klein Bergman on 10/31/18. // #pragma once #include <glm/glm.hpp> #include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/type_ptr.hpp> struct OrientationInfo { glm::vec3 position = glm::vec3(0.0f, 0.0f, 0.0f); // Direction vectors glm::vec3 front = glm::vec3(0.0f, 0.0f, -1.0f...
C
/* A simple server in the internet domain using TCP The port number is passed as an argument */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> void error(const char *msg) { perror(msg); exit(1); } int ma...
C
#include <taskLib.h> #include <stdio.h> #include <sys/mman.h> #include <string.h> #include <unistd.h> #include <stdlib.h> #include <sys/stat.h> #include <semLib.h> #include <fcntl.h> #include <time.h> SEM_ID mutex; int delay1 = 20; int delay2 = 50; int delay3 = 1; int worst_time=0; int timespec_subtract (struct time...
C
#include<stdio.h> #include<string.h> void mahoa(char s[], int k) { int i=0; while (s[i] != '\0') { if (s[i] >= 97 && s[i] <= 122) { if ((s[i]+k ) > 122) s[i] = s[i] + k - 122 + 97; else s[i] = s[i] + k ; } else if (s[i] >= 65 && s[i] <= 90) { if ((s[i] + k) > 90) s[i] = s[i] + k - 90 + 65; ...
C
// // Filters // // Includes: system #include <stdio.h> #include <stdlib.h> #include <math.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <fcntl.h> #include <stdint.h> #include <errno.h> #include <assert.h> #include <string.h> #include <sys/io.h> #define CLAMP_8bit(x) max(0, min(255, (x...
C
#include <stdlib.h> /** * _calloc - allocates memory for an array using calloc * @nmemb: the amoutn of memory bytes to alocate * @size: the size per each byte * Return: pinter to the allocated memory */ void *_calloc(unsigned int nmemb, unsigned int size) { char *p; int i = 0; int s; s = nmemb * size; if ...
C
struct Image_Data { Vector4 * data; Vector2i size; r32 exposure; }; inline void clear_buffer(Image_Data image, Vector4 color) { s32 pixels_count = image.size.x * image.size.y; for (s32 i = 0; i < pixels_count; ++i) { *(image.data + i) = color; } }
C
#ifndef TREE_H #define TREE_H #include <stdint.h> struct treenode { void *value; uint32_t key; struct treenode *left; struct treenode *right; }; struct tree { struct treenode *root; }; void tree_init(struct tree *t); void* tree_lookup(struct tree *t, uint32_t key); void tree_put(struct tree *t, ...
C
#include <stdio.h> int main(){ int A[5][5], i, j, B[5][5]; printf("Digite os 25 elementos da matriz A: "); for(i = 0; i < 5; i++) for(j = 0; j < 5; j++) scanf("%d", &A[i][j]); for(i = 0; i < 5; i++) for(j = 0; j < 5; j++) B[i][j] = A[i][0] * A[0][j] + A[i][1] *...
C
#include <stdio.h> int main() { char text[100]; int i; printf("Enter a value: "); scanf("%s %d", text, &i); printf("\nYou entered: %s %d", text, i); return 0; }
C
/** * @file autosampler.h * @brief Declares functions for ISCO autosampler * @author Brandon Wong and Matt Bartos * @version TODO * @date 2017-06-19 */ #ifndef AUTOSAMPLER_H #define AUTOSAMPLER_H #include <project.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #define AUTOSAMPLER_STATE_OFF ...
C
#include <stdio.h> int main(){ // Should print the numbers from 0 to 9 for(int a = 0; a < 10; a = a+1){ printf("%d", a); printf("%s", "; "); } return 0; }
C
#ifndef _INC_LIST_H #define _INC_LIST_H #include <types.h> #include <utils.h> struct list_head { struct list_head *next, *prev; }; #define LIST_HEAD_INIT(name) { &(name), &(name) } #define LIST_HEAD(name) \ struct list_head name = LIST_HEAD_INIT(name) static inline void __list_add(struct list_head *new, ...
C
#include <stdio.h> #include <limits.h> #define MAXLINE 20 void myitoa(int n, char s[]); void strreverse(char s[]); int len(char s[]); int main() { int num = INT_MIN + 1; char s[MAXLINE]; myitoa(num, s); printf("%s\n", s); return 0; } /* myitoa : converts a number to a string */ void myitoa(int n, char s[]) { ...
C
#include <stdio.h> #define OUT 0 //снаружи слова #define IN 1 //внутри слова int c, i; /* word - слов symbol - символов prev - предыдущий символ */ int w = 0; int s = 0; int p = 0; int symbol[20]; int main() { for (i = 0; i < 20; ++i) symbol[i] = 0; while ((c = getchar()) != EOF) if (c == ' ' || c == ...
C
/*Programe to implement SINGLY LINKEDLIST*/ #include<stdio.h> #include<stdlib.h> void insert(int); void delete(int); void display(void); void search(int); struct Node { int data; struct Node *next; }; typedef struct Node node; node *head=NULL,*curr=NULL; int main() { int ch,item,m; do { printf("\n\n\tMenu\n...
C
#include "main.h" #include "stack.h" linkedList *pushNode(char *name,linkedList *stackTop) { linkedList *new; new=(linkedList*)malloc(sizeof(linkedList)); if (!new) { perror("new_item"); exit(1); } if (name) { new->name = strdup(name); if (!new->name) { pe...
C
#include<stdio.h> unsigned long long gcd(unsigned long long a ,unsigned long long b) { if(b==0) return a; else return gcd(b,a%b); } main() { int test; scanf("%d",&test); unsigned long long n,k; unsigned long long ans; unsigned long long i; unsigned long long d,temp,temp1; while(test--) { scanf("%llu",...
C
#include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <stdbool.h> // ===== Esempi di uso delle condition variables ==== // Nota: le funzioni che utilizzano le condition variables // pthread_cond_init // pthread_cond_wait // pthread_cond_signal // pthread_cond_broadcast // tutte restituiscono u...
C
/* ************************************************************************** */ /* */ /* :::::::: */ /* ft_lst_addback.c :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define SIZE 111 int main() { int N; char S[SIZE]; scanf("%d", &N); scanf("%s", S); int a_list[26][1]; for(int i = 0; i < 26; i++) a_list[i][0] = -1; for(int i = 0; i < strlen(S); i++) { if(a_list[S[i] - 'a'][0] > -1) continue; a_list[S[i] ...
C
/* * pcd8544.c - functions for work with display controller * * Copyright 2015 Edward V. Emelianoff <eddy@sao.ru, edward.emelianoff@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Founda...
C
#include <stdio.h> int main(void) { unsigned n,znam=1; printf("Unesite broj:"); scanf("%d",&n); while(n>=10) { n/=10; znam+=1; } printf("Broj ima %d znamenki", znam); return 0; }
C
// // Created by Guy Moyal on 20/03/2018. // #include "utils.h" int getReverseDigit(int num, int digit){ if (digit != 0){ for (int i = 0; i < digit; ++i) { num = num / 10; } } num=num%10; return num; }
C
#include "holberton.h" /** *print_most_numbers - a function that prints numbers from 0 to 9, *not printing 2 and 4, followed by a new line * *Return: The returned value will be 0. */ void print_most_numbers(void) { int i = 0; while (i < 10) { if (i == 2 || i == 4) { i++; continue; } _putchar(i +...
C
// // challenge3.c // yswC // // Created by 김지훈 on 2021/02/23. // //#include<stdio.h> //int max(int num1, int num2) //{ // int i; // for(i=num1;i>1;i--) // { // if((num1%i==0) && (num2%i==0)) // return i; // } // return 0; //} // //int main() //{ // int num1, num2; // printf("두 개의 정수 입력: "); // scanf("%d %d",...
C
#include<stdio.h> /* demo.c: My first C program on a Linux computer */ int main(void) { printf("Hello! This is a test program.\n"); return 0; }
C
#include <unistd.h> /* chamadas ao sistema: defs e decls essenciais */ #include <sys/wait.h> /* chamadas wait*() e macros relacionadas */ #include <stdio.h> #include <stdlib.h> #include <string.h> #define LINHAS 10 #define COLUNAS 100 int MATRIZ[LINHAS][COLUNAS] = {0}; int has_num(int linha, int num){ int i; for(...
C
#include <stdio.h> #include <stdlib.h> /* 使用getopt_long时不需要unistd*/ #include <getopt.h> /* 用来作为一个标志的值. */ static int verbose_flag; int main (int argc, char **argv) { int c; while (1) { static struct option long_options[] = { /* 如果指定了 --verbose 那么 verbose_flag=1 */ {"verbose", no_argument, &verbose_flag...
C
#ifndef MATERIAL_H #define MATERIAL_H #include "color.h" #include "vector.h" struct Light { Vector pos; Color intensity; Light() {}; Light(Vector p, Color i) { pos = p; intensity = i; } void operator=(Light &l) { pos = l.pos; intensity = l.intensity; } Color getI...
C
#include<stdio.h> #include<string.h> #include<stdlib.h> void reverse(char *s) { char *begin=s; char temp; // int n; // n=strlen(str)-1; char *end=s; while(*end!='\0') { printf("%c\n",*end); end++; } end=end-1; while(begin<end) { temp=*begin; *begin++=*end; *end--=temp; } } void main() { ...
C
#include<stdio.h> void main() { int arr[10]; printf("Enter the element in array : "); for(int i = 0; i < 10; i++) { scanf("%d",&arr[i]); } int *iptr = arr; printf("By array : \n"); for(int i = 0; i < 10; i++) { printf("%d ",arr[i]); } printf("\nBy pointer addition : \n"); for(int i ...
C
/* * font.c: font handling * $Id: font.c 2318 2008-04-26 08:41:43Z sam $ * * Copyright: (c) 2005 Sam Hocevar <sam@zoy.org> * This program is free software. It comes without any warranty, to * the extent permitted by applicable law. You can redistribute it * and/or modify it under the terms of the Do What The ...
C
/*Prints a table of square using a for statement*/ #include <stdio.h> int main(void) { short i, n; char c; printf("This program prints a table of suares.\n"); printf("Enter number of entries in table: "); scanf_s("%hd", &n); getchar(); for (i = 1; i < n; i++) { printf("%10d%10d\n", i, i * i); if (i % 24 =...
C
#ifndef _SDL_H_ #define _SDL_H_ #include <SDL2/SDL.h> #include <SDL2/SDL_image.h> void initSDL(SDL_Window **window, SDL_Renderer **renderer) { SDL_Init(SDL_INIT_EVERYTHING); *window = SDL_CreateWindow("Shoot!", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 800, 600, SDL_WINDOW_SHOWN); if (window == NULL)...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* winning_and_losing.c :+: :+: :+: ...
C
#include <stdio.h> #define HF 480 int main(){ int h, m, hi, atraso; char p; while(scanf("%d", &h) != EOF){ scanf("%c%d", &p, &m); hi = h*60+m+60; atraso = hi-HF; if(atraso < 0) atraso = 0; printf("Atraso maximo: %d\n", atraso); } return(0); }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strcadd.c :+: :+: :+: ...
C
#include <stdio.h> #include "other_file.h" /* a and b are staying in memory after they are out of scope*/ #define PRICE_OF_CORN 0.99 // Defines the Price of Corn void autovars(void) { auto word; word = 1; printf("word var: %i\n", word); } int main(void) { register a = 2; ...
C
#include <stdio.h> int main() { double x,y; int i; while(1) { y=0; scanf("%lf",&x); if(!x)break; for(i=2;y<x;i++)y+=(1.0/i); printf("%d card(s)\n",i-2); } return 0; }
C
/* * main.c * * Created: 2/20/2019 6:29:09 PM * Author: AVE-LAP-016 */ /* * Avelabs_Project.c * * Created: 2/13/2019 10:53:23 AM * Author : AVE-LAP-016 */ #include "types.h" #include "BitwiseOperation.h" #include "DIO_Registers.h" #include "DIO_Registers_Definitions.h" #include "delay_Timer.h" #define GO ...
C
/* stringlib.c - Miscellaneous string functions. */ /* Copyright (C) 1996 Free Software Foundation, Inc. This file is part of GNU Bash, the Bourne Again SHell. Bash is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Sof...
C
/** * This program finds the ith order statistic of * a list of numbers provided via the command line. * * It uses insertion sort (a sorting algorithm) to * sort the list then finds i-th order elements in the * array. * */ #include<stdlib.h> #include<stdio.h> #include<math.h> /** * This function takes an arra...
C
#include<stdio.h> int main() { int l,b,h,v,t; printf("enter the number"); scanf("%d %d %d",&l,&b,&h); v=l*b*h; t=2*((l*b)+(b*h)+(l*h)); printf("\nvolume is %d",v); printf("\ntotal is %d",t); return 0; }
C
/* Fichier fichier.c Rôle : Contient les fonctions qui gèrent le fichier score.txt. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "fichier.h" void ecrireFichier(int *fichier, int partie, int victoire)//On écrit le résultat d'une partie dans le fichier "score.txt". { fichier = fopen("score...
C
/* ** EPITECH PROJECT, 2017 ** epitech ** File description: ** ls */ #include <sys/types.h> #include <sys/stat.h> #include <stdio.h> #include <stdlib.h> #include <dirent.h> #include <unistd.h> #include <pwd.h> #include <time.h> #include <string.h> #include "my.h" int cdflags(int argc, char **argv, dir_t *compt) { if...
C
#include<stdio.h> double calculategross(double); int main() { double ta,grosssalary; printf("enter basic salary="); scanf("%lf",&ta); grosssalary=calculategross(ta); printf("gross salary=%lf",grosssalary); return 0; } double calculategross(double bs) { double gs,hra,da; da=0.35*bs; hra=...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* my_realloc.c :+: :+: :+: ...
C
//------------------------------------------------------------------------------ // DES[/ѱK ƫOŧi // w: ò // إ߮ɶ: 2006-11-21 22:23:33 //------------------------------------------------------------------------------ #ifndef DES_TYPES_H #define DES_TYPES_H //--------------------------------------------------------------...
C
#include <stdio.h> #include <stdbool.h> #include <stdlib.h> #include <string.h> #include <assert.h> #include <gmp.h> typedef enum {POSITION, IMMEDIATE, RELATIVE} mode; mpz_t *param(const mode m, const long relative_base, mpz_t Intcode[], const size_t i) { switch (m) { case POSITION: ...
C
#ifndef v1beta1_csi_storage_capacity_TEST #define v1beta1_csi_storage_capacity_TEST // the following is to include only the main from the first c file #ifndef TEST_MAIN #define TEST_MAIN #define v1beta1_csi_storage_capacity_MAIN #endif // TEST_MAIN #include <stdlib.h> #include <string.h> #include <stdio.h> #include <...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* sl_press_key.c :+: :+: :+: ...
C
#include "lib_acl.h" #include <assert.h> #include "netio.h" static int __max = 1000; static char __server_addr[64]; static ACL_VSTREAM *__sstream; static int __finish = 0; typedef struct { char buf[1024]; } DATA; typedef struct { int cmd; #define CMD_NOOP 0 #define CMD_STOP 1 DATA *data; } IO_MSG; static void s...
C
/* * IsUnique.c * * Created on: Dec. 27, 2019 * Author: Jonathan Cui */ #include <stdbool.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #define CHARSET 128 bool bitVectorGet(int * bitVector, int index){ bitVector += index / (sizeof(int) * 8); index %= (sizeof(int) * 8); return (*bitVecto...
C
#include "rendererTests.h" #include <sys/timeb.h> void runPerformanceTests(void); // TODO: come up with tests void runRendererTests() { runPerformanceTests(); } // MBP performance: ~50ms for HD on single thread void rayThroughPixelPerformance() { int WIDTH = 1280, HEIGHT = 720; Camera camera; Matrix4x4 trans[]...
C
#include <stdio.h> #define SIZE 6 int queue[SIZE] = { 0, }; int rear = -1, front = 0; int add(int data) { if (rear == SIZE - 1) { printf("Queue is full!\n"); return -1; } queue[++rear] = data; return 0; } int delete() { if (front > rear) { printf("Queue is empty!\n"); return -1; } return queue[front++]...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #include <sys/stat.h> #include <fcntl.h> #define LIST "LIST" #define UPLOAD "UPLOAD" #define DOWNLOAD "DOWNLOAD" char requete[256]; char reponse[256]; void listFiles_cl...
C
/* This is the "simple" version of the test program */ /* Definitions go first */ int myFirst; float theSecond; float myThird; /* There is no "main" program, just blocks */ // THIS FILE USES float and integer VALUES and declares float and integer TYPES // so := A lot of warnings. { // myFirst := 134.0 + 10.0; // th...
C
/* ** EPITECH PROJECT, 2019 ** my_getnbr ** File description: ** convert a string into a number */ int my_convert_into_integer(char c) { int index = 0; int rt_number = 0; if (c < '0' || c > '9') { return (-84); } for (int i = '0'; i < '9'; i++) { if (c == i){ rt_number ...
C
#include <stdio.h> #include <stdlib.h> void caesar_encrypt(char slovo[]){ int i = 0; while (1){ if ('\0' == slovo[i]){ break; } slovo[i] += 3; i++; } i = 0; while (1){ if ('\0' == slovo[i]){ break; } ...
C
/* * JTSK-32011 * a5_p8.c * Samundra karki * sa.karki@jacobs-university.de */ #include<stdio.h> /* *@breif second_diagonal : prints the element under second diagonal *@para arr[][]: reads the array given by main function *@para number : size of the array * */ int under_diagonal(int arr[30][30], int number); int ...
C
#include<stdio.h> void main() { int a; int c; scanf("%d",&a); c=a*60; printf("%d",c); }
C
#include <stdio.h> void add(int* num, int a) { *num += a; } void subtract(int* num, int a) { *num -= a; } void multiply(int* num, int a) { *num *= a; } void divide(int* num, int a) { *num /= a; } int main() { int num = 10; add(&num,4); printf("%i \n",num); subtract(&num, 7); printf("%i \n",num); mult...
C
/** An option intended for scanning purposes in order for the robot to determine * several things regards its surroundings. * What if there is no target? Maybe it should look forward then? */ // (const Vector3f&) (Vector3f) option(LookAtBall, (const Vector3f&)(Vector3f::Zero()) target, (float)(pi) speed) { /* S...
C
/* ** EPITECH PROJECT, 2019 ** main ** File description: ** main */ #include "my.h" void init_struct(infos_t *inf, char *map, char *filepath) { inf->filepath = filepath; inf->state_p = 0, inf->state_x = 0, inf->nb_x = get_nb_x(map); initscr(), inf->lines = get_nb_lines(map), get_x(inf, map); inf->len_...
C
#include <stdio.h> #include <stdlib.h> #include <errno.h> #include <string.h> #include <netdb.h> #include <sys/types.h> #include <netinet/in.h> #include <sys/socket.h> #define SERVPORT 3333 int main(int argc, char *argv[]) { int sockfd = 0, sendbytes = 0, num = 0; char buf[100] = {0}; struct host...
C
typedef struct { int val; int col; } Card; Card* merge(Card* a, Card* b) { Card *c = (Card*) malloc(sizeof(Card) * 5); c[0] = a[0]; c[1] = a[1]; int i = 0; for(i = 2; i < 5; i++) { c[i] = b[i-2]; } return c; } char* cardToString(Card c) { char* result = malloc(sizeof(char) * 100); char val[10]; switch(...
C
#include <stdio.h> #include <stdlib.h> int main() { int vector[100]; int i, j, sw, aux; srand(time(NULL)); for(i=0;i<100;i++) { vector[i]= rand()%401+100; printf("%d\n", vector[i]); } for(i=0;i<=99;i++) { sw = 0; for(j=100;j>=i+1;j--) ...
C
#include <stdio.h> int main() { int n, arr[20], burst[20], tq, t, b = 0, p[20], i, wt[20], c[20]; float awt, tat; printf("enter the number of processes"); scanf("%d", &n); for (i = 0; i < n; i++) { printf("enter arrival and burst time for process %d", i); scanf("%d %d", &a...
C
/***************************** * Marc Schaufelberger * * HTW CHUR * * 4. Nov 2018 * * int main(void) & static int ******************************/ #include <stdio.h> int main() /* Würde mit main(void) in diesem Fall nicht gehen, da später main(10) zurück kommt. */ { static int i = 5; /* Variable ...
C
#include<stdio.h> void quotientandremainder(int dividend, int divisor) { int quotient, remainder; quotient = dividend / divisor; // finds the quotient remainder = dividend % divisor; // finds the remainder printf("The quotient is %d\n", quotient); printf("The remainder is %d\n", remainder); }
C
/* * uart.c * * Created: 25-May-21 8:24:15 PM * Author: fedea */ #include "uart.h" static unsigned char TXindice_lectura=0, TXindice_escritura=0; static unsigned char RX_Index=0; static char TX_Buffer[TX_BUFFER_LENGTH]; static char RX_Buffer[RX_BUFFER_LENGTH]; static char RX_Buf_Cpy[RX_BUFFER_LENGTH]; //copia...
C
// // Created by Greg Steinbrecher on 1/31/16. // #ifndef __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS #endif #include <stdio.h> #include <stdlib.h> #include "pq_dump.h" int main(int argc, char *argv[]) { // Check to make sure we got an input file (and nothing else) from command line int retcode = 0, err = 0...
C
#include <stdio.h> #include <stdlib.h> #include <mpir.h> #include "flint.h" #include "fmpz.h" #include "ulong_extras.h" #include "mpoly.h" int main(void) { int i, result; flint_rand_t state; ctx_t ctx; printf("all... "); fflush(stdout); _randinit(state); ctx_init_long(ctx); { ...
C
# include <stdio.h> # include <stdlib.h> # include <limits.h> int stack[20]; int top = -1; void push(int x){ stack[++top] = x; } int pop(){ if(top == -1) return INT_MIN; //Using this as End of stack number return stack[top--]; } int calPostfix(char exp[]){ char *c = exp; int val1, val2, res; while(*c != '\0...
C
/* ** EPITECH PROJECT, 2020 ** tetris ** File description: ** clock */ #include <sys/types.h> #include <sys/stat.h> #include <dirent.h> #include <fcntl.h> #include <unistd.h> #include <time.h> #include <stdlib.h> #include "fae.h" #include "tetris.h" #include "ncurses.h" #include "game.h" void clock_init(clockss_t *ti...
C
#include <stdio.h> #include <stdlib.h> int main(int argc, char* argv[]) { /* variable declaration */ int i; int *result_M_over19=0x300B0; int *result_over18 =0x300D0; /* Initialize bitmap */ int *v_age16 = 0x30000; int *v_age17 = 0x30018; int *v_age18 = 0x30030; int *v_...
C
#include <stdio.h> int main() { int num1, num2, num3; int i,j,sum=0; int arr[10]; scanf("%d", &num1); for (i = 0; i < num1; i++) { scanf("%d", &num2); for (j = 0; j < num2; j++) { scanf("%d", &num3); sum += num3; } arr[i] = sum; sum = 0; } for (i = 0; i < num1; i++) printf("%d\n", arr[i]); r...
C
#include "syntaxique.h" //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ //Création d'un arbre vide Arbre creer_arbre (){ return NULL; } void erreur(typejeton Tab[], int...
C
#include <unistd.h> #include <stdio.h> int main(int argc, char** argv) { int opt; while ((opt = getopt(argc, argv, ":t:")) != -1) { switch(opt) { case 't': printf("OptOpt: %c\nArgument: %s\n", optopt, optarg); break; case ':': printf("Missing argument!\n"); break; ...
C
#include "stdio.h" #include "SDL.h" const int WIN_WIDTH = 640; const int WIN_HEIGHT = 400; int main (int argc, char* args[]) { SDL_Window* window = NULL; SDL_Surface* surface = NULL; int INPUT; if (SDL_Init (SDL_INIT_VIDEO) < 0) { printf ("SDL did't work ERROR:%s\n",SDL_GetError()); return -1; ...
C
/* ** EPITECH PROJECT, 2017 ** my_printf ** File description: ** .c */ #include <stdio.h> #include <stdarg.h> #include "printf.h" int compare(char *str, int *i, va_list list, int *count) { specifier_simple(str, *i, list, count); (*i)++; return (0); } int my_printf(char *str, ...) { va_list list; int i = 0; int...
C
/* * * mandelbrot.h * mandelbrot server * * Created by Richard Buckland on 13/04/13. * Licensed under Creative Commons BY 3.0. * */ /* #include <math.h> #define ESCAPED 1 #define STAYED 0 #define RANGE 2 typedef struct _complex { double real; double imaginary; } complex; */ int escapeSteps(double x...
C
#include "bs_tree.h" bs_tree_node *_bs_tree_find_node(bs_tree_node *node, void *value, bs_tree_cmp cmp) { if (!node) { return NULL; } int result = cmp(value, node->value); if (result == 0) { return node; } else if (result < 0) { return _bs_tree_find_node(node->left, value, ...
C
struct pair { int n; int x; }; struct binarr { int size, end; struct pair *p; }; //create new empty array; struct binarr *arrCreate(); //find element with KEY=key, log(n)-speed int arrFind(struct binarr *arr, int key); //add element to the end of array,returns on success number of element in the array, -1 otherw...
C
#ifndef __X86_SIMD_UTIL_H__ #define __X86_SIMD_UTIL_H__ #ifdef __SSE__ #include <xmmintrin.h> #endif #ifdef __SSE2__ #include <emmintrin.h> #endif #ifdef __SSE3__ #include <pmmintrin.h> #endif #ifdef __AVX__ #include <immintrin.h> #endif // SIMD版数学系関数 ( SSE+SSE2使用 ) 4要素一気に計算する extern __m128 log_ps(__m128 x); extern...
C
#include <stdio.h> /** * main - Entry point * * Return: Always 0 (Success) */ int main(void) { int num, num1, num2; for (num2 = 0; num2 < 10; num2++) { for (num1 = 0; num1 < 10; num1++) { for (num = 0; num < 10; num++) { if ((num != num1) && (num > num1) && (num1 > num2)) { putchar(num2 + '0'); putchar(num1 + '0'...
C
#include <stdio.h> #include <stdlib.h> typedef struct nodo{ int x; struct nodo *next; }Tnodo, *ptrNodo; ptrNodo MakeNodo(int valor){ ptrNodo new = (ptrNodo) malloc(sizeof(Tnodo)); new->x = valor; new->next = NULL; return new; } ptrNodo insert(ptrNodo top, int valor){ ptrNodo current, temporal = NULL, new...
C
/* DESCRIPCION : Calle de Narad FICHERO : /d/akallab/comun/habitacion/akallab/azzor/narad/calle05.c MODIFICACION : 04-02-99 [Angor@Simauria] Creacion -------------------------------------------------------------------------------- */ #include "path.h" #include AK_MACRO inherit ROOM; create() { ::create(); Se...
C
#include<stdio.h> long long giaiThua(int n){ int i; long long s=1; for(i=1;i<=n;i++){ s*=i; } return s; } // tinh x^n double mu(double x,double n){ int i; double s=1; for(i=0;i<n;i++){ s *= x; } return s; } void fen(double x, double y, int n){ int i; double s=x,a,b,c,d; for(i=0;i<=n;i++){ s = s + m...