language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* Image Processing Bilateral Filtering Images Ivan Alexander Rulik Cote 10/10/2021 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <malloc/malloc.h> #include <memory.h> #define max(x, y) ((x>y) ? (x):(y)) #define min(x, y) ((x<y) ? (x):(y)) int xdim; int ydim; int maxraw...
C
#include <stdio.h> int main() { float BaseMaior, BaseMenor, Altura, Area; //Recebe os valores da base maior, menor e altura printf("Digite o valor da Base Maior do trapézio: cm "); scanf("%f", &BaseMaior); printf("Digite o valor da Base Menor do trapézio: cm "); scanf("%f", &BaseMenor); printf("Digite o val...
C
#include <stdio.h> #include <ctype.h> #include <assert.h> #include <string.h> #define MAXSTRING 100 int edit_dist(char *x, char *y); int stringlen(char *x); int change(char *x, char *y); void tests(void); int main() { char string1[MAXSTRING], string2[MAXSTRING]; int i; printf("enter 2, 4 letter words:\n"); ...
C
// // Created by shadowiterator on 18-10-27. // #include "global.h" #include "msghandler.h" #include "server.h" #include "sistring.h" typedef struct { int filefd; ConnectArg* cargs; }FileArgs; int countParam(char* cmd) { int p = 0; while(cmd[p] && cmd[p] != ' ') ++p; if(cmd[p] && cmd[p] =...
C
/* * intToStr.c * * Created on: 2018311 * Author: xubov */ int intlen(int m); char itoa(int n); // int תΪӦַ int intToStr(char a[],int m){ int length = intlen(m); int i; for(i = 1; i <= length ; i++){ a[length - i] = itoa(m % 10); m /= 10; } return length; } // αij int int...
C
// // Created by djvas on 16/11/2017. // #include "stack_int_array.h" void testClient_StackIntArray() { struct StackIntArray stk; init_StackIntArray(&stk, 6); push_StackIntArray(&stk, 4); push_StackIntArray(&stk, 8); push_StackIntArray(&stk, 16); pop_StackIntArray(&stk); print_StackIntArr...
C
#include "binary_trees.h" #include <limits.h> /** * count_nodes - counts the number of nodes inside the tree. * @tree: binary tree node. * Return: number of nodes in the tree. */ int count_nodes(const binary_tree_t *tree) { if (!tree) return (0); return (1 + count_nodes(tree->left) + count_nodes(tree->right)); ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_abs.c :+: :+: :+: ...
C
/*File name: token.h ------------------------------------------------* |Project: Implementace překladače imperativního jazyka IFJ20 | |Team: 124, varianta II | |Authors: Ondřej Sloup (xsloup02) | | Viktor Rucký (xruc...
C
#include<stdio.h> #include<stdlib.h> struct node{ int data; struct node* next; }*temp; void reverse(struct node**head_ref){ printf("\n reverse function called"); struct node *next=NULL,*prev=NULL,*curr=*head_ref; printf("%d",curr->data); int i=0; while(curr!=NULL){ printf("lulz"); ...
C
#include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <arpa/inet.h> #include <string.h> #include <pthread.h> #include <string.h> #include <sys/types.h> #include <unistd.h> #include <sys/stat.h> #include <fcntl.h> #include <dirent.h> #define PATH_MEDIA "/hom...
C
#include "eps.h" #include <stdio.h> #include <stdlib.h> #include <math.h> Figure *start_figure(double width, double height) { Figure *fig = (Figure *)malloc(sizeof(Figure)); fig->urx = width / 2; fig->ury = height / 2; fig->llx = -width / 2; fig->lly = -height / 2; return fig; } void set_thicknes...
C
#include<stdio.h> #include<stdlib.h> #include<math.h> #include<ctype.h> #include<string.h> #define NEXT(a) ((a)->next) // #define DEBUG typedef struct range_node Range_node, *Range; typedef struct source_node Source_node, *Source; typedef struct { int year; int month; int day; } Date; struct source_node { ...
C
/***************************** hw05: quick sort排序 姓名: stu012 學號: ******************************/ #include <stdio.h> #include <string.h> void showdata(int*); void quick(int*, int, int); int main(void) { int data[18]={10,12,31,89,2013,13,42,88,76,45,21,17,75,8,5,2,1,100}; //原始資料 quick(data,0,17...
C
 #include <linux/completion.h> #include <linux/spinlock.h> /** * complete: - signals a single thread waiting on this completion * @x: holds the state of this particular completion * * This will wake up a single thread waiting on this completion. Threads will be * awakened in the same order in which they were qu...
