language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include "iic.h" #if IIC_MODE /* : ʼIIC Ӳ: SCL---PB6 SDA---PB7 */ void IIC_Init(void) { RCC->APB2ENR|=1<<3; GPIOB->CRL&=0x00FFFFFF; GPIOB->CRL|=0x33000000; GPIOB->ODR|=0x3<<6; } /* : ʼź ʱΪߵƽʱɸߵƽΪ͵ƽĹ */ void IIC_SendStart(void) { IIC_OUTPUT_MODE(); //ģʽ IIC_SCL=1; IIC_SD...
C
#include <stdio.h> #include <stdint.h> uint8_t u8a, u8b; uint16_t u16c, u16d; uint32_t u32e, u32f; int8_t s8; int16_t s16; int32_t s32; int main(void){ u8a = sizeof(uint8_t); u16c = sizeof(uint16_t); u32e = sizeof(uint32_t); printf("size of uint8_t: %d Byte.\n", u8a); printf("size of uint16_t: %d Bytes.\n",...
C
#include<stdio.h> #pragma warning(disable:4996) int main(void) { double h, w, s_w; printf("ü߰ Ű ԷϽÿ : "); scanf("%lf %lf", &w, &h); s_w = (h - 100) * 0.9; if (w < s_w) printf("ü Դϴ"); else if (w > s_w) printf("ü Դϴ"); else printf("ǥü Դϴ"); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main() { printf("Hello world!\n"); FILE *archivoALeer; FILE *archivoAEscribir; char caracterLeido; int caracterASCII,contador=0,comparador=0,entroADecimal=0,entroAOctal=0,entroAHexa=0; archivoALeer= fopen("DocALeer.txt","r+"); //abro...
C
/* ** С */ #include "stdio.h" #include "stdlib.h" int main() { /*------*/ double sum = 100; /*---ĸ߶---*/ double h = 100; /*---ش---*/ int n = 0; for (n = 2; n < 10; ++n) { sum += h * 2; h /= 2; } printf("%f\n10ʱĸ߶Ϊ%f\n", sum, h); system("pause"); return 0; }
C
int main() { int a,b=3,c=5,d=7; char n='n'; scanf("%d",&a); if(a%3==0&&a%5==0&&a%7==0) printf("%d %d %d",b,c,d); if(a%3!=0&&a%5==0&&a%7==0) printf("%d %d",c,d); if(a%3==0&&a%5!=0&&a%7==0) printf("%d %d",b,d); if(a%3==0&&a%5==0&&a%7!=0) printf("%d %d",b,c); if(a%3!=0&&a%5!=0...
C
//Authors: Aaron Elliot, Justin Montes //pa32 #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdint.h> #include <unistd.h> #define KBLU "\x1B[34m" #define KRED "\x1B[31m" #define KRESET "\x1B[0m" #define ERROR_OUT_OF_MEM 0x1 #define ERROR_DATA_INCON 0x2 #define ERROR_AL...
C
#include <stdio.h> int main() { char ak[1000][1000]; int a,y,x,count = 0,i = 0,j = 0; while ((a = getchar()) != EOF){ if (a != '\n') {ak[i][j] = a; j++; } else { i++; j = 0; } } for (x = 0;x < i;x++)/*to enter each line*/ { count = 0; for (y = 0;ak[x][y] != '\0';y++) /* j is not given because i...
C
#include<stdio.h> void ssort(int a[],int n) { int i,j,position,temp; for (i = 0; i < n-1; i++) { for ( j = i+1; j < n; j++) { position=i; if(a[position]>a[j]) position=j; temp=a[i]; a[i]=a[position]; a[position]=temp; } } } int main() { int a[10...
C
#include<stdio.h> #include<string.h> #define M 10000007 int t,n,a[M],b[M],c[M],d[M],i,j; int main() { scanf("%d",&t); while(t--) { scanf("%d",&n); b[0]=0; for(i=1;i<=n;i++) { scanf("%d",&a[i]); b[i]=b[i-1]+a[i]; b[i]=b[i]%n; } memset(c,0,sizeof(c)); memset(d,0...
C
#include<stdio.h> #include<stdlib.h> void swap(int *x , int *y) { int temp=*x; *x = *y; *y = temp; } int partition(int a[] , int start , int end) { int pivot = a[start]; int i = start; int j = end; while(i < j) { while(a[i] <= pivot) i++; ...
C
#include <string.h> #include <stdlib.h> #include "linkedList_users.h" #include "linkedList_messages.h" #include <stdio.h> users_list_t *llu_init() { //We allocate the momery required users_list_t *list = (users_list_t *) malloc(sizeof(users_list_t)); if (list == NULL) { return NULL; } //set...
C
#include <stdio.h> #include <stdlib.h> #include <strings.h> #define MOBDIR "lib/world/mob/" #define OBJDIR "lib/world/obj/" #define ZONDIR "lib/world/zon/" #define WLDDIR "lib/world/wld/" #define SHPDIR "lib/world/shp/" int main(void) { FILE* index; FILE* input; FILE* output; char filename[100]; char newfil...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #pragma warning(disable : 4996) typedef struct book { char name[30]; char semi_ISBN[5]; int page; }Book; int main() { int cmd = 0; int count = 0; int check = 0; int num = 0; char search[30]; char temp[30]; Book arr[100]; for (int i = 0; i < 100; i++) ...
C
/* * driver.c * This file is part of lammps-ensembles * * Copyright (C) 2012 - Mladen Rasic & Luke Westby * * lammps-ensembles is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the Li...
C
#include <stdio.h> #include <string.h> #include <dirent.h> #include <sys/stat.h> #include <signal.h> #include <stdlib.h> #include <unistd.h> char *cat_options[4] = {"-n", "-E", "-nE", "-En"}; int cat_ops[] = {0, 0}; int check(char *source) { int i = 0; while (i < strlen(source)) { if (source[i] == '-') { ++...
C
/* ** EPITECH PROJECT, 2019 ** manage_mouse_click ** File description: ** manage_mouse_click */ int my_putstr(char const *str); int my_put_nbr(int nb); #include <SFML/Audio.h> #include <SFML/Graphics.h> #include <stdlib.h> void manage_mouse_click(sfMouseButtonEvent event) { my_putstr("Mouse x="); my_put_nbr(...
C
#include <string.h> #include <stdio.h> #include <stdlib.h> #include <math.h> int main(int argc, char *argv[]) { // open file for reading FILE *inputFile = fopen("Prob19.in.txt", "r"); int testCases; // read number of test cases fscanf(inputFile, "%d\n", &testCases); char nextChar; int currentValue; // each...
C
#include <stdio.h> int main() { int n; printf("input:"); scanf("%d", &n); printf("output:%d\n", &n);//ʮ printf("output:%o\n", &n);//˽ printf("output:%X\n", &n);//ʮ return 0; }
C
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<string.h> #include<stdlib.h> typedef char Elementtype; // ͣɸҪж typedef struct TreeNode * Node; // Node൱struct treeNode * // ڵṹ typedef struct TreeNode { Elementtype Element; Node left; // ڵӽڵ Node right; // ڵӽڵ }TREE, ...
C
#include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <stdlib.h> #include <memory.h> int main() { //for parent to child int parentToChild[2]; //for child to parent int childToParent[2]; //string data char message1[] = "massage from child to parent\n"; char message2[] = "m...
C
/* $Id: stresstest.c 732 2008-03-10 15:55:53Z lsc $ */ /* * Author: Lee-Shawn Chin * Date : Feb 2008 * Copyright (c) 2008 STFC Rutherford Appleton Laboratory * * File : stresstest.c * */ #include "stresstest.h" /* define and initialise global vars */ int env_rank = 0; int env_size = 1; int main(int argc...
C
#include <stdio.h> #include <stdlib.h> #include "func_basica.h" /* Header que chamas funcoes nos arquivos externos (*.c) */ int main() { int a, b; float resultado; system("clear"); printf("\n\n\tProgarma MAIN que chama Funcoes Externas"); printf("\n\tAs Funcoes Externas executam as ...
C
/****************************************************************************** Use of time.h library functions *******************************************************************************/ //The C library function clock_t clock(void) returns the number of clock ticks //elapsed since the program was launched. //To...
C
#include <stdio.h> #include <string.h> int main(void) { char s1[20] = "Hello "; char s2[] = " World "; char s3[40] = ""; printf( "string1 = %s\nstring2 = %s\n", s1, s2); printf("strcat(s1, s2) = %s\n", strcat(s1, s2)); printf( "strncat(s3, s2, 6) = %s\n", strncat( s3, s2, 6 )); ...
C
#include <stdio.h> int main() { int bills[12] = {10000, 5000, 2000, 1000, 500, 200, 100, 50, 25, 10, 5, 1}; char *prefix; int coinsStart = 6; int total, i, changed; double tIn; int amountBill; while (scanf("%lf", &tIn) == 1) { total = (int)(tIn * 100); i = 0; printf("NOTAS:\n"); changed = 0; prefix...
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include<ctype.h> #include <stdlib.h> #include <string.h> #include <locale.h> #include <Windows.h> #include <malloc.h> #include "Neighbor.h" #include <time.h> #define kMaxKeySize 1024 //-, - , , . // , - , ? // enum { XOR = 1, GET_LENGTH_AND_KEY, ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_handle_err.c :+: :+: :+: ...
C
// // Created by Nylander on 09-04-2021. // #ifndef YUKON_PLAYINGCARD_H #define YUKON_PLAYINGCARD_H #include <stdbool.h> #define PLAYING_CARD_NUM_SUITS 4 #define PLAYING_CARD_NUM_CARDS_IN_SUIT 13 #define PLAYING_CARD_MAX_LENGTH_AS_STRING 3 /** * Represents a standard playing card * @author Rasmus Nylander, s20541...
C
#include "primitives.h" //**************************************************** // brdf.h. get the color of a certain pixel with given lights //**************************************************** //given a point on the unit sphere, return the normal vector Vector getNormal(Point p){ return Vector(p.x, p.y, p.z)...
C
#include <stdio.h> #include <stdlib.h> typedef int element; typedef struct linked_list { element data; struct linked_list* link; }list; typedef struct linked_list_base_queue { list* front; list* rear; }queue; void QInit(queue*); int QIsEmpty(queue* que); int QIsFull(queue* que); void enqueue(q...
C
/*program for bonus*/ #include <stdio.h> int main(){ int bonus = 2500, cy , yoj , year ; printf ("Enter the current year :"); scanf ("%d",&cy); printf("Enter the year of joining :"); scanf("%d",&yoj); year = cy - yoj; if (year > 3 ) //if difference between current year and year of joining i...
C
#ifndef _LIST_HASH_H_ #define _LIST_HASH_H_ #define RETURN_NULL(a) if(!a) return -1; #define RETURN_NNULL(a) if(!a) return NULL; #define SET_LIST(l, v, n) l->value = v; l->next = n; #define SET_HASH(h, k, v, n) h->key = k; h->value =v; h->next = n; typedef struct list list; typedef struct hashmap hashmap; struct lis...
C
#pragma once struct ParticleDirection { float x; float y; float z; float length; ParticleDirection(float x = 0, float y = 0, float z = 0, bool norm=false) { _init(x, y, z, norm); } ParticleDirection(CParticleF& from, CParticleF& to, bool norm = false){ _init(to.m_X - from.m_X, to.m_Y - from.m...
C
#include "shared.h" #include <stdlib.h> #include <string.h> #include <pthread.h> #include <netdb.h> #include <stdarg.h> // All the things that could go wrong enum ExitCodes { EXIT_ARGS = 1, EXIT_OPEN_SINISTER_FILE = 2, EXIT_SINISTER_FILE_CONTENTS = 3, EXIT_OPEN_TEAM_FILE = 4, EXIT_TEAM_FILE_CONTENT...
C
#include<stdio.h> int main() { int a1,b1,c1,d1; int a2,b2,c2,d2; int a3,b3,c3,d3; int a4,b4,c4,d4; int a5,b5,c5,d5; int tot1,tot2,tot3,tot4,tot5; scanf("%d %d %d %d",&a1,&b1,&c1,&d1); tot1=a1+b1+c1+d1; scanf("%d %d %d %d",&a2,&b2,&c2,&d2); tot2=a2+b2+c2+d2; scanf("%d %d %d %d",&a3,&b...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> void stringSwap(char *s1,char *s2){ //Function to swap two strings. char t[10]; strcpy(t,s1); strcpy(s1,s2); strcpy(s2,t); } int main(void) { char s[100][100]; int arrayLength=0; while(scanf("%s",s[arrayLength++])>0); //string array in...
C
/***************************************************************************** * Licensed to Qualys, Inc. (QUALYS) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * QUALYS licenses this file to You under ...
C
// 6.12 #include <stdio.h> #define SIZE 8 int main( void ) { int twopows[SIZE]; int i; int value = 1; /* 2 to the 0 */ for (i = 0; i < SIZE; i++) { twopows[i] = value; value *= 2; } i = 0; do { printf("%d ", twopows[i]); i++; } while ...
C
#include <stdio.h> #include <string.h> int main() { char str1[15]; char str2[15]; int resultado; strcpy(str1, "victor"); strcpy(str2, "victor hugo"); resultado = strncmp(str1, str2, 6); if(resultado < 0) printf("str1 é menor que str2\n"); else if(resultado > 0) printf("str1 é m...
C
#include <am.h> #include <klib.h> #include <klib-macros.h> #if !defined(__ISA_NATIVE__) || defined(__NATIVE_USE_KLIB__) static unsigned long int next = 1; int rand(void) { // RAND_MAX assumed to be 32767 next = next * 1103515245 + 12345; return (unsigned int)(next/65536) % 32768; } void srand(unsigned int seed...
C
/** * Copyright (c) 2018 Zachary Puls <zach@zachpuls.com> */ #include <string.h> /** * @brief Scans str1 for the first occurrence of any of the characters that are * part of str2, returning the number of characters of str1 read before this * first occurrence. * * @param str1 A pointer to the string to...
C
/************************************************** * file: queue.h * * header file containing implementation details * for a queue based on a linked list **************************************************/ #include "linked_list.h" typedef struct Queue Queue; struct Queue { Node *head; Node *tail; } Queue *...
C
../leetcode/748-Largest Number At Least Twice of Others.c
C
#include "benchmark.h" #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "algorithm/lcs_blackler.h" #include "thirdparty/lcs_hirschberg.h" #include "thirdparty/lcs_neiljones.h" #include "thirdparty/lcs_rogerzhang.h" #include "thirdparty/lcs_soarpenguin.h" #include "util/issubstr...
C
#include "tout.h" void init_liste(t_liste * liste, void (*copier_elem)(void *, void *), void (*supprimer_elem)(void *)){ liste->drapeau = malloc(sizeof(t_element)); liste->drapeau->succ = liste->drapeau; liste->drapeau->pred = liste->drapeau; liste->copier_elem = copier_elem; liste->supprimer_elem = supprim...
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[]) { int x, y, aux, vetAt[100]; for(x=0;x<100;x++){ printf("Insira o %d numero: ", x+1); scanf("%d",&vetAt[x]); } for(x=0;x<100;x++){ ...
C
#include <linux/types.h> #include <linux/wireless.h> #include <string.h> #include <sys/ioctl.h> #include <sys/socket.h> #include <unistd.h> enum { SUCCESS, ERROR_ARGS, ERROR_SOCKET, ERROR_IOCTL, ERROR__COUNT }; enum { ARGS_EXEC, ARGS_INTERFACE, ARGS__COUNT }; int main (int argc, char** argv) { // D...
C
#include <stdio.h> int main() { float a[8]={0,}; float b[8]={0,}; int i; for(i=0;i<8;i++) { scanf("%f", &a[i]); b[i]+=a[i]; printf("a[%d]=%.3f ",i,a[i]); } printf("\n"); for(i=0;i<8;i++) { b[i]+=a[i]; printf("b[%d]=%.3f ",i,b[i]); if(b[i]>10) { } } return 0...
C
/** * Video for Linux version 2 (V4L2) example 1 - print device capabilities * * Based on * - https://gist.github.com/Circuitsoft/1126411 * - https://jayrambhia.com/blog/capture-v4l2 * * Kyle M. Douglass, 2018 * kyle.m.douglass@gmail.com */ #include <errno.h> #include <fcntl.h> #include <linux/videodev2.h> #i...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* project.c :+: :+: :+: ...
C
#include <stdio.h> int main() { int inputNumber; printf("give me a number"); scanf("%d",&inputNumber ); if(inputNumber>=18){ printf("you can get booze in hungary\n"); } else{ printf("you are too young to drink bruv\n"); } printf("Hello, World!\n"); return 0; }
C
#include <stdio.h> #include <omp.h> #define N 4 int main(){ int i, j; #pragma omp parallel for for(i=0; i<N; i++){ for(j=0; j<N; j++){ printf("i:%d, j:%d\n", i, j); } } return 0; }
C
#include <string.h> #include <time.h> #include <stdio.h> #include <stdlib.h> #include <omp.h> #include "mkl_vsl.h" #define batchsize 100 int main(int argc, char **argv) { int niter = atoi(argv[1]); /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ /* ~~~~~~~~~~~~~~~~~PARALLELIZE ME~~~~~~~~~~~~~~~~...
C
/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */ struct ListNode { int val; struct ListNode *next; }; struct ListNode *detectCycle(struct ListNode *head) { struct ListNode* fast = head; struct ListNode* slow = head; int flag = 0...
C
//trapizoidal rule #include<stdio.h> #include<conio.h> #include<math.h> float f(float x) { return((4*x)-(3*(pow(x,2)))); } void main() { float a,b,x[50],y[50],s=0.0,h; int n,i; clrscr(); printf("Lower Limit-"); scanf("%f",&a); printf("\nUpper Limit-"); scanf("%f",&b); printf("\nEnter no. of subintervals-...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> void rotate(char * r, char * q) { for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { *(q + 10 * j + 9 - i) = *(r + 10 * i + j); } } for (int k = 0; k < 10; k++) { for (int l = 0; l < 10; l++) { fprintf(stdout, "%c", *(q ...
C
#include <stdio.h> #include <stdlib.h> #include <check.h> #include <binary_tree_int.h> #include "check_suites.h" #define ROOT_ELEMENT (11) #define NUM_ELEMENTS (10) #define BUFFER_SIZE (64) START_TEST(sprintf_test) { bt_node_int_t *tree; bt_node_int_err_t ret; char buf[BUFFER_SIZE]; tree = bt_int...
C
#include <stdio.h> #include <string.h> int main() { int a[100], b[100], i, p; while(scanf("%d", &n)==1){ if(n==0) break; memset(a, 0, sizeof a); printf("Discarded cards: "); for(i = 1, j = 1; i<=n; i++){ if(i==1) printf("%d"); else if(i%2==1) printf(...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_inst_var.c :+: :+: :+: ...
C
/* ** my_exec.c for my_exec in /home/nguye_z/rendu/PSU_2015_my_exec ** ** Made by nguyen kevin ** Login <nguye_z@nguye-z-pc> ** ** Started on Tue Jan 5 11:30:24 2016 nguyen kevin ** Last update Sat Apr 9 14:44:06 2016 nguyen kevin */ #include "header.h" char esperluette_or_comma(char **tab) { ...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> char sym[3][3]={'1','2','3','4','5','6','7','8','9'}; char user='X'; bool check=true,check_winning=false; int iteration=1; void Display(char arr[3][3]) { printf("\t\t T I C T A C T O E \n"); printf(" Player One is:- X\n"); ...
C
#include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <time.h> int main() { int fd = open("hw1_door",O_RDWR); char buf[20]={0,}; if(fd <= 0) { perror("open"); return -1; } srand(22); while(1) { int r = 1500000+rand()%1000000; int f = read(fd,buf,15); if(f == -1) { printf("Consume...
C
#include "unity.h" #include "TokenAffix.h" #include "Token.h" #include "Tokenizer.h" #include "Common.h" #include <stdio.h> #include <stdlib.h> void setUp(void){} void tearDown(void){} /* Before encode * Affix = PREFIX = 0x0002 0000 * TokenType = TOKEN_OPERATOR_TYPE = 0x0000 0004 * * ...
C
#include "my_apue.h" int main(int argc, char const *argv[]) { if(argc == 1) { printf("must has a file\n"); exit(1); } struct stat buf; int i; for(i = 1 ; i < argc; i++) { if(lstat(argv[i], &buf) == -1) { perror("lstat"); continue; } if(S_ISREG(buf.st_mode)) { printf("regular file\n"); } else ...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <string.h> #include "libfat.h" void print_file_info(Entry *entry); void dif_fat(FILE * in, BootSector bs, bool show); void blocos_livres(FILE * in, BootSector bs); void blocos_deletados(FILE * in, BootSector bs); void corrige_fat(FILE * in, int nr_f...
C
// PR c++/94695 // { dg-do compile { target c++11 } } // { dg-options "-Wrange-loop-construct" } #include <initializer_list> struct Small { char arr[64]; }; struct Big_aggr { char arr[65]; }; struct Big_triv_copy { char arr[65]; Big_triv_copy() { } }; struct Big { char arr[65]; Big () = default; Big(...
C
/* ** EPITECH PROJECT, 2023 ** game_of_life ** File description: ** Created by Anthony Anicotte, */ #include <stdlib.h> #include "struct.h" void free_tab(char **tab) { for (int i = 0; tab[i] != NULL; i++) free(tab[i]); free(tab); } void free_structure(game_of_life_t *gol_struct) { free_tab(gol_st...
C
#include <stdio.h> const double e = 0.0000001; double start(double x){ return ((1+x)/2); } double heron(double w, double x){ double temp = ((w+(x/w))/2); if ((w-temp) < e) return temp; return heron(temp,x); } int main(void){ double x = 123.4; printf("Heron: %f\n", heron(start(x),x)); return 0; }
C
#ifndef __LONG_DATA_UART_PROTOCOL__ #define __LONG_DATA_UART_PROTOCOL__ #include <Arduino.h> #define MAX_MESG_SIZE 14 /// Enum for the states of the finite state machine which implements the Long /// Data UART Protocol. enum LDProtocolState { GET_HEADER, GET_DATA, GET_CHECKSUM, }; /** * This struct is ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* select.c :+: :+: :+: ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* check_text.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> int main () { int iSecret, iGuess; srand (time(NULL)); iSecret = rand() % 10 + 1; if (primo(2)) { printf("sim"); } else { printf("nao"); } return 0; } int primo (int n) { if (n == 1) return 0;{} for (int i = 2; i < n; i++) ...
C
/* Print the sum of the divisors of a given n. (Given by input through standar input). Example: input -> 12 output -> 28 */ #include <stdio.h> static unsigned int SumDiv (unsigned int n) { unsigned int sum = 0; size_t d = 1; while (d * d < n) { if (n % d == 0) sum += (d + (n / d)); d++; } ...
C
#ifndef MACHINEH #define MACHINEH //-------------------------------- The Machine ------------------------------// // I want you to be totally honest with me about how the machine makes you feel. // // Each frame represents an instructions and a scope in which // that instruction should be carried out. Instructions, lik...
C
int gcd(int a, int b){ for(;;){ if(a==b) return a; else if(a>b) a = a-b; else b = b-a; } } int main(){ int a = 10, b = 75; int c = gcd(a,b); syscall_print_int(c); syscall_print_newline(); }
C
#include "lists.h" /** * free_listint- Free *@head: Head of the list * Return: No. */ void free_listint(listint_t *head) { listint_t *tmp; while (head != NULL) { tmp = head; head = head->next; free(tmp); } }
C
/* * Date: 2016-04-26 */ /*==================[inclusions]=============================================*/ #include "sapi.h" // <= sAPI header #include "sapi_i2c.h" /* <= sAPI I2C header */ #include "sapi_adc.h" // sAPI ADC header /*===========================================================================...
C
// main.c // dz3 // #include <stdio.h> #include <stdlib.h> #include <conio.h> #include "tool.h" #include "sort.h" unsigned const int size = 4; int main() { float container = 0; FILE *theFile = fopen("Database.json", "w+"); FigureList *theList = createFigureList( abs(size) ); addCircle(theL...
C
#include <ctype.h> #include "stdio.h" int main(void) { char s; int n,count; scanf("%d%*c",&n); while(n--) { count=0; do{ s=getchar(); if(isdigit(s)) count++; }while(s!='\n'); printf("%d\n",count); } return 0; }
C
//implement DNS_client using udp #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <arpa/inet.h> #include <netinet/in.h> void main() { int sockid; char dname[50],ip[50]; struct sockaddr_in addr1; sockid = socket(AF_INET,SOCK_...
C
// input: NCBI SRA FASTQ format #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #define READ_LEN 1000 #define READ1 1 #define READ2 2 int main(int argc, char *argv[]) { FILE *f; char buf[10000]; int len = 0, num = 0; char head[READ_LEN]; char name[READ_LEN]; char part[READ_LEN]; ...
C
#include<stdio.h> #include<conio.h> #include<stdlib.h> #include<ctype.h> #define max 5 void input_dequeue(); void output_dequeue(); void insert_right(int); void insert_left(int); void delete_right(); void delete_left(); void display_dequeue(); int deque[max]; int left=-1,right=-1; void main() { i...
C
#include <stdio.h> int main( int argc, char *argv[]) { /*printf("Height: "); int height= get_int("Height: "); while( height < 0 || height < 1){ height = get_int("Height: "); }*/ int height = (int) argv[1]; for(int i = 0 ; i <= height ;i++){ printf("#"); printf("\n")...
C
#include "cem.h" #define STD_OBJ 1 #include "stdobj.h" #include "symbol.h" #include "type.h" /* * Type creation routines. */ /* * We keep a cache of data objects rather than allowing malloc * to inefficiently recycle them. */ static e_elt *e_elt_free; static s_elt *s_elt_free; static u_elt *u_elt_free; static e_...
C
/* * problem01.c * * Created on: Feb 5, 2019 * Author: tcrokicki * Description: [ADD DESCRIPTON] */ #include<stdio.h> #include "myflush.h" void execute_problem01() { printf("START PROBLEM 1\n"); int position = 0, arr[10], element, count = 0; printf("Enter 10 numbers: \n"); for (int i = 0; i < 10; ...
C
/* * main.c * * Created on: 10 dic 2019 * Author: simone */ #include <stdio.h> #include <stdlib.h> // funzione per stamapre la sequenza di caratteri secondo la frequenza desiderata void StampaNcarattteri( FILE* file_caratteri, int frequenza ); // funzione per contare il numero di presenza di un carattere t...
C
#include <stdio.h> #include <signal.h> #include <unistd.h> void sig_func(int signum) { printf("信号%d触发了\n",signum); sleep(3); printf("信号处理完毕\n"); } int main() { struct sigaction act = {}; act.sa_handler = sig_func; sigaddset(&act.sa_mask,SIGINT); sigaction(SIGINT,&act,NULL); for(;;) { printf("*\n"); sle...
C
/* ** EPITECH PROJECT, 2019 ** generator ** File description: ** check_error.c */ #include <stdlib.h> #include <ctype.h> #include <string.h> int check_nbr(char *str) { for (int i = 0; str[i]; i++) if (isdigit(str[i]) == 0) return (84); return (0); } int check_error(int ac, char **av) { ...
C
#include <pthread.h> #include <unistd.h> pthread_mutex_t lock; int main() { if (pthread_mutex_init(&lock, NULL) != 0) { printf("\n First initialization of mutex failed\n"); return 1; } pthread_mutex_lock(&lock); pthread_mutex_unlock(&lock); }
C
//Write a C program to find HCF (GCD) of two numbers. #include <stdio.h> void main() {int i,x,y,n; printf("Enter 2 numbers:"); scanf("%d %d",&x,&y); for(i=1;i<=x; i++) if(x%i==0 && y%i==0) n=i; printf("\nHCF of %d and %d is:%d",x,y,n); }
C
#include <stdio.h> void printArr(int arr[], int length); void josephArr(int arr[], int length){ int arr2[length]; int i = 0; int j = 0; for(i=0; i<length; i++){ if(i+1 % 3 == 0){ continue; } arr2[j] = arr[i]; j++; } printArr(arr2, length); } void printArr(int arr[], int length){ int i = 0; printf(...
C
/**************************************************************************** ** ** modmem.c ANU SQ Alice C Niemeyer ** ** Copyright 1994 Mathematics Research Section ** School of Mathematical Sciences **...
C
#include <stdlib.h> #include <stdio.h> #include <math.h> #include "common.h" #include "solvers.h" #include "poissoncommon.h" double alpha=0.1; double exact(double x) { return x*(pow(x,5.0)-1.0); } double source(double x) { return -30*pow(x,4.0); } int GaussJacobiPoisson1D(Vector u, double tol, int maxit) { ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "asm.h" #include "directive.h" int directive_parse(struct ScanData *scanInfo, struct Token *dirToken, struct SymTab **curSyms, struct ASMRecord **asmrec, unsigned int *offset) { char tokName[MAX_TOKLEN]; struct Token newTok...
C
#include <stdint.h> #include <stdbool.h> #include <string.h> #include "debug.h" static debug_context_t debug_context; uint32_t debug_mode; typedef struct { debug_command_t *handler; } help_command_t; typedef struct { uint32_t address; uint32_t len; uint8_t size; } md_command_t; static union { ...
C
/*Group 2 Program 2 Paul Maclean- mac7537@calu.edu Mike Gorse- gor9632@calu.edu Robert Breckenridge- bre6896@calu.edu Chase Smith- smi8808@calu.edu Rudolph Hanzes - han7739@calu.edu CSC 460 Language Translations */ #include "file_util.h" #include "scanner.h" file_outcome init(int argc, char* argv[]) ...
C
/* vector a column-major * a = [ x * y * z * 1 ] * a^T = [ x y z 1 ] * ^T means the transpotion of the matrix * matrix definition * M = [ r00 r01 r02 m03 * r10 r11 r12 m13 * r20 r21 r22 m23 * tx ty tz 1 ] * * M^T =[ r00 r10 r20 tx * r01 r11 r21 ...
C
#include "stdio.h" #include "gpio_handler.h" #include "string.h" #include "driver/gpio.h" #include "cJSON.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "gpio_config_parser.h" #include "iot2tangle.h" #include "../mqtt_handler.h" enum pinMode pinmode_of(char* str_mode){ if (strcmp(str_mode, ...
C
/* ** my_strcapitalize.c for Pool Day06 in /home/laroch_f/Desktop/PiscineDay06/Piscine_C_J06/ex_10 ** ** Made by Hugo Laroche ** Login <laroch_f@epitech.net> ** ** Started on Tue Mar 8 15:24:07 2016 Hugo Laroche ** Last update Tue Mar 8 21:57:51 2016 Hugo Laroche */ char *my_strcapitalize(char *str) { int cpt...