language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <math.h> int testaForte(int n); int calculaForte(int i); int fatorial(int i); int soma = 0; int main(){ int i; scanf("%d", &i); calculaForte(i); if(testaForte(i)){ printf("SIM"); }else{ printf("NAO"); } return 0; } int calculaForte(int i){ int j; int contaDigi...
C
#include <stdio.h> #include <Windows.h> int main(){ int num1, num2; double dnum=3.12; num1=1; num2=2; printf("%d %d %f\n", num1, num2, dnum); printf("%%\n"); printf("\"\n"); //PC̃{[グĂs printf("\a\a\a\n"); printf("abcde"); Sleep(1000); printf("\b"); Sleep(500); printf("\b"); Sleep(500); printf("\b"); ...
C
/** * This module serves to tile and compute the feed forward * results for a convolutional neural network. * * The eventual goal of this is to offload the low level * computations to the FPGA. * * Once we can do this reliably, we want to expose a higher * level API such that the performance gains of the feed- ...
C
#include<iostream> using namespace std; int sum(int a, int b) { int s = a+b; return s; } int main() { int x, y; cin>>x>>y; int sum = sum(x, y); cout<<sum; }
C
#include "MO445.h" #include <stdio.h> #include <dirent.h> #include <string.h> struct S_image{ char name[1024]; Image *img; }; struct S_features{ char name_query[1024]; double *distances; char **result_names; }; int partition (struct S_features arr, int low, int high) { double pivot = arr.distances[high]; int...
C
/* Functions that operate on Containers and their contents */ #ifndef CONTAINER_H #define CONTAINER_H #include "types.h" /* Create new node_containers from existing node_containers. Map: node_container -> node_container Inputs: Screen - for current Space offsetting Container - start wi...
C
/* SYNOPSIS Solution for exercise 63-05. REQUIREMENT Modify the program in Listing 63-9 (self_pipe.c) to use poll() instead of select(). SOLUTION Copy source file from "tlpi/altio/self_pipe.c" to "tlpi/altio/self_pipe_63-5.c" and add executable to "tlpi/altio/Makefile". Modify new sour...
C
/* INVOKE.exe COMn (Transmit MSP430 BSL invoke pattern on DTR and RTS) This program was written in C for the LCC-Win32 compiler. */ #include <stdio.h> #include <conio.h> #include <mmsystem.h> /* Must also add winmm.lib to the Link. */ int comport = 0; int filearg = 0; int filele...
C
/* Periodic Timer with interrupt*/ #include "TM4C123.h" // Device header #define BLUE (1U<<2) #define RED (1U<<1) //Prototypes void timer1_1Hz_init(void); void timer2_10Hz_init(void); int main(void){ SYSCTL->RCGCGPIO |= 0x20; //enable clock on GPIOF GPIOF->DIR |= BLUE | RED; //enable output ...
C
/* * * config.c * */ #include <unistd.h> #include <stdlib.h> #include "ex_alarm.h" #include "config.h" #include "utils.h" #include "log.h" #define CF_STR_EMAIL "email" #define CF_STR_EMAIL_SMTP "smtp_server" #define CF_STR_EMAIL_SMTP_PORT "smtp_port" #define CF_STR_EMAIL_FROM "from" #define CF_STR_EMAIL_NAME "n...
C
/***************************************************************************//** * @file * @brief A wrapper for the Ember minimalistic implementation of printf() * to call standard printf() format specifiers. This saves space if * the application wants to use the standard printf(), since there is no * point...
C
#include <stdio.h> void quicksort(int left, int right); int array[200], n; int main (void) { int n, i, array[200]; printf("Please define the length:\n"); scanf("%d", &n); printf("%d", n); for (i = 0; i <n; i++) { printf("continue!"); scanf("%d", &array[i]); } printf("i go...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_lstmap.c :+: :+: :+: ...
C
/* Write a function setbits(x,p,n,y) that returns x with the n bits that begin at position p set to the rightmost n bits of y, leaving the other bits unchanged. Example input: x=10011101 (157), p=4, n=3, y=10010101 (149) Example output: 10010101 (149) */ #include <stdio.h> #include <assert.h> unsigned setbits(unsig...
C
#include <stdio.h> #include <stdlib.h> /* Algorithm: * 1. Flip all the bits on the right side of the rightmost 0 in x. * 2. Flip rightmost 0 in x. * 3. Return x (because now x has become x + 1) */ int add_one_func(int x) { int one = 1; /* The precedence of != is higher then bitwise &. Thus, we put (x & on...
C
//hex presentation of all the custom chars unsigned char halfBar[8] = { 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03 }; unsigned char cTwo[8] = { 0x00, 0x00, 0x09, 0x15, 0x13, 0x00, 0x00, 0x00 }; unsigned char cFour[8] = { 0x00, 0x00, 0x1...
C
#include "calcom.h" int main() { int s=0 ; while(s != 4) { printf("1=add\n"); printf("2=subtract\n"); printf("3=multiply\n"); printf("4=divide\n"); printf("select operation: "); scanf("%d", &s); switch(s) { case 1: printf("Input a and b\n"); s...
C
/* [문제 - 블랙잭] 카지노에서 제일 인기 있는 게임 블랙잭의 규칙은 상당히 쉽다. 카드의 합이 21을 넘지 않는 한도 내에서, 카드의 합을 최대한 크게 만드는 게임이다. 블랙잭은 카지노마다 다양한 규정이 있다. 한국 최고의 블랙잭 고수 김정인은 새로운 블랙잭 규칙을 만들어 상근, 창영이와 게임하려고 한다. 김정인 버전의 블랙잭에서 각 카드에는 양의 정수가 쓰여 있다. 그 다음, 딜러는 N장의 카드를 모두 숫자가 보이도록 바닥에 놓는다. 그런 후에 딜러는 숫자 M을 크게 외친다. 이제 플레이어는 제한된 시간 안에 N장의 카드 중에서 3장의 카드를 골라야 한다....
C
#define CTEST_MAIN #include <ctest.h> #include <sort.h> CTEST(sort, sort_2_words) { char **words = (char **)malloc(sizeof(char *) * 3); words[0] = "hello"; words[1] = "again"; words[2] = NULL; sortWords(words); ASSERT_EQUAL(strcmp(words[0], "again"), 0); ASSERT_EQUAL(strcmp(words[1], "hello"), 0); A...
C
#include <stdio.h> #include "point.h" int main(){ /* Kamus */ POINT p1, p2; float gx, gy, arc; /* Algoritma */ printf("Hello Guys, selamat datang di program point \n"); printf("\nMasukkan nilai absis dan ordinat point pertama: "); BacaPOINT(&p1); printf("\nMasukkan nilai absis dan ordin...
C
#include<stdio.h> void judjement(int x); int main() { int a; printf("请输入要判断的整数:"); scanf("%d",&a); judjement(a); return 0; } void judjement(int x) { int i; if(x<=2) printf("%d是素数。\n",x); else for(i=2;i<x;i++) { if((x%i)==0) break; } if(i==x) printf("%d是素数。\n",x); else printf("%d不是素数...
C
#include "snake.h" #include "GLCD.h" #include "stdint.h" #include "stddef.h" #include "stm32f10x_cl.h" #include "core_cm3.h" #include "system_stm32f10x_cl.h" #include "cmsis_os.h" #include "RTX_CM_lib.h" void createSnake(Snake *snake) { snake->x = 5; snake->y = 5; snake->direction = 1; snake->tailSize = 5; } void...
C
include<stdio.h> //This header defines various functions for performing input output operations #include<fcntl.h> //Used to define arguments for open ,close functions #include<unistd.h> //This header file is for misscelaneous functions declaration #include<termios.h> // It contains the definitions...
C
#include "../../includes/minirt.h" static double min(double a, double b) { if (a > b) return (b); return (a); } static double *get_coeff_light(t_light *light, t_params *obj, t_cam *cam, t_scene *scene) { double *coeff_light; double local_intensity; coeff_light = ft_calloc(sizeof(double), 3); while (light)...
C
#include <stdint.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <getopt.h> #include <fcntl.h> #include <sys/ioctl.h> #include <linux/types.h> #include <linux/spi/spidev.h> #include <string.h> #include <errno.h> #include "bulldog.h" #include "bulldogSpi.h" int spiOpen(char* busDevice, int mode, ...
C
//Write a program to demo of datatype in c #include<stdio.h> #include<conio.h> main(){ int a; float b; double c; char h; clrscr(); printf("enter char"); scanf("%c",&h); printf("%c",h); printf("\nenter integer number"); scanf("%d",&a); printf("\ninteger=%d",a); printf("\nenter float number"); scanf("%f",&b); printf("\nf...
C
/* struct operation */ struct str1 { int i; char c; }; struct str2 { int *i; char *c; struct str3 { int *i; char *c; } st; }; struct str3 { /* error, redeclaration of struct str3 */ int *i; char *c; }; int main(void) { int i1; char c1; struct str1 st1; struct str2 st2; struct str1 *pst1; struc...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <jni.h> #include "JNITest.h" char *data; int allocated = 0; JNIEXPORT void JNICALL Java_JNITest_freeMemory(JNIEnv *env, jobject obj) { if(allocated) { free(data); allocated = 0; } } JNIEXPORT jint JNICALL Java_JNITest_allocateAndFillMemory(JN...
C
#ifndef LIBFT_H # define LIBFT_H # include <stdlib.h> # include <unistd.h> # include <stdint.h> enum { TRUE = 1, MAX_RANK = 1000000000, }; typedef struct s_list { unsigned long value; struct s_list *next; struct s_list *prev; } t_list; size_t ft_strlen(const char *s); char *ft_strchr(const char *s, int c);...
C
#include "_stdio.h" #include "epdk.h" #undef ioctl // 豸ԭ int ioctl(FILE *stream, int request, int aux, void *pBuffer) { return eLIBs_fioctrl((ES_FILE *)stream, request, aux, pBuffer); } #include "direct.h" int mkdir(const char *dp) { return (int)eLIBs_mkdir(dp); } int rmdir(const char *dp) { return (int)eLIBs_...
C
#include <stdio.h> int main() { int i; int arr[10]; for (i=0;i<10;i++) arr[i]=i; for (i=0;i<10;i++) printf(" arr[%d] = %d \n",i,arr[i]); return 0; }
C
/*Pg no 51 Aim : to find a given character is an arithmatic operator or not*/ #include <stdio.h> int main(){ char ch; scanf("%c",&ch); switch(ch){ case '+': case '-': case '*': case '/': case '%': printf("%c is an arithmatic operator",ch); brea...
C
#include<stdio.h> #include<stdlib.h> #include"Ex2TAED.h" #define MAX 10 int main(){ int i=0,r,f; Lista *p; p=cria_lista(); imprime_lista(p); do{ int q,v; printf("\nDeseja adicionar ordenadamente um elemento na sua lista?\n1-Yes\n2-No\n\n"); scanf("%d",&v); if(v==1){ ...
C
#include "time.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <unistd.h> #include <limits.h> #include <math.h> #include <sys/stat.h> //Zachary Snyder project 4 main file. //Initiates both parts of the program. #define LEN 100 typedef struct Data{ int days; ...
C
/* Kullancnn girdii 25 tane tam saydan en kucuk ve en buyuk sayilari bulan program kullanici -500000 ile 500000 arasi deger girecektir. */ #include<stdio.h> int main(){ int i,a,eb,ek; //eb=enbuyuk ek=enkucuk eb=-500000; ek=500000; for(i=1;i<=25;i++){ printf("sayi gir: "); scanf("%d",&a); if(a>eb){ eb=...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "wolf3d.h" int find_pos(char c, char *str) { int i; i = 0; while (str[i] != '\0') { if (str[i] == c) return (i); i = i + 1; } return (-1); } int my_getnbr_base(char *str, char *base) { int result; int len_base; int...
C
#include <stdlib.h> #include <stdio.h> #include <time.h> void losowanie(int *od, int *doo) { for(; od<doo; od++) { *od=rand()%100+1; } } void wyswietl(int *od, int *doo) { for(; od<doo; od++) { printf("%d\n", *od); } } void wyswietlPosortowana(int **od, int **doo) { for(; ...
C
// Set pointer to videobuffer char *video = (char*)0xB8000; int main() { // Set string char *hello = "Hello World"; for(video+=4000; video !=(char*)0xB8000; video--) { *video=0; } while(*video) { *video=*hello; video++; *video = 0x07; video++; hello++; } while(1); ret...
C
#include <stdio.h> #include <setjmp.h> #include <stdint.h> #include "the_worst.c" jmp_buf buf; // Returns 0 on success, non-zero otherwise int32_t the_worst_wrapper(callback_t* callback) { printf("[the_worst_wrapper]: enter\n"); switch (setjmp(buf)) { case 0: the_worst(callback); break; case 42: print...
C
#include "console_control.h" #include "ui.h" #include "slot.h" int slot(void) { int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0; int count = 0; int n= 0; int flag; char slot[size][10] = { "int", "long", "long long", "float", "double", "char", "string" }; char ch; int i = 0; int sc = 100; srand((unsigned)tim...
C
#include <linux/init.h> #include <linux/module.h> #include <linux/device.h> #include <linux/kernel.h> #include <linux/fs.h> #include<linux/slab.h> #include <asm/uaccess.h> #include <linux/sched.h> #define DEVICE_NAME "process_list" #define CLASS_NAME "proc" ...
C
/********************************* * Jordan Mai, jmai12 * 2020 Spring CSE101 PA5 * Dictionary ADT ********************************/ #include "Dictionary.h" #include <assert.h> #include <stdbool.h> #include <stdlib.h> #include <string.h> typedef struct NodeObj { char *key; int value; struct NodeObj *left; ...
C
/* The MIT License (MIT) Copyright (c) 2015 Mike Taghavi (mitghi) <mitghi@me.com> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to u...
C
//求两个整数之和。 //解题思路,设置三个变量a和b用来存放两个整数,sum用来存放和数。用赋值运算符“=”把想加的结果传送给sum。 # include <stdio.h> //这是编译预处理指令 int main() //定义主函数 { //函数开始 int a,b,sum; //本行是程序的声明部分,定义a,b,sum为整形变量 a = 123; //对变量a赋值 b = 456; //对变量b赋值 sum = a + b; //进行a加b的运算,并把结果存放在变量sum中 printf("sum is %d\n",sum); //输出结果 return 0; //使函数返...
C
/* --------------------------------------------------------------------------- ** This software is in the public domain, furnished "as is", without technical ** support, and with no warranty, express or implied, as to its usefulness for ** any purpose. ** ** ioisr.c ** ** Beschrijving: ISR on PORTD demonstrattion ** ...
C
/* Name:Vafaee, Ashkan UT EID : av28837 Section : 16320 EE312 - Assignment 5 */ // Node for Queue typedef struct q_node { long data; struct q_node* next; } q_node; typedef struct queue { int size; q_node* head; q_node* tail; } queue; /** * Allocates memory for an empt...
C
/*++ Module Name: serv1.c. Abstract: This module implements the server side of the TCP connec -tion required for the "Content preserving server" . Revision History: Date : Sep 26 2012. Author : Unmesh Joshi (S-2515965). : Koustubha Bhat (S-2516144). VUnetID : uji300 : kbt350 Desc : Created. Ow...
C
#include "SerialPort.h" #include "Utility.h" static SERIALMANAGER gs_stSerialManager; void kInitializeSerialPort(void){ WORD wPortBase; kInitializeMutex( &(gs_stSerialManager.stMutex)); wPortBase = SERIAL_PORT_COM1; // 인터럽트 비활성화 kOutPortByte(wPortBase+SERIAL_PORT_INDEX_INTERRUPTENABLE, 0); // 통신 속도를 115200 ...
C
#include <stdio.h> #include <stdlib.h> /* There is no suggested solution for part i * (the registry command line) of this exercise. * * For a similar example, have a look at the * 'gull' program (gull/cli.c) * * The below code demonstrates an "object oriented" * coding style in C, based on struct pointers. ...
C
/** * @file engine.h * @author Arthur Bouvier (a.bouvier) * @brief Main Engine * @course GAM100F18 * Copyright 2018 DigiPen (USA) Corporation * @addtogroup Util * @{ */ #pragma once #include <stdbool.h> #include <C_Processing.h> #include "gamelayer.h" typedef bool (*CollCheckFunc)(Component...
C
#include "stdafx.h" /*************************************************************************************/ // Funkcja wczytuje dane obrazu zapisanego w formacie TGA w pliku o nazwie // FileName, alokuje pami i zwraca wskanik (pBits) do bufora w ktrym // umieszczone s dane. // Ponadto udostpnia szeroko (ImWidth), ...
C
/** * *cap_string - capitalises every first letter of words in a string * @s: string to capitalise * * Return: capitalized string */ char *cap_string(char *s) { int i; for (i = 0; s[i] != '\0'; i++) { /*Account for first character*/ if (s[0] >= 97 && s[0] <= 122) s[0] = s[0] - 32; /* Check for s...
C
/* * common.c - contains common functions used in 'solve.c' and 'create.c' * * Andrew Truong, Mark Gitau, Jeff Gitahi, Ryan Wu, CS50 Spring 2020 */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <stdbool.h> #include <ctype.h> #define n 9 /************copy() - makes a copy of a grid**********...
C
#include<stdio.h> #include<stdlib.h> #include<time.h> #define FMIN 180 /*numero minimo di figurine*/ #define FMAX 220 /*numero massimo di figurine*/ #define FPMIN 4 /*numero minimo di figurine per pacchetto*/ #define FPMAX 7 /*numero massimo di figurine per pacchetto*/ #define SCAMBISI 1 #define SCAMBINO 2 int getI...
C
//Circular LinkedList /*Includes*/ #include <stdio.h> #include <stdlib.h> /*Node*/ struct Node{ int data; struct Node* next; }; /*This function traverses the linkedlist*/ void printlist(struct Node* n){ struct Node* temp= n; if(n!=NULL) { do{ printf("%d ",n->data); n=n->next; } while...
C
/* This file is part of the reduma package. Copyright (C) * 1988, 1989, 1992, 1993 University of Kiel. You may copy, * distribute, and modify it freely as long as you preserve this copyright * and permission notice. */ /*****************************************************************************/ /* MODUL z...
C
#include <avr/io.h> #include <util/delay.h> #include "i2c.h" #include "ds3231.h" #include "clock.h" uint8_t ClockInit() { // initialize i2c bus I2cInit(); uint8_t temp = 0; if(!DS3231Read(0x00,&temp)){return 0;} if(!DS3231Write(0x00,temp)){return 0;} // set 24 hour mode if(!DS3231Read(0x02,&temp))...
C
/* * Title : Console Program Basic Square Calculators(MenghitungLuasPersegi.c) * Program Description : Calculate Wide of Square Using Arithmetic Multiplication between Length and Wide Input from Keyboard * Author : Muhammad Hasbi, S.T. * Interface : Console * IDE ...
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
#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <pthread.h> #include <semaphore.h> #define BUFFER_SIZE 5 void *producer(void *arg); void *consumer(void *arg); sem_t bin_sem; sem_t empty; sem_t full; int idx=0; int items[BUFFER_SIZE]; int main() { int res; pthread_t a_threa...
C
#include <pthread.h> #include <stdio.h> #include <stdlib.h> #define NTHREADS 4 /* Variaveis globais */ int x = 0; pthread_mutex_t x_mutex, final_mutex; pthread_cond_t x_cond, final_cond; /* Thread A */ void *A (void *t) { printf("Seja bem vindo!\n"); pthread_mutex_lock(&x_mutex); x++; if (x==1) { pri...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* julia.c :+: :+: :+: ...
C
#include <stdio.h> char *set_arr(char *arr, int n); int main(void) { int num; printf("Please input array members:"); scanf("%d", &num); char ch; while (scanf("%c", &ch)) if (ch == '\n') break; else continue; char ar[num]; printf("Please input source string:"); set_arr(ar, num); int i = 0; printf("...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> /** 1. */ /** * 24 * 8 = 192 octets. * **/ /** 2. */ /** ... */ /** 3. */ /** ... */ int main() { short tab_entiers[] = {10, 20, 40, 70, 44, 21, 90, 999, 10, 20, 32}; void *tab; int val; tab = tab_entiers; /...
C
#include <stdio.h> #include <math.h> #include <stdlib.h> #include <string.h> #include <time.h> // serial sparse implementation of pagerank. data1.dat // R(t+1) = d M R(t) + (1-d)/N // d - damp1, N = 4 // damp2 - (1-d)/N // prnew <- R // a <- M // **************Compressed column storage technique**************// // All...
C
int main(int argc, char* argv[]) { int n,i,j,len; scanf("%d",&n); char DNA[256]; for(i=0;i<n;i++){ scanf("%s",DNA); len=strlen(DNA); for(j=0;j<len;j++){ if(DNA[j]=='A') DNA[j]='T'; else if(DNA[j]=='T') DNA[j]='A'; else if(DNA[j]=='C') DNA[j]='G'; else if(DNA[j]=='G...
C
#include "io.h" #include "debug.h" #include "global.h" #include "macros.h" #include "error.h" #include <termios.h> #include <unistd.h> #include <sys/stat.h> #include <fcntl.h> #include <errno.h> #include <sys/ioctl.h> //---------------------------------------------------------------------------- error_t reopenAll (...
C
#include "shared.h" #include "cpu.h" #include "connections.h" t_queue* pQueue; pthread_mutex_t mutex_checkReadyProcesses; void createProcessQueue(){ pQueue = queue_create(); } void pQueueAddProcess(PCBItem* process){ queue_push(pQueue, process); } void pQueueAddProcessFirst(PCBItem* process){ t_queue* tmp = que...
C
#include<stdio.h> int main(void){ double before; int after; printf("数値を入力してください:"); scanf("%lf", &before); after=(int)before; printf("切り捨てを行った後の値は%dです。\n",after); printf("切り捨てを行う前の値は%fです。\n",before); return 0; }
C
#pragma once #include <stdint.h> #include <stddef.h> #include <string.h> #include <stdbool.h> typedef uint32_t bitarray_element; typedef uint64_t bitarray_double_element; typedef struct bitarray { bitarray_element *sequence; size_t length; size_t bitlength; } bitarray; typedef struct bitarray_range { size_t...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> /* Name: Kortney Menefee PID: k4790190 Date: 01/17/19 Assignment Name: MoreFunctions Instructor: R. Leinecker */ // This isn't finished but I did the guessing game and part of the arithmetic game. void showInfo() { printf("Here are your choices:\n"); p...
C
/*题目:取一个整数 a 从右端开始的 4~7 位。 */ /*程序分析:可以这样考虑: */ /*(1)先使 a 右移 4 位。 */ /*(2)设置一个低 4 位全为 1,其余全为 0 的数,可用~(~0<<4)*/ /*(3)将上面二者进行 & 运算。 */ #include <stdio.h> int main() { unsigned a,b,c,...
C
/* * CSE30264: Programming Assignment 2 * Chris Foley (cfoley) * Catherine Markley (cmarkley) * Bailey Blum (bblum1) * * myftp.c (Client) * * This is our client for our PA02 TCP assignment. The client begins by establishing a connection * to the already-running server. It then accepts operations from the user ...
C
#include <stdio.h> #include <stdlib.h> void main(void) { FILE* fPointer = NULL; fPointer = fopen("123", "w"); fprintf(fPointer, "test message\n"); fclose(fPointer); return; }
C
/*************************************************************************//** * @file fifo.c * * Simple FIFO handling * ****************************************************************************/ #include <stdio.h> #include <malloc.h> #include "fifo.h" /****************************************************...
C
/* ** my_realloc_all.c for tekadventure in /home/dubret_v/delivery/semestre2/infographie/tekadventure ** ** Made by dubret_v ** Login <victor.dubret@epitech.eu> ** ** Started on Thu May 25 15:52:31 2017 dubret_v ** Last update Sat May 27 16:53:39 2017 Victor Dubret */ #include <stdlib.h> #include "tekadventure.h"...
C
#include<stdio.h> int main() { int n,m; scanf("%d%d",&n,&m); int num1=0,num0=0; int i; for (i=1;i<=n;i++) { int k; scanf("%d",&k); if (k==1){num1++;} else {num0++;} } int minnum; if (num1<num0) {minnum=2*num1;} else {minnum=2*num0;} for (i=...
C
#ifndef SV_MERGEITER_H_ #define SV_MERGEITER_H_ /* * sham database * sphia.org * * Copyright (c) Dmitry Simonenko * BSD License */ /* * Merge serveral sorted streams into one. * Track duplicates. * * Merger does not recognize duplicates from * a single stream, assumed that they are tracked * by the incomin...
C
#include <stdio.h> int main(void) { int n,d,sum=0; printf("enter the number:\n"); scanf("%d",&n); while(n!=0) { d=n%10; sum=sum+d; n=n/10; } printf("the sum is %d",sum); return 0; }
C
/* ex2.c * * date: 2011-11-30 * author: wwq0327 <wwq0327@gmail.com> */ #include <stdio.h> void chline(char, int, int); int main() { chline('#', 5, 20); return 0; } void chline(char ch, int i, int j) { int m, n; for (m = 0; m < i; m++) { for (n = 0; n < j; n++) putchar(ch); putchar('\n'); } putcha...
C
#include <stdio.h> int main() { char x; int n=0,k=0; while((x=getchar())!='#') { switch(x){ case 't':k++;break; case 'h':if(k==1)k++;break; case 'e':if(k==2)k++;break; default:k=0; } if(k==3) n++; } printf("%d\n",n); return 0; }
C
/* * $Id$ * * Copyright (c) 2003-2004 Peter Bex and Vincent Driessen * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright ...
C
/*! thanks to C0t0d0s0 for this function */ byte inttostr(int n, char* s){ int order=10; if(n<order){ *(s++)=n+'0'; return 1; } byte len=2; while((len<5)&&(n>=10*order)){ order*=10; len++; } while(order){ byte digit=(n/order); *(s++)=digit+'0'; n-=digit*order; order/=10; ...
C
/*********************************************************/ /* Author : Mohamed sayed */ /* Date : 13 ‎September 2020 */ /* Version : V01 */ /*********************************************************/ #include "Std_types.h" #include "BIT_MATH.h" #include "GPIO_interface.h" #include "G...
C
#include "helper.h" /* Macros ------------------------------------------------------------------- */ /* Private Functions -------------------------------------------------------- */ /* Global Variables --------------------------------------------------------- */ /* Function Definitions ---------------------...
C
// Idea: Iterate on base 11 using the extra digit as the asterisk. #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_SIEVE (1234567) char sieve[MAX_SIEVE]; void fill_sieve() { int i, j; memset(sieve, 0, sizeof(sieve)); sieve[0] = sieve[1] = 1; for (i = 2; i < MAX_SIEVE; i++) if (!si...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* md5.c :+: :+: :+: ...
C
#include "CreatePopulation.h" #include "ExamStruct.h" #include "PaperListConvertion.h" #include "Random.h" #include "printfStructs.h" #include <stdio.h> Table *getPopulation(Paper *papersArr[], int size, int maxPeopleInSession, int populationNum){ Table *tabArr, arr[size]; LinkedList *pList; int i; for( i ...
C
#include "libmx.h" unsigned long mx_hex_to_nbr (const char *hex) { unsigned long nbr = 0; char byte = 0; if (!hex) return 0; while (*hex) { byte = *hex++; if (byte >= '0' && byte <= '9') byte = byte - '0'; else if (byte >= 'a' && byte <= 'f') by...
C
#include <stdio.h> #include <stdlib.h> struct ListNode { int val; struct ListNode *next; }; struct ListNode* addTwoNumbers(struct ListNode* l1, struct ListNode* l2) { unsigned long long n1=0,n2=0,nresult,nresult2; int nn; int p=1; struct ListNode* p1=l1; struct ListNode* p2=l2; struct ...
C
#include<stdio.h> #include<math.h> main() { int demandrate,setupcost,hcpipt,sqrt; float EOQ,TBO; printf("Enter the values of demandrate,setupcost,hcpipt"); scanf("%d %d %d",&demandrate,&setupcost,&hcpipt); EOQ=sqrt(2*demandrate*setupcost/hcpipt); TBO=sqrt(2*setupcost/demandrate*hcpipt); printf("EOQ i...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "options.h" #include "decrypt.h" #include "help.h" char *arg1 = "", *arg2 = "", *arg3 = ""; void define_mode(int argc, char const *argv[], int *mode) { if (argc > 1) { if (strcmp(argv[1],"-d") == 0) { if (argc > 2) { if (strcmp(argv[2],"-c...
C
/** Filename: map_driver.c (driver of map.h) Description: ADT Map dengan menggunakan matriks.h **/ #include "boolean.h" #include "map.h" #include <stdio.h> #include "command.h" int main() { /* KAMUS */ int X, Y; POINT P; /* MakeMATRIKS */ printf("Ukuran map : "); scanf("%d %d", &X, &Y); MakeEmptyMap(X, Y); Ma...
C
// // Created by weihs on 28/04/2021. // #include <stdio.h> #include <stdlib.h> #include <omp.h> #include <time.h> void exclusive_prefix(const int32_t* arr, int32_t* ret, long length) { for (int i = 1; i < length; i++) { ret[i] = ret[i - 1] + arr[i - 1]; } } int main(int argc, char* argv[]) { if(...
C
/* Project 2 for COMP30023: Computer Systems * at the University of Melbourne * Semester 1, 2017 * by: Ammar Ahmed */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <pthread.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h>...
C
#include "stdio.h" #include "stdlib.h" #define AND 2 #define OR 3 #define NOT 4 #define TRUE 1 #define FALSE 0 #define VAR 5 typedef struct node *treePointer; struct node { int value; int data; treePointer left, right; }; treePointer CreatTree(int value, int data, treePointer *father) { treePointer NewTr...
C
/* * dmaz - dumps an xtank maze out to a terminal. */ /* Return values for description loading */ #define DESC_LOADED 0 #define DESC_SAVED 1 #define DESC_NOT_FOUND 2 #define DESC_BAD_FORMAT 3 #define DESC_NO_ROOM 4 #define GRID_HEIGHT 30 #define GRID_WIDTH 30 #define MAZE_HEIGHT 26 #define MAZE_WIDTH 26 #de...
C
#include <stdio.h> #include <math.h> double fract(double input) { double fractorial = 1; for(int i = 1; i <= input; i++) fractorial *= i; return fractorial; } int main() { double ex = 0; int x = 0; scanf("%d", &x); for(int i = 1; i < 200; i++) { ex += (pow(x, i) / frac...
C
#include "details.h" #include <stdio.h> int main(void) { printf("This program sorts entered integers into even and odd types" " and calculates their totals.\n"); printf("Please enter integers to be analyzed(0 to quit):\n"); int n; int odd = 0; int even = 0; float total_even = 0; float total_odd ...
C
#include <string.h> #include <errno.h> #include <stdbool.h> #include "mf_malloc.h" #include "mfdef.h" #include "log.h" #include "bug.h" #include "skiplist.h" #include "chunk.h" #include "map.h" #define HASHTABLE_SIZE 1024 static inline uint16_t hash(const hkey_t *key) { return key->idx % HASHTABLE_SIZE; } typed...