language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <ctype.h> #include <stdbool.h> #include "terminal_user_input.h" #define YEAR_TRUMP_ELECTED 2016 bool read_boolean(const char* prompt) { my_string answer; bool result; answer = read_string(prompt); answer.str[0] = (char) tolower(answer.str[0]); switch (answer.str[0]) ...
C
#ifndef SFVFS_HEADER_H #define SFVFS_HEADER_H #include "sfvfs/config.h" #include "sfvfs/fsnode.h" #include <stdbool.h> struct sfvfs_header { struct sfvfs_options option; /* 配置记录 */ uint32_t version; /* 版本号 */ uint16_t umask; /* 挂载文件权限掩码 */ uint16_t dmast; /* 挂载目录权限掩码 */ uint64_t block_count; /* b...
C
#include "stdio.h" #define SIZE 10 // Testing shifting functions of asm int main(){ int *testArray = (int*)malloc(sizeof(int)*SIZE); int i; for (i=0; i<SIZE; i++){ *(testArray+i)=i; printf("%d ", testArray[i]); } printf("\n"); int end = testArray+(SIZE); int start = testArray+1; printf("\nChecking shi...
C
// Fill out your copyright notice in the Description page of Project Settings. #pragma once #include "CoreMinimal.h" static FORCEINLINE float FSmoothDamp(float Current, float Target, float& CurrentVelocity, float SmoothTime, float MaxSpeed, float DeltaTime) { if (SmoothTime < 0.0001f) return Target; ...
C
#include <stdio.h> //function prototy[pe int iterative(int n); int recursive(int n); int main() { int result = 0; result = iterative(3); result = recursive(4); printf("result: %d\n",result); return 0; } int iterative(int n) { int total = 0; for (int i = 1; i <= n; ...
C
#ifdef CUT_MODIFIER_C #include <stdio.h> #include <string.h> #include <stdlib.h> #include "parse.h" void test_func(char *str, char *expected, int i) { char *cutted; cutted = cut_modifier(str); printf("%d:[%s] [%s]\n", i, str, expected); if (strcmp(cutted, expected)) printf("error at %d, output was [%s]\n\n", i,...
C
#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdlib.h> #include <string.h> #define MAXSTRING 256 int main() { char c; int connectionFD; int ret; char buffer[MAXSTRING]; connectionFD = clientConnection ("lserv"); if (connectionFD < 0) { perror ("Error es...
C
#include "comm.h" static int commMsgQueue(int flags)//创建或获取消息队列 { key_t key = ftok("/tmp", 0x6666);//0x6666,only 0~255 if(key < 0) { perror("ftok"); return -1; } int msg_id = msgget(key, flags); if(msg_id < 0) { perror("msgget"); } return msg_id; } int crea...
C
///////////////////////////////////////// // LCD configuration //////////////////////////////////////// sbit LCD_RS at RB0_bit; sbit LCD_EN at RB1_bit; sbit LCD_D4 at RB4_bit; sbit LCD_D5 at RB5_bit; sbit LCD_D6 at RB6_bit; sbit LCD_D7 at RB7_bit; sbit LCD_RS_Direction at TRISB0_bit; sbit LCD_EN_Direction at TRISB1_bi...
C
//// fathm_ft.c -- converts 2 fathoms to feet //#include <stdio.h> //int main(void) //{ // int feet, fathoms; // // fathoms = 2; // feet = 6 * fathoms; // printf("There are %d feet in %d fathoms!\n", feet, fathoms); // printf("Yes, I said %d feet!\n", 6 * fathoms); // // return 0; //} // /* qsort ex...
C
#include <stdio.h> #include <stdlib.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char *argv[]) { float custo_esp,preco_bilhete,q_bilhete; printf("Insira o custo do espetaculo teatral:"); scanf("%f",&custo_esp); printf(...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: ...
C
#include<stdio.h> int main() { int i,j,t,temp,n,m,sum; scanf("%d", &t); for(i=1 ; i<=t ; i++){ scanf("%d\n%d", &n,&m); sum=0; if(n>m){ temp=n; n=m; m=temp; } for(j=n ; j<=m ; j++){ if(j%2!=0){ ...
C
#include "holberton.h" /** * set_bit - function that sets the value of a bit to 1 at a given index. * @n: pointer of numbers * @index: index position * * Return: 1 if it worked, or -1 if an error occurred */ int set_bit(unsigned long int *n, unsigned int index) { unsigned int num = 1; if (index > 63) return ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strsplit.c :+: :+: :+: ...
C
#include "AdjacencyList.h" #include "Stack.h" #include<stdio.h> #include<stdlib.h> #include<assert.h> typedef int CostType; static void findDegree(ALGraph *graph,int indegree[]); static CostType *ve = NULL; //the array of earliest occuring time static CostType *vl = NULL; //the array of latest occur time st...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_history.c :+: :+: :+: ...
C
#include <pgmspace.h> #pragma language=extended /* compare unsigned char s1[n], s2[n] */ __x_z int (memcmp_P)(const void *s1, PGM_VOID_P s2, size_t n) { unsigned char uc1, uc2; if (n != 0) do { uc1 = *(*(const unsigned char **)&s1)++; uc2 = *(*(PGM_P*)&s2)++; if (uc1 != uc2) ...
C
/* * color.h - Data structures and function prototypes for coloring algorithm * to determine register allocation. */ #ifndef COLOR_H #define COLOR_H #include "graph.h" #include "liveness.h" struct COL_result { Temp_map coloring; // description of register allocation Temp_tempL...
C
#include<stdio.h> int main() { /* struct point01{ char a; char b; int c; }; */ struct point02 { char a; int b; char c; }; printf("%d\n", sizeof(struct point02)); return 0; }
C
#include<stdio.h> #include<stdlib.h> #define ElemType int #define STATUS int #define ERROR -1 #define SUCCESS 1 #define TRUE 1 #define FALSE 0 /* Դͷѭʾ,ֻһָָβԪؽ ԱдӦÿն,ж϶ǷΪ,Ӻͳ㷨 */ typedef struct { ElemType data; struct LNode *next; }QNode,*QueuePtr; typedef struct { QueuePtr front; QueuePtr rear; }Queue,*LinkQue...
C
#include "lexer.h" #include "filehandler.h" #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> inline void printSequence(const Sequence *seq) { printf("\n"); for (int i = 0; i < seq->count; i++) printf("%s ", seq->tokens[i].value); printf("\n"); } static inline void allo...
C
#include <math.h> #include <stdio.h> int main(){ double a, b, c, root1, root2, delta; printf("Enter value for a, b, c:\n"); scanf("%lf %lf %lf", &a, &b, &c); if (a == 0){ printf("The a variable cannot be zero.\n"); return 1; } delta = b * b - 4 * a * c; if (delta > 0){ ...
C
/* ** EPITECH PROJECT, 2019 ** PSU_my_printf_2019 ** File description: ** my_printf.h */ #include <stdarg.h> #ifndef MY_H_ #define MY_H_ #define BASE_HEXA "0123456789abcdef" #define BASE_HEXA_UPPER_CASE "0123456789ABCDEF" #define BASE_OCTAL "01234567" #define BINARY_BASE "01" int check_number_of_stick_on_line(char ...
C
#include <stdlib.h> void main(){ int sum = 0, n; scanf("%d", &n); for(int i = 1; i <= n; i++){ sum += i; } printf("%d\n", sum); return; }
C
#include <stdio.h> #include <stdlib.h> #define TRUE (1) #define FALSE (0) typedef int Status; /* 二叉树的二叉链表结点结构定义 */ typedef struct BiTNode { int data; struct BiTNode *lchild, *rchild; } BiTNode, *BiTree; /* 顺序查找,a为数组,n为要查找的数组个数,key为要查找的关键字 */ int Sequential_Search(int *a, int n, int key) { int i; for...
C
#include <stdio.h> #include <aSubRecord.h> #include <registryFunction.h> #include <epicsExport.h> #include <string.h> static long profile_value_reverse(aSubRecord *precord) { int lx; int ly; int *x; int *y; // get dimension of camera image data array lx = *(int*) precord->a; ly = *(int*) ...
C
/* JTSK-320111 a3_p6.c Sheikh Usman Ali s.usmanali@jacobs-university.de*/ // Writing charactwers I #include <stdio.h> #include<ctype.h> int main(void) { char line [100]; float x; int n, i; printf("Enter an float x: \n"); fgets (line , sizeof(line), stdin ); sscanf (line , ...
C
// preprocessor directive to support printing to the display #include <stdio.h> void getInfo(float* PTRprice, float* PTRmarkUp, float* PTRtax, float* PTRdiscount); float calcPrice (float price, float markUp, float tax, float discount); // the main program int main(void) { // declare, define, and initialize some ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* options.c :+: :+: :+: ...
C
// #include <mysql.h> // #include <stdio.h> // main() { // fprintf(stderr, "Hello Main\n"); // MYSQL *conn; // MYSQL_RES *res; // MYSQL_ROW row; // char *server = "localhost"; // char *user = "root"; // char *password = "root"; /* set me first */ // char *database = "mysql"; // conn = mysql_...
C
// SPDX-License-Identifier: GPL-2.0 /* * Boot config tool for initrd image */ #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <string.h> #include <errno.h> #include <endian.h> #include <linux/kernel.h> #include <linux/bootconfig.h> ...
C
#include "string_util.h" #include <stdlib.h> #include <string.h> /** * * @param buf * @param buf_len * @param term * @param term_len * @return 0 if buf ends with term, 1 otherwise */ int ends_with(char* buf, int buf_len, char* term, int term_len) { if (buf_len < term_len) { return 0; } int i; int ...
C
#include <stdlib.h> #include <stdio.h> #include "server_lib.h" int portNumber = 8080; char buffer[BUFSIZ]; int keyBuffer[BUFSIZ]; int msgBuffer[BUFSIZ]; int resultBuffer[BUFSIZ]; const char *usage = "Usage: otd_enc_d [port #]\n"; void handleClientEncryption(int clientFd) { int encryptionMode = 1; /* Encryption ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_split.c :+: :+: :+: ...
C
#include <stdlib.h> #include <stdio.h> /* 归并排序 分治的思想 */ void Merge(int sourceArr[],int tempArr[],int startIndex,int midIndex,int endIndex) { int i = startIndex,j=midIndex+1,k = startIndex; while(i!=midIndex+1 && j!=endIndex+1) { if(sourceArr[i]>sourceArr[j]) tempArr[k++] = sourceArr...
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<fcntl.h> #include<unistd.h> #include<dirent.h> int main() { int file; DIR* dp; struct dirent* dir; dp = opendir("."); if(dp) { while(dir = readdir(dp)) { if((file = open(dir->d_name, O_RDONLY)) < 0) {fprintf(stderr, "\nError opening file."); exit(-1);} if(!(lseek(file, 0, S...
C
#include <signal.h> //Signal 사용 헤더파일 #include <unistd.h> #include <stdio.h> #include <string.h> #include <errno.h> #include <stdlib.h> //exit() 사용 헤더파일 #include <wiringPi.h> #define PUMP 21 // BCM_GPIO 5 void sig_handler(int signo); // 마지막 종료 함수 int main (void) { signal(SIGINT, (void *)sig_handler); //시그널 핸들러 함수...
C
// Fazer um programa em C leia o valor do empréstimo (double) e calcule o valor da divida após 6 meses, // com uma taxa de juros de 5% ao mês. #include <stdio.h> #include <math.h> int main() { double empr, juros; scanf("%lf", &empr); if (empr < 0) { printf("O VALOR DO EMPRESTIMO NAO PODE SER N...
C
/* * Author: Piotr Dobrowolski * pd291528@students.mimuw.edu.pl * */ #include <stdio.h> #include "printer.h" #include "board.h" void print_board(struct Board* board) { int i, j; for (i = 0; i < board->height; ++i) { for (j = 0; j < board->width; ++j) { int value = ((int)board->cells[i]...
C
#include two(x) (1 << (x)) int bitrev(n,B) int n, B; { int m, r; for (r=0,m=B-1;m>=0;m--) if ((n >> m) == 1) { r += two(B-1-m); n -= two(m); } return(r); }
C
/* ============================================================================ Name : hello.c Author : Luciano Glielmi Version : 01 Copyright : Your copyright notice Description : Hello World in C, Ansi-style ============================================================================ */ #in...
C
#include <caml/mlvalues.h> #include <stdio.h> #include <stdlib.h> int MAX = 1000000; CAMLprim value caml_sieve_last_prime() { int *numbers = (int *)calloc(MAX, sizeof(int)); numbers[0] = 1; numbers[1] = 1; int number, latest_prime; for (number = 2; number <= MAX; number++) { if (!numbe...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <ctype.h> #pragma warning (disable: 4996) void main() { char entry,productentry; printf("enter your lowercase character \n"); scanf("%c", &entry); printf("your upper case of %c is %c\n", entry, toupper(entry)); system("pause"); }
C
#include <stdio.h> #include "dog.h" #include <stdlib.h> int _strlen(char *s); char *_strdup(char *str); /** * new_dog - a function that creates a new dog. * @name: char pointer to the dog's name * @age: float for dog's age * @owner: char for owner's name * * Return: 0 (success), NULL (failure) */ dog_t *new_dog(...
C
/** * @author f4prime * @email zzz136454872@163.com * @aim a plain model for leetcode */ #include<stdio.h> #include<stdlib.h> #include<string.h> void print_int_star(int *list, int len) { for(int i=0;i<len;i++) printf("%d ",list[i]); putchar('\n'); } void print_int_2star(int **matrix,int row,int c...
C
#include <stdio.h> #include "error.h" #include "hash.h" #include "value.h" #include "gc.h" #include "vm.h" static void tn_list_map (struct tn_vm *vm, int argn) { int i, anynil = 0, pushed = 0; uint8_t gc_on = vm->gc->on; struct tn_value *fn = vm->stack[vm->sp - 1], *ret = &nil, **tail = &ret; struct tn_value **li...
C
/*******************冒泡排序法******************************** * 冒泡排序法的排序规则存在升序和降序两种,本例采用升序方法 * * 本例中,添加了标识符flag,用于判断每轮是否已经将数据排列完成* **************************************************************/ #include <stdio.h> void bubble_sort(int arr[],int n) { int i,j,flag,temp; for(i = 0; i < n-1; i++) { flag = 1; for(j...
C
#define _GNU_SOUCES #include "../lib/allhead.h" #define MAX_ALLOCS 100000 int main(int argc, char *argv[]) { char *ptr[MAX_ALLOCS]; int free_step, free_min, free_max, block_size, num_allocs, i; printf("\n"); if (argc < 3 || strcmp(argv[1], "--help") == 0) usage_err("%s num-allocs block-size [step [min [max]]]...
C
#include "stdio.h" #include <sys/types.h> #include <sys/wait.h> #include <sys/types.h> #include <unistd.h> #include <string.h> int main() { pid_t pid = fork(); if(pid==0) { printf("I say bye before diying \n"); char a[80]; sprintf(a, "%i", pid); execl("/bin/echo", "echo", "this is the child", a , NULL); p...
C
/****************************************************************************** * File Name : fpprint.h * Date First Issued : 08/21/2015 * Board : f103 * Description : Format and print floating pt *******************************************************************************/ /* This is u...
C
#include "knn.h" //find the most frequent class of the bunch int find_most_frequent(uint8_t* neighbours, int num_classes, int k){ int classes[num_classes]; int max = 0; int class; memset((void *)classes, 0, sizeof(int) * num_classes); for(int i =0; i < k; i++){ classes[neighbours[i]] +=1; ...
C
#include <stdio.h> #include <string.h> int FindSameNum(int* tmp, int sz) { if(tmp == NULL || sz == 0) { return -1; } int i = 0; for(; i < sz; ++i) { int cur = tmp[i]; while(tmp[i] != i) { if(tmp[i] == tmp[cur]) { return tmp[i]; } tmp[i] = tmp[cur]; tmp[cur] = cur; ...
C
/* * main.c * Copyright (C) 2018 hzshang <hzshang15@gmail.com> * * Distributed under terms of the MIT license. */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> typedef unsigned int uint; typedef unsigned long long ll; int main(int argc, char *argv[]){ setbuf(stdin,0); setbuf(stdout,0); se...
C
#include "qtree.h" void print_greetings(); int valid_answer(char *answer); void print_friend_list(Node *friends, char *name); int main (int argc, char **argv) { int stop; QNode *root = NULL; char answer[MAX_LINE]; char name[MAX_LINE]; Node * friends = NULL; Node * interests = NULL; if (argc ...
C
#include <math.h> int findFirstElement(double eps) { double a = 1; int n = 0; for (int i = 0; fabs(a) >= eps; ++i) { a = pow(-1, (double)i) * (1 / (((double)i + 1) * ((double)i + 2) * ((double)i + 3))); n = i; if (fabs(a) < eps) break; printf("%.5lf %.d\n", a, n); } return n; }
C
/* * Radix2FFT.c * * Created on: May 16, 2019 * Author: Gusts Kaksis */ #include "Radix2FFT.h" #include <math.h> #define M_2PI 6.283185307179586476925286766559 // 2 * PI #define M_LOG10_2_INV 3.3219280948873623478703194294948 // 1 / Log10(2) void CMult(complex_float_t* dest, complex_float_t* c1, c...
C
/* Design a program that receives two numbers using argv argument and print the following arithmetical operations. add, subtraction, multiplication, dicision */ #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int add, sub, mul; float div, one = atoi(argv[1]), two = atoi(argv[2]); ...
C
#include <stdio.h> #include <string.h> int main(void){ char buff[5]; int pass = 0; printf("\nEntre com a senha: "); fgets(buff,5,stdin); if (strcmp(buff, "1234")) { printf ("\nSenha Errada \n"); } else { printf("\nSenha Correta \n"); pass = 1; } ...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> int main() { srand(time(0)); int number = rand() % 100 + 1; int count = 0; int a = 0; printf("there is a number between 1 and 100: "); do { printf("guess this number: "); scanf("%d", &a); count ++; ...
C
/*Menentukan Bilangan terbesar dari tiga buah bilangan yang diinput dari alat masukan x,y dan z. Dengan asumsi x,y dan z nilainya berbeda. */ #include <stdio.h> int main (){ int x,y,z; printf ("Masukkan nilai x: "); scanf ("%d", &x); printf ("Masukkan nilai y: "); scanf ("%d", &y); printf ("Masukkan n...
C
#include "color_sensor.h" uint16_t color[6] = {0, 0, 0, 0, 0, 0}; //uint16_t blackThreshold[6] = {4000, 3900, 4000, 3500, 3000, 2600}; uint32_t blackThresholdAddress[6] = {0, 1, 2, 3, 4, 5}; uint32_t whiteThresholdAddress[6] = {13, 7, 8, 9, 11, 12}; int blackThreshold[6] = {4000, 4000, 4000, 4000, 4000, 4000}; int whi...
C
#include "nbody.h" #define EQ_TOL 1e-4 #define N_TIME_KEPLER 5000 int main () { int i, j, k, info, nkick = 2; double t[N_TIME_KEPLER], coords_base[12*N_TIME_KEPLER], coords_var[12*N_TIME_KEPLER], mstar = 1.0, mplanet[1] = {1.0e-5}, e[1] = {0....
C
#include "memreg.h" #include "prelude.h" const uint MBLOCK_SIZE = 100; typedef struct MemBlock { uint len; // capacity is fixed, len is how many are filled void** block; // array of pointers to free struct MemBlock* next; // when block is full add a new record } MemBlock; void register_alloc (MemBlock** ...
C
#include <stdlib.h> #include "structs.h" /** * Allocate heap memory for storing a U-LP public key. * @param size_t n - security parameter * @param size_t l - message length * @return ulp_public_key* - pointer to the allocated heap memory */ ulp_public_key* ulp_alloc_public_key(size_t n, size_t l) { ulp_publ...
C
#include <stdio.h> /* 16. Construa um algoritmo que calcule a quantidade de dinheiro gasto por um fumante com cigarros durante n anos. Para isso, necessrio ler a quantidade de cigarros que o fumante fuma por dia, a quantidade de anos que ele fuma e o preo mdio de uma carteira de cigarros. (OBS: Cada carteira de c...
C
#include<stdio.h> #include<stdlib.h> int main() { int i,n,newn,flag=1; printf("enter the value of n "); scanf("%d",&n); for (newn=2;newn<=n/2;newn++) { flag=1; for (i=2;i<=newn/2;i++) { if (newn%i==0) { flag=0; break; ...
C
#include<stdio.h> #include<stdlib.h> main(int n,char **p) { FILE *f1,*f2,*f3; char *buf1=NULL,*buf2=NULL; int size; f1=fopen(p[1],"a"); if(f1==0) printf("error:can't open the file."); f2=fopen(p[2],"r"); if(f2==0) printf("error:can't open the file 2"); fseek(f2,0,2); size=ftell(f2)+1; rewind(f2); buf1=calloc(1,size); f...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strsplit.c :+: :+: :+: ...
C
/* TheHuxley - Problema do Igual ou diferente @mauricio */ #include <stdio.h> int main() { int n1,n2, n3; scanf("%d %d %d", &n1, &n2, &n3); if (n1 == n2 && n2 == n3) //1 (Se todos os números são iguais) printf("\n1"); else if (n1 != n2 && n2 != n3) //2 (Se todos os números são diferentes) print...
C
#include <stdio.h> #include "config.h" int testFileToConfig() { char* s = NULL; size_t len1; int len = getline(&s, &len1, stdin); s[len - 1] = 0; printf("[%s]\n", s); config conf; printf("code = %d\n", fileToConfig(s, &conf)); printConfig(&conf); return(0); } int testParseS...
C
#include "comunication.h" ///gcc -o main main.c -lcrypto int main(int argc, char **argv) { struct A a; struct B b; struct KM km; initA(&a); initB(&b); initKM(&km); printf("Alegeti Criptosistemul:\n[1] ECB\n[2] OFB\n"); unsigned int type; do{ printf(">"); sc...
C
/*=========================================================================== = = = MtkUtcToUtcJd = = = ========...
C
/* * timers.c * * Created on: May 6, 2016 * Author: shapa */ #include "timers.h" #include "memman.h" typedef struct timerNode { struct timerNode *next; uint32_t id; uint32_t timeout; _Bool isPeriodic; _Bool isActive; onTimerFire_t cb; void *cbData; uint32_t cnt; } timerNode_t, *timerNode_p; s...
C
/******************************************************************************* * @file apps/uart/main.c * @brief This application is a simple uart example. * @author HoYa <hoya128@gmail.com> ******************************************************************************* * @version v1.0 * @note * - 2018.01.02...
C
// COA-602 Tarea 9 Ejercicio 5 // Fecha de creacion: 11-Marzo-2020 /********************************************************************************************************************************* Generalice la estrategia para ordenar tres o cinco números enteros, que consiste en buscar mínimos sucesivamente en una ...
C
#include <stdio.h> #include <assert.h> #include "snake_game.h" snake_game_t game; void remove_food(snake_game_t *game) { int row, col; for (row = 0; row < SNAKE_ROWS; row++) { for (col = 0; col < SNAKE_COLUMNS; col++) { if (game->board[row][col] == SNAKE_FOOD) { ...
C
#include <stdio.h> int main() { int season = 0; scanf("%d", &season); switch(season) { case 3: case 4: case 5: printf("spring"); break; case 6: case 7: case 8: printf("summer"); break; case 9: case 10: case 11: printf(...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* mlx.c :+: :+: :+: ...
C
#include "simpleos.h" Kernel_t Kernel; void SimpleOS_assertFailed() { while(1); } SIMPLE_INLINE Kernel_t *SimpleOS_getKernel(void) { return &Kernel; } uint32_t SimpleOS_Kernel_init(void) { SimpleOS_initScheduler(); SimpleOS_IdleThread_init(); Kernel.IdleTime = 0; Kernel.TimeStamp = 0; ret...
C
#include <_gl.h> #include <stdio.h> /** Version */ void version(void) { const unsigned char *renderer; const unsigned char *version; renderer = glGetString(GL_RENDERER); version = glGetString(GL_VERSION); printf("Compiled against GLFW %i.%i.%i\n", GLFW_VERSION_MAJOR, GLFW_VERSION_MINOR, GLFW_VERSION_REVIS...
C
/*------------------------------------------------------------------------------------- | [FILE NAME] <lcd.c> | | [AUTHOR] <Abdolee> | | [DATE CREATED] <Jan 15, 2020> ...
C
int main(){ int x=22,y=44; if(x==23){ x=2; }else{ y=314; } while( x < 21 ) { printf("value of x: %d\n", x); x++; } x=x+x; printf("%d",x); return 0; }
C
/** * @author Dan Noland <nolandda@nolandda.org> */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include "void_ptr_list.h" int str_compare(const void* left, const void* right ); void str_assign(void* dst, const void* src ); void* str_duplicate( const void* data_to_dup ); void str_deallocate( void* p...
C
#include <stdio.h> #include <string.h> #include <limits.h> #include <stdbool.h> #include <errno.h> #include <sys/time.h> #include <time.h> #include <pthread.h> #include <stdarg.h> #include <sys/types.h> #include <sys/stat.h> #include <stdlib.h> #include <unistd.h> #include "transfer_file_mgr.h" #def...
C
#include <stdio.h> int main(void) { int N,input,i; long long result = 0; scanf("%d",&N); for(i=0;i<N;i++) { scanf("%d",&input); result=result+input; } printf("%lld",result-N+1); return 0; }
C
#include <stdio.h> #define inf 999999 #define SIZE 4 int main() { int adj[SIZE][SIZE] = {0,1,0,0, 1,0,1,1, 0,1,0,0, 0,1,0,0}; int path[SIZE][SIZE]; int i, j, k; for(i=0;i<SIZE;i++) for(j=0;j<SIZE;j++) path[i][j] = (i==j)?0:((adj[i][j]==1)?adj[i][j]:inf); for(k=0;k<2;k++){ for(i=0;i<SIZE...
C
#include<stdio.h> int main() { double h,w,p,a; printf("enter the height and width of the reactangle \n"); scanf("%le%le",&h,&w); p=2*(h+w); a=h*w; printf("the perimeter of the rectangle is %le \n the area of the rectangle is %le",p,a); }
C
#include <stdio.h> double media_ponderada(double a, double b, double c); int main(void) { int n, i; double a, b, c; scanf("%d", &n); for(i = 0; i < n; i++) { scanf("%lf %lf %lf", &a, &b, &c); printf("%.1lf\n", media_ponderada(a, b, c)); } return 0; } double media_ponderada(double a, double b, double c) {...
C
/* * Copyright (C) 2015-2020 Alibaba Group Holding Limited */ #include <stdio.h> #include <aos/kernel.h> #include <ulog/ulog.h> /** * This use case demonstrates modifying the timer parameters after the timer is created. */ /* module name used by ulog */ #define MODULE_NAME "timer_app" /* timer handle */ static...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <time.h> #include <math.h> #define INF 1<<30 #define SZ 100000 /*problem id-11346 * *language-ANSI C * */ int main() { int i,j,k,l,m,n,t,x,y,blank=0,test=0; double a,b,s,tmp1,tmp2; scanf("%d",&t); while(t--) { scanf("%l...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <sys/stat.h> #include <fcntl.h> #include "config.h" #include "page.h" #include "index.h" int main () { errno = 0; int fd = open("./moo.txt", O_RDWR|O_CREAT|O_TRUNC, 0660); int i; int rc; bbdb_pagemap_t *map; bbdb_page_...
C
#ifndef __board_h__ #define __board_h__ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "./stack.h" #include "./config.h" /* Holds info about the current board */ struct gameinfo { int nrows; int ncols; int winamount; int *board; }; struct scoreboard { int playervplayer; int player1wins; ...
C
/* ** EPITECH PROJECT, 2019 ** AIA_n4s_2018 ** File description: ** mx_add */ #include "n4s.h" mx_t *mx_add_scalar(mx_t *a, double scalar, bool new) { vectori_t size = a->size; mx_t *res = NULL; int x = 0; int y = 0; res = (new ? mx_new(size.x, size.y) : a); while (y < size.y) { x = 0...
C
/**********************************************************************//** * @file accident_detection.c *************************************************************************/ #include <stdbool.h> #include <stdlib.h> #include "accident_detection.h" #include "accident_data.h" #include "../hardware_boards/car_pane...
C
/* gcc -c -DARCH_X86_64 rtc.c */ /* gcc -o rtc.exe -D_TEST_ -DARCH_X86_64 rtc.c */ /* In Fortron code: do this: integer(kind=8) :: st,et,res real(kind=8) :: tt,rtmp call get_rtc(st) ..... call get_rtc(et) call get_rtc_res(res) rtmp=res tt=(et-st)/rtmp */ #include <sched.h> ...
C
// // search-insert-position.c // algorithm // // Created by Kai on 2019/7/25. // Copyright © 2019 kai. All rights reserved. // #include "search-insert-position.h" /* https://leetcode.com/problems/search-insert-position/ */ typedef int (*SearchInsertFunc)(int *nums, int numsSize, int target); // MARK:- 方法一、遍历...
C
#include <stdio.h> #define NUM_OF_ELEMS 10 static void posNeg(int arr[], int n) { int positive = 0; int negative = 1; int temp = 0; while (1) { temp = 0; while ((positive < n) && (arr[positive] >= 0)) { positive += 2; } while ((negative < n) && (arr[negative] <= 0)) { negative += 2; } if...
C
/* * main.c * * Created on: Jan 11, 2021 * Author: huong */ #include "main.h" #include <string.h> #define FALSE 0 #define TRUE 1 void SystemClockConfig(uint8_t clock_seq); void UART2_Init(); void Error_handler(); void TIM2_Init(); void GPIO_Init(); static void settingClockfromPLL(RCC_OscInitTypeDef * ...