C
/* W3C Sample Code Library libwww Timer Class ! The Timer Class ! */ /* ** (c) COPYRIGHT MIT 1995. ** Please first read the full copyright statement in the file COPYRIGH. */ /* The Timer class handles timers for libwww and the application. This works exactly as in X where you create a timer object with a...
C
/****************************************************** * 排序算法: * - 冒泡排序: * - 插入排序 * - 希尔排序 * - 堆排序 * - 归并排序 * - 快速排序 * - 表排序 * - 桶排序 * - 基数排序 * * 各个算法的时间复杂度、额外空间复杂度和稳定性见PPT10.4 * * 定义同一接口:void XSort(ElementType a[], int n); * 统一为从小到大排序 * (只讨论内部排序) ***************************************...
C
/** * VUT FIT IMP project - heart rate measurement. * * original * * @brief LED display interface. * @author Dominik Harmim (xharmi00) <xharmi00@stud.fit.vutbr.cz> * @date 30.12.2018 */ #ifndef DISPLAY_H #define DISPLAY_H #include <stdint.h> /** * Display refresh period in us. * Frequency 60 Hz, 1 / 60 ...
C
#include<stdio.h> int bsearch(int*,int,int); int main() { int i,n,a[50],k,r; printf("Enter the number of elements : "); scanf("%d",&n); printf("Enter the array : "); for(i=0;i<n;i++) { scanf("%d",&a[i]); } printf("Enter no. to be searched : "); scanf("%d",&k); r=bsearch(a,n,k); if(r==-1) printf("Search u...
C
#pragma poroto memory input_mem int 16984 #pragma poroto memory output_mem int 16984 #pragma poroto stream::roccc_bram_in threshold::input_image(input_mem, N*N, ROCCC_uint8) #pragma poroto stream::roccc_bram_out threshold::output_image(output_mem, N*N, ROCCC_uint8) typedef unsigned int ROCCC_uint8; void threshold(in...
C
/* * file: mkfamesmr.c * description: initialize fake SMR drive or image */ #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <getopt.h> #include "stl_fakesmr.h" #define SECTOR_SIZE 4096 #define BANDS_PER_SECTOR (SECTOR_SIZE/sizeof(int)) int band_size = 128 * 1024 * 1024; /* 128MB */ stru...
C
/********************************************************** * * File : client1_main.c * Author : Cédric HUMBERT & Kilian CONTAMAIN * * Description : * Ce fichier contient le code du programe principal coté * Client du systeme TOMM * * Projet : PSE ISMIN 2A * * Date : 19/ 11/ 2014 * *********************************...
C
#define max(X, Y) (((X) < (Y)) ? (X) : (Y)) extern int yylineno; struct expr_type{ int tip; // int: 0 // char: 1 // bool: 2 // float: 3 float val; }; struct expr_type* create_expr(float n){ struct expr_type *res = (struct expr_type*) malloc(sizeof(struct expr_type)); res->tip = 3...
C
#include <stdio.h> /* Assume name shorter than 20 chars. */ int main() { char name[20]; puts("Enter name: "); scanf("%19s", name); printf("Hello, %s.\n\n\tNice to see you.\n", name); puts("Enter name: "); scanf("%19s", name); printf("Hello, %s.\n\n\tNice to see you.\n", name); ch...
C
#include <stdio.h> #include <mpi.h> int main(int argc, char *argv[]) { int n = 10 ; int a[10]; int b[2]; int i; int rank; int size; MPI_Init(&argc,&argv); MPI_Comm_rank(MPI_COMM_WORLD,&rank); MPI_Comm_size(MPI_COMM_WORLD,&size); b[0]=b[1]=ra...
C
#include<stdio.h> int main() { printf("int:%d\nchar:%d\nDouble:%d\nFloat:%d\n", sizeof(int), sizeof(char), sizeof(double), sizeof(float)); return 0; }
C
#include<stdio.h> int sum(int,int); int sub(int,int); int mul(int,int); int div(int,int); int mod(int,int); void main() { int a=5,b=2,s1,s2,m,d,m1; s1=sum(a,b); s2=sub(a,b); m=mul(a,b); d=div(a,b); m1=mod(a,b); printf(" %d %d %d %d %d \n", s1,s2,m,d,m1); } int sum(int a, int b) { int ...
C
/** * * Hodaya Koslowsky * Comments are in the header files * */ #include "jobList.h" #include <stdio.h> #include <memory.h> #include <malloc.h> Head *CreateHead() { Head *head = (Head *) malloc(sizeof(Head)); if (head == NULL) { return NULL; } head->first = NULL; head->last = NULL; head->numberOfNodes...
C
#include <stdio.h> #include <stdlib.h> struct Node { int operations; struct Node* left; struct Node* down; struct Node* right; }; typedef struct Node Node; Node* init(int value) { Node* root = (Node*)malloc(sizeof(Node)); root->left = root->down = root->right = NULL; root->operations = va...
C
#include<stdio.h> void push(); void pop(); void peep(); void update(); int main() { int n,a[100],top=0; void push() { printf("\nenter the value to insert"); scanf("%d",&n); top=top+1; a[top]=n; } void pop() { if(top==0) { ...
C
#ifndef __LOGIC_H__ #define __LOGIC_H__ /** * @file * Schnittstelle des Logik-Moduls. * Das Modul kapselt die Programmlogik. * * @author Christopher Blöcker * @author Julius Beckmann */ #include "types.h" #include "object.h" /** Umschaltbare Informationen */ typedef enum { LOGIC_SWITCHABLE_LIGHT0 , LOGIC_SWI...
C
#include "structHeader.h" /** * This tests that the element gets correctly matched to the parameter if traced through a call. * It does this by having two struct elements each accessed in foo and find, where the * element are in opposite order in the argument list in each one. Each has one * null-terminated and on...
C
/* Escribe un programa con un menú que defina las siguientes funciones y emita los resultados, la dimensión del vector será de 10 (elementos): a) Cargar m elementos de un vector por teclado. Deberá considerar que no podrá superar el máximo de elementos de vector: void cargar(int vect[], int unNum); b) Leer elementos de...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> int main(){ int N; int A, B; int jogadorA, jogadorB; while(1){ scanf("%d", &N); if(N == 0) break; jogadorA = 0; jogadorB = 0; while(N>0){ scanf("%d", &A); scanf("%d", &B); if(A > B) jogadorA++; else if(B > A...
C
#include <stdio.h> #include <stdlib.h> void main() { int num1, num2, soma; printf("Informe o primeiro numero\n"); scanf("%d", &num1); printf("Informe o segundo numero\n"); scanf("%d", &num2); soma=num1+num2; if (soma>10) { printf("A soma dos valores e: %d",soma); } }
C
#include <stdio.h> #include <stdlib.h> #include<string.h>> int main(int argc, char *argv[]) { char a[300],b[300]; int ans=0,s=0,j,l,i,k=0,z; gets (a); l=strlen(a); if (a[1]=='}') { printf("0"); ans=1; } if (ans==0) { ans=1; b[0]=a[1]; s=1; ...
C
#include "thread.h" void init_pthread_pool(THREAD_POOL *ts,unsigned int workers,unsigned int maxTaskNum, void *handler){ ts->compartments = Calloc(maxTaskNum,sizeof(void *)); ts->maxTaskNum = maxTaskNum; ts->front = ts->rear = 0; ts->workers = workers; #ifdef __APPLE__ ts->mutex = sem_open(...
C
/* ** builtin_prompt.c for in /home/munoz_d/Bureau/PSU_2015_42sh/src/builtins ** ** Made by David Munoz ** Login <munoz_d@epitech.net> ** ** Started on Wed May 11 02:27:30 2016 David Munoz ** Last update Mon May 23 16:13:44 2016 Lucas */ #include "shell.h" /* ** Custom prompt with the logname and number of lines ...
C
#include <stdio.h> int main() { int obstacles, removes, speed; scanf("%d%d%d", &obstacles, &removes, &speed); /* * (1200 / speed) * (obstacles / removes + 1) + 2 * removes * (obstacles / removes) * (obstacles / removes + 1) / 2 * (1200 / speed) * (obstacles / removes + 1) + obstacles * (obstacles...
C
/* * File: ms5803-14ba.c * Author: Markus Backes * * Created on 8. August 2012 * */ #include "ms5803-14ba.h" void calculateTemperature(CalibrationData CB_DATA, MeasurementData MM_DATA, CalculatedValues *values) { values->dT = MM_DATA.D2 - CB_DATA.C5 * pow(2, 8); values->TEMP = 2000 + ((values->dT * ...
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
/****************************/ /**Ryan Evenstad Homework 1**/ /****************************/ #include <stdlib.h> #include <stdio.h> #include <math.h> int main() { float r=.25, B=2000.0, P, interest, total_interest=0.0, prev_interest; int n=1; printf("Enter monthly payment: "); scanf("%f", &P); w...
C
#include <stdio.h> #include <conio.h> #include <ctype.h> void main(void) { char ch; printf("Entre com algum texto (digite um ponto para sair).\n"); do { ch = getch(); if(islower(ch)) ch = toupper(ch); else ch = tolower(ch); putchar(ch); } while (ch!='.'); }
C
#include <stdlib.h> #include "../CPU.h" #include "minunit.h" CPU cpu; Memory* mem; /* tests the reset functionality of the CPU */ MU_TEST(reset){ /* act */ CPU_reset(&cpu); /* assert */ mu_assert_int_eq(0, cpu.AF); mu_assert_int_eq(0, cpu.A); mu_assert_int_eq(0, cpu.z); mu_assert_int_eq(...
C
#include "Stats.h" /**********************************************************************************/ void Sats_Init(PATRICIA_Stats *S){ S->measure_words = 0 ; S->measure_memory = 0 ; S->measure_comparisons_search = 0 ; S->measure_comparisons_insert.Compare_insert_char = 0 ; S->...
C
//Calculate Sum # include <stdio.h> int prime_Factor(int); int main() { int num , result; printf("Enter Num : "); scanf("%d",&num); result = prime_Factor(num); printf("%d",result); return 0; } int prime_Factor(int num){ int ii; if(num == 1 )return 1; for(int i = 2 ; i <= num ; i++){ if(num%i == 0){ ...
C
/* * An introduction to arrays * Reverse 10 numbers entered by the user */ #include <stdio.h> int main () { // array declaration, 10 integers which are collectively // referred by the variable n int n[10]; // the indexes start from 0 and till (size-1) for (int i = 0; i < 10; i ++) { scanf("%d", &n[i]); }...
C
#include<stdio.h> #include<conio.h> int main() { int num; printf("enter an integer number:"); scanf("%d",&num); if(is power of 2(num)) printf("%d is a number that is the power of 2,"num); else printf("%d is not the power of 2",num); retrun 0; }
C
#include "../../includes/math_functions_float.h" #include "../../includes/verify.h" #include "float_exp.h" int main() { /* REQ-BL-0832 * The exp and expf procedures shall return 1 if the argument x is +-0. */ float x = 0.0f; __VERIFIER_precond_reach(); float res = __ieee754_expf(x); // x is +0, resu...
C
#include <stdio.h> #include <stdlib.h> #include <allegro.h> #define ESPACO_QUADRADO 10 int clicouEmQuadrado(int x, int y, int COORDQuadrado[9],int coordMouse[2],int espacoEntreQuadrados) { int i = 0,p = 0; int achou = 0; //comea como falso while(achou == 0 && p != 8) { if(x > COORDQuadrado[p...
C
#include<stdio.h> void func() { const int a = 10; printf("a = %d\n",a); } int main() { func(); func(); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int main (void) { int fd; int ret; // fd = open ("./truncate_basic.txt", O_WRONLY | O_CREAT | O_TRUNC); fd = creat ("./truncate_basic.txt", S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP); if (fd =...
C
#include <stdlib.h> #include <stdio.h> #include <stdbool.h> #include <stdint.h> /********************************************/ /* Tables for initial and final permutation */ /********************************************/ // initial permutation char IP[64] = { 58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44,...
C
#include <stdio.h> #include <time.h> int main() { time_t rawtime; struct tm* timeinfo; char buf[80]; time(&rawtime); printf("%d\n",(int)rawtime); timeinfo = localtime(&rawtime); //%p is for A.M. or P.M. //%T is ISO 8601 time format(HH:MM:SS) strftime(buf, 80, "%T\n",timeinfo); puts (buf); return 0; }
C
//// ӡ 100-200 ֮ // // // ////#include<stdio.h> ////#include<stdlib.h> //// ////int main() ////{ //// int i = 0; //// int j = 0; //// int count = 0; // //// //// for (i = 100; i <= 200; i++){ //// for (j = 2; j <= i; j++){ //// if (i % j == 0) { //// break; //// } //// } //// //// // j == i ʱ˵С i ܱ i i ///...
C
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int x; double vet1[10], vet2[10], vet3[10]; for (x = 0; x < 10; x++ ){ printf("\n Vetor 1 na posicao %i = ", x + 1); scanf("%d", &vet1[x]); } for (x = 0; x < 10; x++ ){ printf("\n Vetor 2 na posicao %i = ", x + 1); scanf("%d",...
C
#include <stdbool.h> #include <stdlib.h> #include <string.h> char* itoa(int value, char* str, uint8_t base) { int idx_str = 0; int rem; bool isNegative = false; /* Handle 0 explicitely, otherwise empty string is printed for 0 */ if (value == 0) { str[idx_str++] = '0'; str[idx...
C
#include <stdio.h> int main() { int T; scanf("%d", &T); for(int i = 0; i < T; i++) { char question[80]; int sum = 0, score = 1; scanf("%s", question); for(int j = 0; question[j] != 0; j++) { if(question[j] == 'O') { ...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> void main() { int A[25]; // int R[25]; // srand(time(NULL)); for (int i = 0; i < 25; i++) { //scanf("%d", &A[i]); A[i] = (rand() % 10) + 10; R[i] = 1; } for (int i = 0; i < 25; i++) { for (int j = 0; j < 25; j++) { if (i == j)continue; i...
C
#include <stdio.h> int mul(int a, int b); int main(void){ int x, y, z; x = 10; y = 20; z = mul(x, y); /* 1 */ printf("%d", mul(x,y)); /* 2 */ mul(x, y); /* 3 */ return 0; } int mul(int a, int b){ return a*b; }
C
/*string de caracteres em linguagem c elas nao existem, por isso é uma convenção entre os programadores. É um grupo de bytes terminado em um byte de valor 0(zero)*/ #include <stdio.h> int main(void) { char str[] = "lol"; str[0] = 'p'; /*char *str; str = "lol"; /*str[0] = 'p'; /*Segmentation fault (core dumpe...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <math.h> int freq[26]; char inp[250]; int main() { #ifndef ONLINE_JUDGE freopen("11577.inp", "r", stdin); #endif int n, i, m; char c; scanf("%d", &n); while(n--) { scanf(" %[^\n]", inp); me...
C
#include "holberton.h" /** * _strpbrk - searches a string for any set of bytes * @s: string to be searched * @accept: string to search for * Return: pointer to search */ char *_strpbrk(char *s, char *accept) { char *t = s, *acc2 = accept; int alen = 0; if (!s || !accept) return (0); while (*t) { while (*...
C
#include "include/robot/test/arm.h" Stepper armStepper(200, ARM_STEPPER_1, ARM_STEPPER_2, ARM_STEPPER_3, ARM_STEPPER_4); Servo primaryServo, secondaryServo, grabberServo; bool primary_enabled = true, secondary_enabled = false, grabber_enabled = false; void setup() { Serial.begin(9600); armStepper.setSpeed(50); ...
C
#include<stdio.h> #include<stdbool.h> #include<math.h> typedef long long int ll; ll totient[1000001]; ll val[1000001]; void sieve() { int i,j; ll x; for(i=0;i<=1000000;i++)totient[i]=i; for(i=2;i<=1000000;i++) { if(totient[i]==i) { for(j=2*i;j<=1000000;j+=i) { totient[j]-=totient[j]/i; } } } f...
C
#include <stdio.h> #include <stdlib.h> #include "mylib.h" #include "bst.h" void print_key(char *s){ printf("%s\n", s); } int main(void){ bst b = bst_new(); char word[256]; while (1==scanf("%255s", word)){ b = bst_insert(b, word); printf("%d %s\n", bst_search(b, word),word); } ...
C
#include"AppController.h" #include<time.h> #include<stdio.h> #define MIN_TEST_SIZE 1000 #define NUMBER_OF_TESTS 5 #define INTERVAL_SIZE 1000 struct _AppController { int* _testData; }; AppController* AppController_new(void) { AppController* _this = NewObject(AppController); return _this; } void AppController_run(A...
C
/** * Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area. */ int largestRectangleArea(char* heights, int heightsSize) { if (heightsSize == 0) return 0; int area, maxarea = 0; int* stack = (int*)malloc(sizeof(int) * (heightsSize + 1)); ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* process.c :+: :+: :+: ...
C
#include <stdio.h> #include <string.h> int main() { char * strings[32]; int index = 0; //char string[] = "Geia sas. Me lene Petro kai thelw na me paroun stin Microsoft!"; char string[] = "Γειά σας. Με λένε Πέτρο και θέλω να δουλέψω στην Microsoft!"; char * stringp = strtok(string," "); while...
C
#include <stdio.h> #include <stdlib.h> int main() { int a; a=89; printf("%d\n",a%2); return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strtrim.c :+: :+: :+: ...
C
/************************************************************************* > File Name: src/2035.c > Author: Js > Created Time: 2016年03月22日 星期二 19时09分16秒 ************************************************************************/ #include<stdio.h> int main() { int a, b; while (scanf("%d%d", &a, &b) != EOF...
C
/* ** EPITECH PROJECT, 2018 ** MUL_my_rpg_2018 ** File description: ** sword_dir.c */ #include "lib.h" #include "monster.h" #include "link.h" #include "zone.h" int dir_in_angle_range(int ID_dir, double angle, float dir_x) { switch (ID_dir) { case 0: if (angle > 0) return (1); ...
C
#include<stdio.h> int main(){ char x[10]; int i=0,c,s=0; scanf("%s",&x); while(x[i]!='\0'){ i++; } int findVal(int c){ return 91-c; } for(int j=0;j<i;j++){ s=s+(pow(26,i-j-1)*findVal(x[j])); } printf("%d",s); return 0;}
C
/** * @file PWM.C * @brief Funções relacionadas ao PWM * @author Ricardo Estefano Rosa (restefano) * @date 09/08/14 * <p>(C) Copyright <b> WEG CRITICAL POWER </b> - Todos os direitos reservados.</p> * @see http://www.weg.net */ #include <plib/pwm.h> #include <plib/timers.h> #include "PWM.h" #include "PINAGEM.h"...
C
#include <stdio.h> int main (void){ int secondi=0; //SCANSIONE INPUT scanf("%d", &secondi); //CHECK INPUT if (secondi<0){ printf("invalid input\n"); return 0; } //CALCOLO & STAMPA ORE, MINUTI E SECONDI printf("%d h ", secondi/3600); secondi-= 3600*(secondi/3600); printf("%d min ", secondi/60); ...
C
/* Set a real-time scheduling policy, then drop privileges and exec a program. * This is intended to be a setuid binary. To minimise the attack surface, it * does not take any command-line arguments, and is hard-coded to set the * policy to SCHED_RR with priority 1. */ #include <unistd.h> #include <sys/types.h> #i...
C
#include <stdio.h> #include "LPC17xx.H" /* LPC17xx definitions */ #include "Serial.h" /* 1. Store the Question, correct answer and wrong answer all as individual arrays e.g. uint8_t questions[] = "......" */ /* 2. write a...
C
/* ** utils.c ** ** This holds some utilities to allocate memory, and other stuff. ** */ #include <stdio.h> #include <math.h> #include <stdlib.h> #include <errno.h> #include "utils.h" #include "R.h" /* Required for Microsoft? */ #include <stddef.h> extern void dsort_ (double *vector, long *length, long *flag);...
C
#include "holberton.h" #include <stdio.h> #include <stdlib.h> /** * main - program that prints its name, followed by a new line * * @argc: argument count for main * @argv: vector to the arguments * * Return: void */ int main(int argc, char **argv) { if (argc >= 1) printf("%s\n", argv[0]); return (0); }
C
#include "timeds.h" #include "p24FJ64GA002.h" #include "tick.h" /****************************************************************** ʱѾADתˣת󽫵õݽһһУٽд ÷ֻҪADgetDataͿˡ ******************************************************************/ #include "common.h" BYTE Second; BYTE Minute; BYTE Hour; BYTE ...
C
/* ************************************************************************** */ /* */ /* :::::::: */ /* ft_read_connections.c :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> //para exit(1) #include <conio.h> //para funcion getche() #define ARCH ".\\bin.dat" #define ESC 27 /*LECTURA-ESCRITURA DE ARCHIVOS BINARIOS que tiene datos*/ /*wb = lecto/escritura. Si no existe->Crea. Si Existe->Pisa rb = lectura. Posicin al comienzo. ab = Si no existe->Crea...
C
#include <stdio.h> #include <stdlib.h> #define MAX 3 int main(){ float salario[MAX], soma_salario, soma_filhos, maiorSalario, mediaSalario, mediaNfilhos, porcentagemacima1000; int i, n_filhos[MAX], cont1000; maiorSalario=0; //Vou arbritar um valor inicial para fazer comparacao i=1; cont1000=0; soma...
C
#include "syscall.h" static inline unsigned strlen(const char * s) { unsigned i; for (i = 0; s[i] != '\0'; i++); return i; } int main() { char * filename = "A.txt"; char * filecontent = "Hola Mundo"; Create(filename); OpenFileId o = Open(filename); Write(filecontent, strlen(fileco...
C
#include<stdio.h> #include<math.h> int main(){ float a, b, c, d, t, tich, tbc; printf("Nhap so thuc thu nhat: "); scanf("%f", &a); printf("Nhap so thuc thu hai: "); scanf("%f", &b); printf("Nhap so thuc thu ba: "); scanf("%f", &c); printf("Nhap so thuc thu bon: "); scanf("%f", &d); t = a + b + c + d; tic...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #define SIZE 1024 int main(int argc,char * argv[]) { char buff[SIZE]; int len,ret,c; /* while((c = fgetc(stdin)) != EOF){ if((c = fputc(c,stdout)) == EOF){ perror("fputc"); } } exit(0); */ while((len = read(STDIN_FILENO,buff,...
C
/* ** my_strncmp.c for my_strncmp in /Users/Abrahxas/ETNA/Piscine-C/day4/quegui_v/my_strncmp ** ** Made by QUEGUINER Vincent ** Login <quegui_v@etna-alternance.net> ** ** Started on Fri Mar 28 17:06:31 2014 QUEGUINER Vincent ** Last update Sat Mar 29 09:44:53 2014 QUEGUINER Vincent */ int my_strncmp(char *s1, char ...
C
/* ** get_next_line.c for get_next_line in /home/heurta_s/rendu/after_pool/B2/prepare/dante ** ** Made by Stanislav HEURTAULT ** Login <heurta_s@epitech.net> ** ** Started on Tue May 10 13:56:10 2016 Stanislav HEURTAULT ** Last update Wed Jun 8 10:55:22 2016 mathis rousselot */ #include <stdlib.h> #include <stdio....
C
#include<stdio.h> int main() { int *p,*q,a,b; printf("Two numbers: "); scanf("%d%d",&a,&b); p=&a; q=&b; printf("Sum= %d",*p+*q); return 0; }
C
Find the kth largest factor of a number N. Eg: input: 36(N) 2(k) output: 18 explaination: factors of 36: 1, 2, 3, 4, 6, 9,12, 18, 36 2nd largest factor is : 18 //method 1 #include<stdio.h> int main() { int n,count=0,factor,k,total; scanf("%d,%d",&n,&k); for(factor=n;facotr>=1;factor--) { if(n%factor=...
C
#include <stdio.h> #ifndef COLLATZ void collatz(int n) { if((n % 2) == 0) { #ifndef PRINTNUMBER printf("%d -> ", n); #endif collatz(n / 2); } else if (n != 1) { #ifndef PRINTNUMBER printf("%d -> ", n); #endif collatz(n * 3 + 1); ...
C
#include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <assert.h> #define N_THREADS 5 void *printMessage(void *arg) { int i; for (i = 0; i < 100; i += 1) { printf("This is a message from thread %ld\n", (long)arg); } printf("Thread %ld finished\n", (long)arg); pthread_e...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX 128 typedef struct { char* nome; float notas[4], media; } Aluno; int load(char fileName[], Aluno* alunos[], int* qAlunos); int fRelat(char fileName[], Aluno* alunos[], int qAlunos, int relatType); int calc(Aluno* alunos[], int qAlunos); int lib...
C
#include <linux/init.h> #include <linux/printk.h> #include <linux/module.h> #include <linux/device.h> #include <linux/fs.h> #include <linux/cdev.h> MODULE_LICENSE("GPL"); MODULE_AUTHOR("Ramy Lerner"); MODULE_DESCRIPTION("My own null/dev"); MODULE_VERSION("0.1.2"); const int MINOR_COUNT = 1; static dev_t first_dev; s...
C
#include <stdio.h> #include <string.h> void func(char *str) { char buffer[24]; int *ret; strcpy(buffer,str); } int main(int argc, char **argv) { int x; x = 0; func(argv[1]); x = 1; printf("x is 1\n"); printf("x is 0\n"); }
C
#include <stdio.h> #include <stdlib.h> #include <float.h> #include <math.h> unsigned long long debug_count = 0; typedef struct { double x; double y; } point; double distance(point a, point b) { double dx = a.x-b.x; double dy = a.y-b.y; return sqrt(dx*dx+dy*dy); } double route_distance(point*p, ...
C
#include <stdio.h> #include <stdlib.h> #include "funcoes.h" int main() { int num; do { printf("Que tabuada deseja ver\n"); scanf("%d",&num); printf("\n"); }while((num < 1) ||(num > 10)); tabuada(num); return 0; }