language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <stdlib.h> int main() { float peso,estatura,imc,edad; char nombre[30]; printf("Nombre="); scanf("%s",&nombre); printf("Ingrese su edad="); scanf ("%f",&edad); printf("Ingrese el peso="); scanf ("%f",&peso); printf("Ingrese su estatura="); scanf ("%f",&estatura); imc...
C
// cgen1.c -- code generator // inside of block #include <stdio.h> #include <stdlib.h> #include "type.h" #include "token.h" #include "ast.h" #include "loc.h" #include "sym.h" #include "code.h" static AST ast_root; static int code_root; static int cgen_blocks(AST); static int cgen_block(AST, int, int); static int cgen...
C
#include <stdio.h> double integral(double (*f)(double x), double a, double b) { double sum, dt; int i; sum = 0.0; dt = (b - a) / 100.0; for(i = 0; i < 100; i++) sum += (*f)(i * dt +a) * dt; printf("A soma atual e %f\n", sum); return sum; } double square(double x) { //prin...
C
#include <stdio.h> #include "Bytecode.h" #include "CPFSGT.h" #include "CException.h" //default = file register //default = access bank // ACCESS = -5, // BANKED, // F, // W //input fileaddress,access/bank /** * * Function Name : cpfsgt * Input : Bytecode * Output : code.absoluteAddress * Destroy : null * * ...
C
#include <stdio.h> #include <stdlib.h> #include <errno.h> #include <sys/socket.h> #include <arpa/inet.h> #include <string.h> int main() { char *advice[] = { "食べる量を減らしなさい\r\n", "タイトなジーンズにしなさい。太って見えることはありません。\r\n", "一言:不適切\r\n", "今日だけは正直になりなさい。「本当に」思っていることを上司に言いなさい\r\n", "そのヘアスタイルは考え直した方がいいでしょう\r\n...
C
#include <stdio.h> void printMenu(); void handleMenuChoice(int menuChoice); unsigned long calculateFactorial(int number); int main() { int menuChoice = 0; do { printMenu(); scanf("%d", &menuChoice); handleMenuChoice(menuChoice); }while(menuChoice != 0); return 0; } void printMenu() { ...
C
/* -----------------------Binary Search------------------------- User first inputs the key or 'value' as a command line argument. Then, user inputs length of array he/she would like to make. User inputs array values/elements. The program then uses binary search to look through the array and find out whether the key/v...
C
#pragma once #include <string.h> typedef struct { char *buffer; size_t read_pos; size_t write_pos; size_t size; } ringbuffer_t; ringbuffer_t *ringbuffer_create(size_t size); size_t ringbuffer_read(ringbuffer_t *rb, void *buff, size_t count); size_t ringbuffer_space(ringbuffer_t *rb); size_t ringbuffer_unr...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* update_heatmap.c :+: :+: :+: ...
C
##### CGAffineTransform 简要认识 CGAffineTransform 是一个用于处理形变的类,其可以改变控件的平移、缩放、旋转等,其坐标系统采用的是二维坐标系(平面),即向右为x轴正方向,向下为y轴正方向。 1. 平移:实现以初始位置为基准,在x轴方向上平移x单位,在y轴方向上平移y单位。 ``` CGAffineTransformMakeTranslation(CGFloat tx, CGFloat ty) ``` 2. 缩放:实现以初始位置为基准,在x轴方向上缩放x倍,在y轴方向上缩放y倍。 ``` CGAffineTransformMakeScale(CGFloat sx, CGFloat sy...
C
#include <stdio.h> #include "get_line.h" #define MAXLINE 120 size_t trim_line(char line[], size_t len) { while (line[--len] == ' ' || line[len] == '\t' || line[len] == '\n') { if (len == 0) { return 0; } else { line[len] = '\0'; } } line[++len] = '\n'; ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* libfw.h :+: :+: :+: ...
C
#include"MyHeader.h" ////////////////////////////////////////////////////////////////////////////////////// // Function Name: SumRange // Description: Accepts two numbers and returns the sum between the range. // Input: int[IN] // Output: int[OUT] // Author: Vinayak Mahendra Patil ////////////////////////////////...
C
#include <stdio.h> #include <string.h> void reverse_str(char * str, int start, int end){ while (start<end){ char temp = *(str+start); *(str+start) = *(str+end); *(str+end) = temp; start++; end--; } } int main(){ char str[100]; fgets(str,sizeof(str-1),stdin); ...
C
/* ***************************************************************************************************************** * Name: Pointers - Triple Linear, One Level * * Version: 2.0 ...
C
/* ** EPITECH PROJECT, 2019 ** CPE_lemin_2018 ** File description: ** parse_rooms */ #include "lemin.h" #include "struct.h" int check_name_coord(char *str, int x, int y, parse_t *parse) { for (int i = 0; parse->rooms[i + 1].name != NULL; i++) { if (my_strcomp(str, parse->rooms[i].name) == 1) r...
C
#ifndef SPI_EEPROM_H #define SPI_EEPROM_H ////////////////////////////////////////////////////////////// //INCLUDES ////////////////////////////////////////////////////////////// #include "SPI.h" #include "General.h" ////////////////////////////////////////////////////////////// //DEFINES ///////////////...
C
/* ** my_putchar.c for my_putchar in /home/melvyn/etna/projet/covind_m/libmy_01/lib ** ** Made by COVINDARASSOU Melvyn ** Login <covind_m@etna-alternance.net> ** ** Started on Sat Oct 21 16:03:00 2017 COVINDARASSOU Melvyn ** Last update Sat Oct 21 16:03:41 2017 COVINDARASSOU Melvyn */ #include <unistd.h> void my...
C
#include <pwd.h> #include <grp.h> #include <net/if.h> #include <sys/ioctl.h> #include <sys/syslog.h> #include <stdarg.h> #include <errno.h> #include <stdio.h> #include <fcntl.h> #include <unistd.h> #include <string.h> #include <time.h> #include <sys/types.h> #include <sys/stat.h> #include <dirent.h> #include <errno.h> ...
C
#include <stdio.h> #include <stdlib.h> int isPrime(int n) { int r; if (n) for (r=2; r*r<n; r++) { if (n%r == 0) return 0; } return 1; } /********************* 에라토스테네스의 체 *********************/ int *eratos(int n) { int i,j; int* primeArray = malloc(sizeof(int) * (n+1)); if (n < 2) return NULL; ...
C
#include "pas.h" size_t ft_strlen(const char *str) { int i; i = 0; while (str[i] != '\0') i++; return (i); } void ft_putchar(char c) { write(1, &c, 1); } void ft_putstr(const char *s) { size_t i; i = 0; if (s) { while (i < ft_strlen(s)) { ft_putchar(s[i]); i++; ...
C
#include<stdio.h> int main (){ float S = 1.0; int y = 0; float x[99]; float z[99]; x[0]=3; z[0]=2; while(x[y] <= 39){ S = S +(x[y] / z[y]); z[y+1] = z[y] * 2; x[y+1] = x[y] + 2; //printf("%.2f || %.2f = %.2f\n", x[y],z[y],S); y++; } printf("%.2f\n", S); return 0; }
C
/* 3. Ler duas matrizes A e B, de duas dimenses, sendo a matriz A de 5X4 (5 linhas e 4 colunas) e a matriz B de 4X3 (quatro linhas e trs colunas). Apresentar a matriz C como resultado da multiplicao das matrizes A e B. Condio para multiplicao: o nmero de colunas de A tem que ser igual ao nmero de linhas de B. */ #inclu...
C
#include <stdio.h> #include <stdlib.h> int main() { int num = 76; printf("%f \n", floor(36.667)); printf("%f \n", 5 + 4.5); printf("%f \n", 5 * 4.5); printf("%f \n", 5 / 4.5); printf("%d \n", 5 + 4.5); printf("%d \n", 5 * 4.5); printf("%d \n", 5 / 4.5); printf("%f \n", ceil(36.9875...
C
#include <stdio.h> /** * main - This program prints the alphabet ignoring the q and e characters. * * Return: 0. */ int main(void) { char d; for (d = 'a'; d <= 'z'; d++) { if (d != 'q' && d != 'e') putchar (d); } putchar('\n'); return (0); }
C
#include <stdio.h> int main(void) { int num, result, cnt = 0, val1 = 0, val2 = 1; printf("3̻ Է : "); scanf_s("%d", &num); while (num < 3) { printf("3̻ Է : "); scanf_s("%d", &num); } while (cnt != num) { result = val2; val2 += val1; val1 = result; cnt++; } printf("%d\n", result); return 0; }
C
/* * @Author: HuangYuhui * @Date: 2019-02-09 09:20:12 * @Last Modified by: HuangYuhui * @Last Modified time: 2019-02-09 10:51:47 */ /* * ٩(๑>◡<๑)۶ * * 程序设计题 * * 请编写函数'fun',该函数的功能是 : 求出二维数组周边的元素之和,作为函数值返回.二维数组中的值在主函数中赋予. */ #include <conio.h> #include <stdio.h> #include <stdlib.h> #define M 4 #define N...
C
/** @file Implementacja klasy wielomianów rzadkich wielu zmiennych @authors Michał Molas <mm429570@students.mimuw.edu.pl> @copyright Uniwersytet Warszawski @date 2021 */ #include "poly.h" #include "calc.h" #include "poly_lib.h" #include <assert.h> #include <stdbool.h> #include <stdlib.h> void PolyDestroy(P...
C
#include <stdlib.h> #include <stdbool.h> #include <stddef.h> #define HEAP_SIZE 2048 struct mem_block { size_t size; // size in number of mem_blocks union { struct mem_block* pPrev; // used in free mem_block int payload; // used to get paiload pointer in allocated mem_block }; struc...
C
#include<stdio.h> #include<stdlib.h> #include<math.h> #define MAXSIZE 101 void Sort(int [],int); void Swap(int *,int *); void main(void) { int list[MAXSIZE]; int n,i; printf("Enter the number of integers : "); scanf("%d",&n); if(n < 1 || n > MAXSIZE) { fprintf(stderr,"Error input!\n"); exit(EXIT_FAILURE);...
C
#define _SVID_SOURCE #define _BSD_SOURCE #define _XOPEN_SOURCE 500 #define _XOPEN_SORUCE 600 #define _XOPEN_SORUCE 600 #include <semaphore.h> #include <pthread.h> #include <fcntl.h> #include <sys/shm.h> #include <sys/stat.h> #include <sys/mman.h> #include <sys/types.h> #include <stdlib.h> #include <unistd.h> #include ...
C
#include <stdio.h> int main() { int L=0; printf("Enter the level of loudness:\n"); scanf("%d", &L); if(L<=50) { printf("Quiet"); } else if(L>=70) { printf("Intrusive"); } else if(L>=80) { printf("Annoying"); } else if (L>=90) { printf("Very Annoying"); } else { pri...
C
#include<stdio.h> #define max 20 void parentheses_checker(char a[]); char check(char ch); void push(char item); char pop(); int isempty(); int isfull(); char stack[max]; int top=-1; int main() { int n,i; char a[20]; printf("enter the expression\n"); scanf("%s",a); parentheses_checker(a); return 0...
C
// // main.c // 求因子 // // Created by 邱兆丰 on 15/11/11. // Copyright (c) 2015年 邱兆丰. All rights reserved. // #include <stdio.h> int main() { int n, i; scanf("%d", &n); while (n != 1) { for (i = 2; i <= n; i++) { if (n % i == 0 ) { printf("%d ", i); n = n / i; ...
C
//Geraldo Martinez //gm979351 /* This file contains all the necessary functions to compute and setup necessary measures for the assembler. The file includes four functions named initialize_table, opcode_number_lookup,LC_value_lookup, and opFormat_lookup */ //Below are the necessary files and libraries needed for this...
C
#include <stdio.h> #include <time.h> #include <sys/time.h> int isPrime(int num) { int i = 0; if(i == 1) { return 1; } for( i = 2; i * i <= num ; i++) { if( num % i == 0 ) { return 1; } } return 0; } int main() { int startp, endp, i = 2;...
C
#include "library.h" char str[MAX_SIZE]; /* Prints the information of the token regarding its type */ char* category_print(alpha_token_t *head) { int i=0; switch(head->category){ case ENUMERATED: strcpy(str, head->data); while(str[i]){ str[i] = (toupper(str[i])); i++; } return str; c...
C
/*====================================================================== PRDTRACED() Process "display data trace settings" command. ======================================================================*/ #include "qepcad.h" void PRDTRACED() { Step1: /* Process. */ SWRITE("--------------...
C
#include <stdio.h> #include <stdlib.h> static inline unsigned long long *xchg_64(void *ptr, unsigned long long x) { __asm__ __volatile__ ( "xchgq %0,%1" :"=r"((unsigned long long) x) :"m" (*(volatile long long *) ptr), "0" (x) :"memory" ); return(x); } int main(int argc, char *argv[]) { unsigned long lon...
C
#include <stdio.h> #include <stdlib.h> int main(){ float pmt,roi,sint; int tm; printf("Enter the principal amount, time and rate of interest"); scanf("%f%d%f", &pmt,&tm,&roi); sint=(pmt * tm * roi)/100; printf("Simple Interest = %.2f", sint); }
C
#include <ctype.h> #include <kernel/kernel.h> #include <kernel/klog.h> #include <kernel/asm/misc.h> #include "boot.h" #include "console.h" #include "panic.h" #include "cpu/idt.h" #include "cpu/isr.h" #include "ps2.h" #include "irq.h" #include "kb.h" #include "vga.h" static int on_key_event(const struct kb_key *key) ...
C
#include "../include/complete.h" #include "../include/shell.h" #include "../include/tree.h" #include "../include/utils.h" /** * @brief Checks if file located at specified path is executable * * @param path * @param file_name * @return true * @return false */ bool check_if_executable(char *path, char *file_...
C
#include <stdio.h> #include <conio.h> #include <graphics.h> int xMin, yMin, xMax, yMax, x1, y1, x2, y2; int areaCode1[4], areaCode2[4], andArr[4]; void setAreaCode() { int i; for(i=0; i<4; i++) { areaCode1[i]=0; areaCode2[i]=0; } if(x1<xMin) { areaCode1[3]=1; } else if(x1>x...
C
#include <stdint.h> #include "lps25h.h" #include "twi_master.h" #define PRESS_ADDRESS 0xB8 #define REF_P_XL 0x08 #define REF_P_L 0x09 #define REF_P_H 0x0A #define RES_CONF 0x10 #define CTRL_REG1 0x20 #define CTRL_REG2 0x21 #define CTRL_REG3 0x22 #define CTRL_REG4 0x23 #define INT_CFG 0x...
C
#include <assert.h> #include <stdio.h> #include <zmq.h> #include "pal.h" int main(void) { void *context; void *subscriber; char buffer[MAX_MESSAGE_LEN]; context = zmq_ctx_new(); subscriber = zmq_socket(context, ZMQ_SUB); assert(!zmq_connect(subscriber, "tcp://localhost:5556")); assert(!zmq_setsockopt(subscrib...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* env.c :+: :+: :+: ...
C
/*===========================================================================*/ /* SEED reader | parse_type53 | station header */ /*===========================================================================*/ /* Name: parse_type53 Purpose: parse a response (poles and zeroes) (type 53...
C
#include <stm32f10x.h> #include "button.h" #include "display.h" #define BUTTON_GPIO GPIOG #define BUTTON_GPIO_CLK RCC_APB2Periph_GPIOG #define BUTTON_VCC_PIN GPIO_Pin_6 #define BUTTON_GND_PIN GPIO_Pin_7 #define BUTTON1_PIN GPIO_Pin_3 #define BUTTON2_PIN GPIO_Pin_4 #define BUTTON3_PIN GPIO_Pin_...
C
/* * This file implements Lagrange's algorithm for reduction of a lattice * basis in dimension 2 (optimized). It is used for signature verification * in do255s (curve do255e instead uses the curve endomorphism to achieve * a similar optimization with lower overhead). This implementation is * for architectures with...
C
#include <pthread.h> #include <stdlib.h> #include <stdio.h> #include <sys/time.h> // Función de intersección, recorre el array A y para cada // posicion, recorre el array B, si ambas son iguales incrementa // sumIntersection. Para acabar, devuelve sumIntersection, que es // la cantidad de numeros repetidos en ambos ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> int main() { double a , b , c , tri , cic , tra , qua , ret , pi=3.14159; scanf("%lf %lf %lf" , &a , &b , &c); tri = (a * c) /2; cic = pi * (c*c); tra = ((a + b) * c / 2); qua = b*b; ret = a * b; printf("TRIANGULO: %.3f\...
C
#include<idt.h> struct idt_entry { unsigned short base_lo; unsigned short sel; unsigned char always0; unsigned char flags; unsigned short base_hi; } __attribute__((packed)); struct idt_ptr { unsigned short limit; unsigned int base; } __attribute__((packed)); struct idt_entry idt[256]; str...
C
#include<stdio.h> #include<conio.h> void main() { int n1,n2,n3; clrscr(); printf("Enter 3 numbers= "); scanf("%d,%d,%d", &n1,&n2,&n3); if(n1>=n2 && n1>=n3) printf("%d is the largest",n1); else if(n2>=n1 && n2>=n3) printf("%d is the largest",n2); else printf("%d is the largest",n3); getch(); }
C
/* ************************************************************************** */ /* */ /* :::::::: */ /* ps_find_median.c :+: :+: ...
C
#include "hisho_buddy_test.h" #include "hisho_buddy.h" void test_hisho_buddy() { // Recreate https://en.wikipedia.org/wiki/Buddy_memory_allocation#Example printf("[%s] Starting tests.\n", __FUNCTION__); printf("2: Program A requests memory 34 K\n"); void *a = hisho_buddy__alloc(34); hisho_buddy__...
C
#include <stdio.h> int main(){ long long int num; scanf("%lld", &num); if(num%2 == 0) printf("%lld\n", (num+2)); else printf("%lld\n", (num+1)); return 0; }
C
#include "kernel/types.h" #include "kernel/stat.h" #include "user/user.h" void func(int); int main(int argc, char *argv[]) { // create pipe int fds[2]; if (pipe(fds) != 0) { printf("pipe() failed\n"); exit(1); } // fork child process int pid; pid = fork(); if (pid > 0) { close(fds[0...
C
#include "holberton.h" /** *_isupper - Entry point *@c:charater *Return: if is lower or upper return 1 else 0 */ int _isupper(int c) { if (c >= 'A' && c <= 'Z') return (1); else return (0); }
C
#include <stdio.h> #include <stdlib.h> typedef int t_htbl_key; typedef int t_htbl_val; typedef size_t (*t_htbl_hash)(t_htbl_key); int hash_func(t_htbl_key key) { int m=20000; return (key % m); } typedef struct t_htbl_open_rec { char flag; t_htbl_key key; t_htbl_val val; } t_htbl_open_rec; typede...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <ctype.h> #include <hashtable.h> #include "ATM.h" /* * ~ ATM ~ * * Matheus Carvalho Raimundo * mcarvalhor@usp.br * _______ _______ _______ * | | | \ * | | | \ |___| * | | \ | | * ...
C
bool isHappy(int n){ int i,j,sum=0; while(sum!=1 && sum!=4) { sum=0; while(n>0) { j=n%10; sum+=(j*j); n=n/10; } n=sum; } if(sum==1) return true; else return false; }
C
#include<stdio.h> int main() { int a[101],x,n,t,i,k,sum; scanf("%d",&t); while(t--) { sum=0; scanf("%d%d",&n,&x); for(i=0;i<n;i++) { scanf("%d",&a[i]); sum=sum+a[i]; } if(sum%x==0) printf("%d\n",sum/x); else { k=sum%x; for(i=0;i<n;i++) if(k>=a[i]) { printf("-1\n"); g...
C
/**< *6_10_uygulama.c *Bu program C dilinde: Bir Uygulamaya veya portala giriş simülasyonudur. *Mobil banka uygulamasını simüle eder ve içerisinde ki sistemeGiris fonksiyonu *sisteme giriş için kullanılır. islemler fonksiyonu menüyü temsil eder ve sifreYenileme fonksiyonu *en son 3 şifreyle aynı olmayan 6 basamaklı bi...
C
#include "Stack.h" Boolean isEmpty(StackNode *pTop) { Boolean empty = FALSE; if(pTop == NULL) { empty = TRUE; } return empty; } void push(StackNode **pTop, double data) { StackNode *pMem = (StackNode*)malloc(sizeof(StackNode)); pMem->data = data; pMem->pNext = NULL; if(isEmpty(*pTop)) { *pTop = pMem; ...
C
#include <stdio.h> #include <stdlib.h> typedef struct No{ int chave; struct No *proximo; } No; No *CriarFilaEnc(){ No *v = malloc (sizeof (No)); v->proximo = NULL; return v; } No *FrontEncadeada(No *v){ return v->proximo; } void EnfileirarEncadeada(No *v, int x){ No *u = malloc (sizeof...
C
#include<stdio.h> #include<math.h> main() { float x,y,z,a; printf("-1<=cos(x)<=1\n\n"); printf("Enter cos inverse value : "); scanf("%f",&x); y=acos(x); a=180*7; a=a/22; z=y*a; printf("\ncos inverse(%.2f) = %.2f degree",x,ceil(z)); printf("\n%.2f degree = %.2f radian",z,y); }
C
//viet chuong trinh tinh chu vi va dien tich hinh tron #include <stdio.h> void main() { float R, dtich, chuVi; printf("nhap vao ban kinh hinh tron R\n"); scanf("%f",&R); dtich=R*R*3.14; chuVi=2*R*3.14; printf("dien tich hinh tron la: %0.2f\n", dtich); printf("chu vi hinh tron la:%0.2f", chuV...
C
// To compile: // $ gcc -o keyboard_emulator_reader keyboard_emulator_reader.c -lnfc #include <stdlib.h> #include <string.h> #include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <errno.h> #include <linux/input.h> #include <linux/uinput.h> #include <nfc/nfc.h> static void print_hex(const uint8_t *pbtDat...
C
/* * * File Name server.c * Date 2018/03/27 * OS Ubuntu 16.04 64 bits * Author Hong Soonwoo * Student ID 2014722023 * * Title #2-3 Server program * Description Wait for connection from client. * Call fork() when connection is e...
C
/************************************************************************* > File Name: signal.c > Author: jianghechao > Mail: 591378033@qq.com > Created Time: Mon 05 May 2014 11:14:07 PM CST ************************************************************************/ #include<stdio.h> #include"apue.h" #include<sig...
C
/** * \file skeleton.c * \brief Basic parsing options skeleton. * \author Pierre L. <pierre1.leroy@orange.com> * \version 0.1 * \date 10 septembre 2016 * * Basic parsing options skeleton exemple c file. */ #include<stdio.h> #include<stdlib.h> #include<string.h> #include<errno.h> #include <getopt.h> #include <s...
C
#include "holberton.h" /** * print_to_98 - Prints all numbers to 98 regardless of start * @n: the starting number * Return: Null */ void print_to_98(int n) { while (n <= 98) { _printNum(n); if (n != 98) { _putchar(','); _putchar(' '); } n++; } _putchar('\n'); }
C
#include <std.h> inherit ARMOUR; int uses; void create() { ::create(); set_name("%^BOLD%^%^CYAN%^Amulet of %^BLACK%^Concealment%^RESET%^"); set_short("%^RESET%^%^CYAN%^Clouded Amulet%^RESET%^"); set_id( ({"amulet", "clouded amulet", "dark amulet"}) ); set_long( "This amulet, slightly %^RES...
C
/* This code is written by SeungHwi Son Student e-mail : sosa2007@g.skku.edu */ #include <stdio.h> int main(){ float CurrencyConversion(float AmountInWon, float rate) { float result = AmountInWon * rate; return result; } float won; int number; float dollar; float euro; float yen; float rmb; prin...
C
void axpy(double*z, double*x, double *y, double a,int n) { for (int i=0;i<n;i++) z[i]=a*x[i]+y[i]; }
C
#include <avr/io.h> #define TIME_MS 500 static uint16_t count; void led_init(void) { DDRB |= _BV(DDB5); count = 0; } void led_toggle(void) { count++; if (count >= TIME_MS) { PORTB ^= _BV(PORTB5); count = 0; } }
C
extern void abort (void); typedef struct PgHdr PgHdr; typedef unsigned char u8; struct PgHdr { unsigned int pgno; PgHdr *pNextHash, *pPrevHash; PgHdr *pNextFree, *pPrevFree; PgHdr *pNextAll; u8 inJournal; short int nRef; PgHdr *pDirty, *pPrevDirty; unsigned int notUsed; }; static inline PgHdr *merge_p...
C
#include "stdio.h" #include "mpi.h" int main(int argc, char *argv[]) { int nrow, mcol, i, lastrow, p, root; int Iam, id2D, colID, ndim; int coords1D[2], coords2D[2], dims[2], aij[1], alocal[3]; int belongs[2], periods[2], reorder; MPI_Comm comm2D, commcol; /* Starts MPI processes ... */ MPI_Init(&arg...
C
// Wizard: Shade Maelstorm // Area: Stone Garden // Theme: This is a stone garden, in which basilisks and other stoning // creatures will play. // Monsters: The monsters will include caretakers, guards, gardeners, baby // basilisks, and other smaller insects, as well as some stone statues. #include <std.h> #incl...
C
#include<stdio.h> int binary(int n) { int r, count=0; while(n>0) { r = n%2; if(r==1) count++; n = n/2; } return count; } int main() { int item,z,i,flag=0,n; printf("enter n :"); scanf("%d",&n); item = n; for(i=n-1;i>=1;i--) { z = binary(i); if(item == (z+i)) { flag = 1; break; } } if(flag == 1) print...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "LinkedList.h" #include "Articulo.h" #include "Controller.h" #include "Parser.h" #include "utn.h" int parser_ArticuloFromText(FILE *pFile, LinkedList *pListaArticulos) { int retorno = -1; int flag = 0; char bufferId[50]; char bufferArticulo[50]; ...
C
#include <stdio.h> #include <string.h> #include <malloc.h> struct library { int b; int lib_id; int day; int per; int *id; int *scores; int sum; }; typedef struct library libr; libr *item; void swap(libr *a,libr *b) { libr temp; temp=*a; *a=*b; *b=temp; } void swap_num(int *a,int *b) { int temp; temp=*a...
C
#include <time.h> #include "Deck.h" void Build(int* deck) { int i; for (i = 0; i < 52; i++) { deck[i] = i; } } void Shuffle(int *deck) { srand(time(NULL)); for (int i = 0; i < 1000; i++) { int from = rand() % 52; int to = rand() % 52; int ...
C
#include <stdio.h> #include <math.h> int cosas(int c,int r, int n) { int conta; conta =0; for(conta=1;conta<r;conta++) { c=n*(r*(n-r)); } printf("%d", c); } int main() { int c; int r; int n; c=0; r=0; n=0; printf("Introduce primer numero:"); scanf("%d",&r); printf("Introduce segundo numero:"); scanf("%d",...
C
#include "utils.h" #include <stdlib.h> #include <string.h> char *strdup(const char *str) { size_t len = strlen(str) + 1; void *new = malloc(len); if (new == NULL) return NULL; return (char *)memcpy(new, str, len); } void strip_ext(char *filename) { char *end = filename + strlen(filename);...
C
#include <Windows.h> #ifndef _AUTO_FLY_H #define _AUTO_FLY_H #define MAX_X 1536 #define MAX_Y 864 typedef enum _FLY_STATE { FLY_OUT, FLY_HIT, FLY_MOVED, }FLY_STATE; typedef enum _FLY_TYPE { FLY_TYPE_BULLET, FLY_TYPE_ENEMY, FLY_TYPE_MONEY, }FLY_TYPE; typedef struct _AUTO_FLY { FLY_TYP...
C
#include <stdio.h> int main(void) { char str[80]; my_gets(char* str[i]); return 0; } void my_gets(char* ps) // ps ù ° 迭 Ҹ Ų. { char ch; while ((ch = getchar() != '\n')) // Է ڰ ๮ڰ ƴѵ ݺ { *ps = ch; ps++; } *ps = '\0'; }
C
/* * asp.c: * All-pairs shortest path implementation based on Floyd's * algorithms. * * Parallel version. */ #include "sys/time.h" #include "unistd.h" #include "stdio.h" #include "errno.h" #include "stdlib.h" #include "mpi.h" /******************** ASP stuff *************************/ #define MAX_DISTAN...
C
/* ** getinfo.c for in /home/eax/dev/nfc_ex/tisseo ** ** Made by eax ** Login <soules_k@epitech.net> ** ** Started on Sat Jun 7 00:02:55 2014 eax ** Last update Thu Aug 25 02:15:03 2016 eax */ #include <stdlib.h> #include <nfc/nfc.h> #define MAX_FRAME_LEN 300 #include <string.h> #include <sys/types.h> #includ...
C
#include<stdio.h> #include<conio.h> main() { int n=1,i,count; for(n=1;n<=500;n++) { count=0; for(i=1;i<=n;i++) if(n%i==0) count++; if(count==2) printf(" %d",n); } getch(); }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned uint32_t; typedef unsigned size_t; void ubx_frame_received(size_t len, uint8_t *msg) { } void nmea_frame_received(size_t len, uint8_t *msg) { } uint16_t calculate_checksum(uin...
C
#ifndef MESSAGE_H #define MESSAGE_H typedef enum character { PACMAN, MONSTER, BRICK, LEMON, CHERRY, CLEAR, POWER, } character; typedef struct message { int x, y; int id; character type; int color[3]; int score; } message; #endif
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> int main() { int a=5,b=3,c,sqr; c=a+b; if((c==sqr(5))||(c==sqr(3)) { printf("yes"); } else { printf("no"); } }
C
#include <stdio.h> #include <stdlib.h> void main(void) { char ch, ch0, str[6][81], str5[81]; short s[2], s1, s0, i; long l[3], l2, l0; float f[4], f3, f0; double d[5], d4, d0; if((fp=fopen("file7.txt", "w"))==NULL) /* ֻдıļ */ { printf("File can not open!\n"); exit(0); } scanf("%c", &ch); /* Ӽ̶ȡ 1 ַ */ sca...
C
//Program to Print Prime Numbers between 2 Intervals #include<stdio.h> #include<conio.h> void main() { //variable declaration int n,l1,l2,i,flag; clrscr(); //Ask user to enter the limits printf("Enter the lower limit l1 and upper limit l2\n"); scanf("%d%d",&l1,&l2); //display message printf("\...
C
/* * ===================================================================================== * * Filename: dijkstra.c * * Description: Parallelized implementation of dijkstra's algorithm * * Version: 1.0 * Created: 13/06/2019 11:56:58 * Revision: none * Compiler: gcc * ...
C
#include <stdlib.h> #include <string.h> #include <stdio.h> #include "lists.h" /** * add_node - check the code for Holberton School students. * @head: list * @str: strings * Return: Always 0. */ list_t *add_node(list_t **head, const char *str) { int charnum; list_t *new_list = malloc(sizeof(list_t)); if (new_l...
C
/* -*- coding: utf-8 -*- */ /* Copyright 2014 Brno University of Technology Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by appli...
C
#include <time.h> char g_logpath[150]; char *getdate8 (char *buff) { struct tm *tm_now; time_t time_now; static char sbuff[20]; time_now = time (NULL); tm_now = localtime (&time_now); if (buff != NULL) { sprintf (buff, "%04d%02d%02d", tm_now->tm_year + 1900, ...