language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <string.h> #include "stack.h" int main(int argc, char *argv[]) { int ret = 0; int i = 0; int a[10]; SeqStack *stack = NULL; stack = SeqStack_Create(10); if (NULL == stack) { printf("func SeqStack_Create() err line:%d, file:%s\n...
C
//冒泡排序 #include <stdio.h> void swap(int* x, int* y){ int temp; temp = *x; *x = *y; *y = temp; } void fun(int* arr, int size){ int bound; for(bound = 0; bound < size; bound++){ for(int cur = size - 1; cur > bound; cur--){ if(arr[cur - 1] > arr[cur]){ swap(&arr[...
C
#include <stdio.h> #include <stdlib.h> #include "funciones.h" void inicializar( eLibro book[], int cantidad) { int i; for(i=0; i<cantidad; i++) { book[i].estado = 0; } } void mostrarDocumento(eLibro lib) { printf("\n %3d %d %10s %d \n", lib.codigoAutor, lib.codigoL...
C
// // QuickSort.c // AlgorithmForC // // Created by gjh on 2021/1/28. // #include "QuickSort.h" // 912.排序数组 最快的排序:必须掌握 快速排序 void swap(int arr[], int a, int b) { int tmp = arr[a]; arr[a] = arr[b]; arr[b] = tmp; } // 划分区域 int partition(int arr[], int leftBound, int rightBound) { int pivot = rig...
C
/* 2018/11/13 * version 1.0 * */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> // recv() #include <unistd.h> // close() #include <pthread.h> // POSIX thread #include <signal.h> // signal() #include <time.h> // time_t, struct tm #include <getopt.h> /...
C
#include <linux/module.h> #include <linux/moduleparam.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/fs.h> #include <linux/errno.h> #include <linux/types.h> #include <linux/vmalloc.h> #include <linux/genhd.h> #include <linux/blkdev.h> #include <linux/hdreg.h> MODULE_LICENSE("GPL"); sta...
C
#include <stdio.h> void swap(char *a, char *b) { int temp = *a; *a = *b; *b = temp; } char *str_rev(char *s) { char *begin = s; char *end = s; while (*end != '\0') { end++; } end--; while (begin < end) { swap(begin, end); begin++; end--; ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* fillit.c :+: :+: :+: ...
C
#include <assert.h> #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> #include "disk.h" #include "fs.h" #define UNUSED(x) (void)(x) #define FAT_EOC 0xFFFF typedef struct __attribute__((__packed__)){ uint8_t signature[8]; uint16_t totalBlocks; uint16_t rootDir...
C
/****************************************************************************** * * FILE NAME : new_user.c * * DESCRIPTION : it include funtion that does the pocessing for new client * * DATE NAME REFERENCE REASON * 23/04/18 GR_TH5_C_1 Multi Party Conference Chat Nalanda Project * * Copyright ...
C
#include "pctl.h" int main(int argc, char *argv[]) { int i,pid_ls,pid_ps,status; char *args_ls[]={"/bin/ls","-a",NULL}; char *args_ps[]={"/bin/ps","-a",NULL}; signal(SIGINT,(sighandler_t)sigcat); pid_ls=fork(); if(pid_ls<0){ printf("Create Process fail!\n"); exit(EXIT_FAILURE); } if(pid_ls==0){ printf("I...
C
#include <stdio.h> #include <stdlib.h> int main() { int a; printf("Input the number: "); scanf("%d",&a); printf("Your number can be from "); if(a<2) printf("binary number system or "); if(a<8) printf("octal number system or "); if(a<10) printf("decimal number system\n"); getch...
C
#include<stdio.h> int main() { int C,F; scanf("%d",&F); C = 5*(F-32)/9; printf("Celsius = %d",C); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define maxLength 100000 typedef struct node node; typedef struct hashTable hashTable; typedef int (*HashFunction)(char*, int); struct node { char key[maxLength]; int value; struct node *next; }; struct hashTable { int size; node **table; ...
C
#include <stdio.h> int search(int key, int a[], int length){ int i; int ret = -1; for(i=0; i<length; i++){ if(a[i]==key){ ret = i; break; } } return ret; } int main() { int a[] = {1,3,4,5,12,14,13,49}; int x; scanf("%d",&x); int ret = search(x, a, sizeof(a)/sizeof(a[0])); if(ret ==...
C
#include<stdio.h> int main() { int a,b; printf("Enter the value of A and B"); scanf("%d %d ",&a,&b); switch(a<b) { case 0: printf("%d is greater number ",a); case 1: printf("%d is is greater number ",b); // default : // printf("Both are equal"); } retur...
C
#include<stdio.h> int main(void){ char str[256]; int i; printf("文字列を入力してください:"); scanf("%s",str); for(i=0;str[i]>'\0';i++){ printf("%d番目の文字:%c(文字コード:%x)\n",i,str[i],str[i]); } return 0; }
C
#include <stdio.h> #include <string.h> int main(void) { int i, m, n; char name[10][10]; int out = 0, count = 0; printf("please input m and n : "); scanf("%d%d", &m, &n); getchar(); for (i = 0; i < m; i++) { printf("please input %d name : ", i + 1); fgets(name[i], sizeof(name[i]), stdin); if (name[i][st...
C
#include<stdio.h> long int stack[30],fac=1; int top=-1; void push(int); int pop(); main() { int num; printf("enter the number:"); scanf("%d",&num); while(num!=0) { push(num); num--; } while(top!=1) { fac=fac*pop(); ...
C
#include<stdio.h> /* Este programa valida si el nmero a es mayor al nmero b. */ int main (){ int a, b; a = 3; b = 8; if (a > b) { printf("\ta (%d) es mayor a b (%d).\n",a,b); } else{ printf ("\tb (%d)es mayor a la variable a (%d).\n",b,a); } printf("\t\vEl programa sigue su flujo.\n"); retu...
C
#include <stddef.h> #include <stdio.h> #include "cutest/CuTest.h" #include "utils/clargs.h" struct __fixture_parse { int32_t argc; const char *argv[8]; int32_t has_error; char expected_name[8]; int32_t expected_score; int32_t expected_flag; }; void test_clargs_parse(CuTest *tc) { struct clargs_parser *...
C
// // sys_file_calls.c // // // Created by Niklas Blomqvist on 2013-02-16. // // #include <syscall-nr.h> #include <string.h> #include <stdio.h> #include "threads/interrupt.h" #include "threads/thread.h" #include "threads/init.h" #include "threads/vaddr.h" #include "filesys/filesys.h" #include "filesys/file.h" #i...
C
#include "prim.h" // Funktion zur Zerlegung einer Zahl in ihre Primfaktoren void primfaktoren(zahl) { int i; printf("1 "); for(i=2;i<=zahl;) { if(zahl%i==0) { printf("x %d ", i); zahl /= i; } else { i++; } } pri...
C
/** * USB Midi-Fader * * Fader implementation * * Kevin Cuzner */ #include "fader.h" #include "stm32f0xx.h" #include "osc.h" /** * In reality, this is a really crappy abstraction around the ADC. It is not * really transferrable to any of my other projects, which I dislike. But, in * the interest of time I a...
C
#include<stdio.h> /** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ struct TreeNode* BuildBst(int *nums,int start,int end) { if(start > end) { return NULL; } struct TreeNode *pnode = (str...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> #include <dlfcn.h> #include "f12.h" #include "bindsym.h" /* * f12 x = f12_bind( char *module, char *errmsg ); * locate "lib<module>.so", and attempt to locate all the * required function symbols (and their ancillary signature variable...
C
#pragma once struct VideoFrame { double m_displayTime; int64_t m_duration; AVFrame* const m_image; VideoFrame() : m_displayTime(0) , m_duration(0) , m_image(av_frame_alloc()) {} ~VideoFrame() { av_frame_free(const_cast<AVFrame**>(&m_image)); } Vid...
C
/** * Módulo para manipulação de JSON. * Autor: Gabriel Dertoni * GitHub: github.com/GabrielDertoni */ #ifndef __JSON_H__ #define __JSON_H__ #include <stdlib.h> #include <stdbool.h> #include <assert.h> #include <parsing_utils.h> #include <dict.h> /** * Conversões entre tipos de valores JSON: * * Um determina...
C
/* * ejercicio1.c * * Created on: Feb 27, 2017 * Author: Javier Quiroz */ #include<stdio.h> #include<string.h> #define MAX_LONG 200 #define CADENA_PRUEBA "Hola a todos" int longitud_string_vieja(char s[]){ int i; i=0; while(s[i] != '\0') i++; return i; } int longitud_string(char *s){ ...
C
#include<libebox/core.h> #include<libebox/errors.h> #include<sys/stat.h> #include<sys/epoll.h> #include<sys/socket.h> #include<fcntl.h> #include<errno.h> #include<unistd.h> #include<stdio.h> #include<string.h> int ebox_poller_init(struct ebox_poller* poller, int maxevents) { if(poller == NULL) { return LIB...
C
#include <stdio.h> #include <unistd.h> #include <string.h> #include <stdlib.h> #include <errno.h> #include <sys/mman.h> int change_page_permissions_of_address(void *addr); void foo(); void get_permission(void *foo_addr); char *err_string = "Error while changing page permissions of foo()\n"; int main(void) { get_perm...
C
/* ----------------------------------------------------------------------- * Sylvan Canales * Assignment 3 * Include the following lines in your makefile: * * cardtest3: cardtest3.c dominion.o rngs.o * gcc -o cardtest3 -g cardtest3.c dominion.o rngs.o $(CFLAGS) * -------------------------------------------...
C
/* A program implementing the quicksort sorting algorithm concurrently * using the POSIX Thread (pthread) api. * * Usage: gcc quickSort.c -lpthread * ./quickSort || ./quickSort sizeOfArrayToSort * If no int argument sizeOfArrayToSort is given, we sort an array of 10000 numbers. * The array contains numbers of ra...
C
#include <stdio.h> #include <stdlib.h> struct no { int item; struct no *prox; }; typedef struct no Node; Node* aloca(){ Node *no = (Node*)malloc(sizeof(Node)); return no; } Node* newNode(){ Node *node = aloca(); int num; printf("Type a new item: "); scanf("%d",&node->item); node->prox = NULL; } void add(N...
C
#include<stdio.h> int main() { int i,j,max,k,l; scanf("%d",&k); int num[k]; for(i=0;i<k;i++) { scanf("%d",&num[i]); } for(j=0;j<k;j++) { if(j==0) { max=num[j]; } else if(max<num[j]) { max=num[j]; } } ...
C
#include <float.h> /* LDBL_MAX, LDBL_EPSILON */ #include <limits.h> /* CHAR_BIT, SCHAR_MIN, SCHAR_MAX, CHAR_MIN, CHAR_MAX SHRT_MIN, SHRT_MAX, INT_MIN, INT_MAX, LONG_MIN, LONG_MAX LLONG_MIN, LLONG_MAX */ #include <stdio.h> /* printf */ int main() { printf("short int [mi...
C
#include <stdio.h> int reverse(int); int main() { int t; int a; int b; int i; scanf("%d", &t); int c[t]; for (i = 0; i < t; i++) { scanf("%d", &a); scanf("%d", &b); c[i] = reverse(a) + reverse(b); } ...
C
#include "zbaselib_socket.h" #include <assert.h> #define PORT 9000 zbaselib_socket_t zbaselib_socket_create_tcpclient11(const struct sockaddr_in* addr) { zbaselib_socket_t sock = 0; sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); if (!zbaselib_socket_isvalid(sock)) return INVALID_SOCKET; assert...
C
#include <assert.h> #include <stdlib.h> #include <string.h> #include "stack.h" //创建栈 _stack *stack_create(int size) { //参数检查 assert(size > 0); if (size <= 0) return NULL; //内存申请 _stack *stack = (_stack *)malloc(sizeof(_stack)); if (!stack) return NULL; stack->table = (void **)malloc(size * sizeof(void *)); if...
C
#include "GraphAdjListUtil.h" #include <stdio.h> /* 0 1 1 2 2 3 2 0 -1 -1 //Ϊõͷ巨,2 32 0ʹڽӱΪ2-->0->3 */ int main(void) { GraphList *graphList = NULL; graphList = InitGraph(4); ReadGraph(graphList); WriteGraph(graphList); printf("\n"); return 0; }
C
#include "Logging.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <windows.h> #include "MemoryPatch.h" /* Initialize a fairly basic patch that basically overwrites the code with a call. */ t_memorypatch *mp_initialize(void *address, void *call_function, int length) { t_memorypatch...
C
int main() { if (1 == 1) printf("Hello world"); return 0; } // Some local changes // More local changes. This time, don't rebase on merging. // Third local changes int newFeature() { doSomethingAwesome(); doSomethingEvenBetter(); return 0; // Bug fix! } int secondNewFeature() { firstLine(); secondLine(); ret...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <sys/time.h> int int_compare(void const *a, void const *b){ return (*((int *) a) - *((int *) b)); } void swap(int *a, int *b){ int temp = *a; *a = *b; *b = temp; } int testSorted(int arr[], int n){ int i; for(i = 1; i < n; i++){ if(arr[i] < ar...
C
#include <stdio.h> int main(){ int n, x, intervalo=0; scanf("%d", &n); for(int i=0; i<n; i++){ scanf("%d", &x); if(x>=10 && x<=20) intervalo++; } printf("%d in\n%d out\n", intervalo, n-intervalo); return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* fillit.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> int main() { int year=2021,month=5,day=26,days=0,first,d,i,j,n; int a[12]={31,28,31,30,31,30,31,31,30,31,30,31}; printf("%dԪΪ%d\n",year,date(year)); first=date(year); switch(month) { case 1: days=day;break; case 2: days=31+day;break; ...
C
/* * File: main.c * * Test driver to exercise some sorting code * */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include "bubblesort.h" #include "heapsort.h" #include "insertionsort.h" #include "mergesort.h" #include "quicksort.h" #ifndef TRUE # define TRUE 1 #endif #ifndef...
C
#include <stdio.h> void gt(int n) { int i, gt = 1; for (i = 1;i <= n;i ++) { gt = gt*i; } printf("giai thua cua %d:%d",n,gt); }
C
/* ------------------------------------------------------ @copyright Luiz Paulo Rabachini @file: lista_dup_enc.h Release: 1.4 - Updated: 20/04/2010 ------------------------------------------------------ Resume: Header do arquivo lista_dup_enc.c ------------------------------------------------------ */ typedef struct R...
C
#include <stdio.h> #include <stdlib.h> int main (int argc, char *argv[]){ if (argc != 2) { fprintf(stderr, "need year argument"); exit(1); } int c = atoi(argv[1]); if((c%400==0) || ((c%4==0)&&(c%100!=0))){ printf("is a leap year!"); }else{ printf("is not a leap year!"); } }
C
/**************************************************************************************** * ļSPLINE.H * ܣβɳͷļ * ߣܱ * ڣ2003.09.09 ****************************************************************************************/ #ifndef SPLINE_H #define SPLINE_H /* غ */ #define NPMAX 10 /* */ typedef struct { flo...
C
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> ////////// begin ADT //////////// struct vec { float *val; }; typedef struct vec *Vector; Vector adt_createVector(int dim) { Vector a= (Vector) malloc(sizeof(struct vec)); a->val = (float*)malloc(dim*sizeof(float)); return...
C
/************************************************************************* > File Name: mywho.c > Author: weijie.yuan > Mail: > Created Time: Tue 02 Aug 2016 04:07:26 PM CST ************************************************************************/ #include <stdio.h> #include "mywho.h" #include <utmp.h> #include ...
C
///scan ch from the user display that char & its ASCII nu if small if not small then say propar input enter #include<stdio.h> main() { char ch; abc:printf("Enter the Char.....\n"); scanf("%c",&ch); if(ch>=97 && ch<=122) { printf("ch...%c and it's ASCII...%d\n",ch,ch); } else { goto abc; } printf("thanks.....\n"); }
C
#include <stdlib.h> #include <stdio.h> #include <stdint.h> /** * * Reverse a single byte * * * * this was adapted from the example at * * http://graphics.stanford.edu/~seander/bithacks.html#BitReverseObvious * */ uint8_t reverse_byte (uint8_t byte ///< byte to reverse ) { ...
C
#include<stdio.h> int main() { //convert a number desimal to octaol int a, b, c, d, e, f, g, h, i, j, x; scanf("%d", &x); a = x / 8; b = x % 8; c = a / 8; d = a % 8; e = c / 8; f = c % 8; g = e / 8; h = e % 8; i = g / 8; j = g % 8; printf("%d%d%d%d%d"...
C
#include<stdio.h> int main(void) { int March = 3; int April = 4; int year; int EasterDate; int a; int b; int c; int d; int e; int f; int g; int h; int i; int k; int l; int m; int p; int EasterMonth; printf("Enter Year: "); scanf("%d", &year);...
C
/* Zapoj ATmega8 s krystalom 4MHz (2x keramicky kondenzator 22[p/n ???], 1x elektrolyticky kondenzator 47uF medzi napajanie +/-). Port C (PC0 az PC3) pripoj na 4056BE (piny 2 az 5, pozor na poradie!). Ku 4056BE pripoj 7-segmentovy display. */ #define F_CPU 4000000UL #include <avr/io.h> #include <util/delay.h> #...
C
#include <sys/types.h> /* 定义数据类型,如 ssize_t,off_t 等 */ #include <fcntl.h> /* 定义 open,creat 等函数原型,创建文件权限的符号常量 S_IRUSR 等 */ #include <unistd.h> /* 定义 read,write,close,lseek 等函数原型 */ #include <errno.h> /* 与全局变量 errno 相关的定义 */ #include <stdio.h> int main(int argc, char *argv[]) { char sz_filename[] = "hello.t...
C
/*Accept Character from user and check whether it is alphabet or not (A-Z a-z). Input : F Output : TRUE Input : & Output : FALSE*/ #include<stdio.h> #include<conio.h> #define TRUE 1 #define FALSE 0 typedef int BOOL; BOOL ChkAlpha(char); BOOL ChkAlpha(char ch) { if((ch>='A'&&ch<='Z')||(ch>='a'...
C
#include <algorithm> // for min_element, max_element double peconvert = 0.00502; // volts per photoelectrion void doit(const char*); void simplecosmics() { //doit("20150930-1720"); doit("20151009-1743"); } void doit(const char *basename) { // --- read in the data and create a vector with all the values ...
C
#include "binary_trees.h" /** * binary_tree_size - This finds the size of a binary tree by * @tree: This is a pointer to the struct * Return: fgd */ size_t binary_tree_size(const binary_tree_t *tree) { if (tree == NULL) return (0); return (binary_tree_size(tree->left) + 1 + binary_tree_size(tree->right)); }
C
#include <stdio.h> #include <cs50.h> #include <stdlib.h> #include <string.h> int main () { FILE *miArchivo; miArchivo = fopen ("datos.csv", "r"); char linea [40]; for (int z = 0; z < 3; z++) { fgets (linea, 40, miArchivo); string nombres = strtok(linea, ","); string apelli...
C
/* * main.c * * Created on: 10-02-2013 * Author: bk */ /* * * TODO * 1. Zapisac do "chan" adres OCR0A/B * Odczytywac i zapisywac OCR0A/B przez pointer * * 2. PowerDown na Timerze; w razie niepstrykniecia zasilania * * 3. Zrobić 'inteligentny' random dla kanałów i wietlików * * * */ #include ...
C
#include "h8-3052-iodef.h" void sub_1(void) { int i; i = 0; } int sub_2(void) { return 0; } int sub_3(void) { int i; i = 1; return i; } int sub_4(int i) { int j; if (i == 0) { j = 1; } else if (i == 1) { j = 10; } else { j = 100; } return j; } int sub_5(int i) { int j...
C
// // Created by deangeli on 5/19/17. // #ifndef LIBFL_MATRIXUTIL_H #define LIBFL_MATRIXUTIL_H #include "matrix.h" #include "distanceFunctions.h" inline double computeDistanceBetweenRows(Matrix* matrix1, Matrix* matrix2, size_t indexRow_Source ,size_t indexRow_Target, ...
C
#include "md_getoption.h" #include "md_compression.h" #include <stdio.h> #include <stddef.h> #include <string.h> #define FORMAT_NEMESIS 0 void print_usage(FILE* fp) { } int main(int argc, const char* argv[]) { FILE* finput; FILE* foutput; const char* option; const char* input; const char* output; int f...
C
#ifndef __SeqListD_H__ #define __SeqListD_H__ #pragma once #include<stdio.h> #include<assert.h> #include<stdlib.h> #include<malloc.h> typedef int DataType; typedef unsigned int size_t; typedef struct SeqListD { DataType* _array; size_t _capacity;//底层空间的大小 size_t _size;//有效元素的个数 }SeqListD, *PSeqListD; void SeqLi...
C
//Capacity of the line card in megabytes #define C 64000 #define T 50 //Control Interval in ms #define A 50000 //1000*T /*********State Variables****************/ // Running average of RTT in ms int RTT = 200; int R = 200; //RCP feedback rate in MB/s int B = 0; //Number of Bytes received int S = 0; //Spare capacity ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_find_way.c :+: :+: :+: ...
C
/* Print weekday to console using a switch-statement. Lecture: IE-B1-SO1 (Software construction 1) Author: Marc Hensel */ #define _CRT_SECURE_NO_DEPRECATE // Else MSVC++ prevents using scanf() (concern: buffer overflow) #include <stdio.h> int main(void) { int weekday; /* Get user input: Day of the week */ printf(...
C
#include "ft_list.h" #include <stdio.h> #include <stdlib.h> t_list *add_list(t_list *list, char c) { t_list *new; if (!(new = (t_list*)malloc(sizeof(t_list)))) return (NULL); if (new) { new->data = c; new->next = list; } return (new); } char is_upper(char c) { if (c >= 'a' && c <= 'z') c -= 32; retur...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include "storage_mgr.h" #include "dberror.h" #include "test_helper.h" RC readBlock (int pageNum, SM_FileHandle *fHandle, SM_PageHandle memPage){ if(pageNum>=1&&pageNum<=totalNumPages){ fseek(fHandle->mgmtInfo, (pageNum-1)*PA...
C
#include <stdlib.h> #include <pthread.h> #include <unistd.h> #include <signal.h> #include "mutex_lib.h" #include "semaphore_lib.h" void sem_sig_hand(int sig) // prinde semnalul si trezeste thread-ul { //write(0,"Sem: am primit mesajul\n",23); return; } void sem_enqueue(Sem *sem) { //bagam doar conditia; struct pr...
C
// Author:Michael Sullivan // Olivia Mandola ovm5126@psu.edu // Dymea Schippers dxs5940@psu.edu //Section 11r //Breakout11 #include <stdio.h> #include <stdlib.h> #include <readline/readline.h> int sum_n(int n); void print_n(const char *s, int n); int main(void) { char* numHold = readline("Enter an int: "); int ...
C
/* ** eyes.c for raytracer in /home/le-mai_s/recode/TP/raytracer1/Raytracer/mlx ** ** Made by sebastien le-maire ** Login <le-mai_s@epitech.net> ** ** Started on Thu Sep 10 17:04:02 2015 sebastien le-maire ** Last update Wed Oct 21 11:25:58 2015 sebastien le-maire */ #include <float.h> #include "raytracer_mlx.h" v...
C
#include <avr/io.h> #include "adc.h" #define MASKBITS 0b00001111 void adc_init(void) { ADMUX |= (1 << REFS0); // Initialize the ADC ADMUX &=~(1 << REFS1); ADMUX |= (1 << ADLAR); //set ADLAR bit in ADMUX to 1 to get 8-bit conversion ADCSRA |= ((1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0)); //set ADPS...
C
// Tutoriel base en Langage C <Coding seule/> #include <stdio.h> int main(){ int x, y; printf("Donnez un nombre entier : "); scanf("%d", &x); printf("Donnez un autre nombre entier : "); scanf("%d", &y); if(x > y){ printf("%d est superieur a %d\n", x, y); } else printf("%d est inferieur a %d\n",x, y ); }
C
/* * This file is part of the exercises for the Lectures on * "Foundations of High Performance Computing" * given at * Master in HPC and * Master in Data Science and Scientific Computing * @ SISSA, ICTP and University of Trieste * 2019 * * This is free software; you can redistribute it and/or mo...
C
/* Z SCPC ȭ : 88 ð: 0.38 ޸:8312 */ #include <stdio.h> #include <string.h> #include <stdlib.h> //#pragma warning(disable:4996) int Answer; int main(void) { int T, test_case, len, count = 0, i, two = 1; char str[1000001]; char* ele[] = { "H", "He", "Li", "Be", "B", "C", "N", "O", "F", "Ne", "Na", "Mg", "Al", ...
C
/*************************************************************************************************** *FileName: *Description: *Author:xsx *Data: ***************************************************************************************************/ /***********************************************************************...
C
#include <stdint.h> #include "PLL.h" #include "LCD.h" #include "os.h" #include "joystick.h" #include "FIFO.h" #include "PORTE.h" #include "tm4c123gh6pm.h" // Constants #define BGCOLOR LCD_BLACK #define CROSSSIZE 5 //------------------Defines and Variables------------------- uint16...
C
#include "RemoteDeal.h" #include "MathLib.h" /*ңؽṹ*/ REMOTE_t REMOTE; /*ң*/ static const u8 DeadZone = 10; /************************************************************************************************* *: Get_RemoteDeal_Point *: شңֵƱָͨ봫ݷʽϢ *β: *: *˵: **********************************************************...
C
#include <stdio.h> #include <stdlib.h> #include "lt.h" #include "dboracle.h" #include "ltdb.h" /*ݿ*/ //ltDbConn *ltDbConnect(char *pUser,char *pPassword,char *pService); /* رݿӣͷйԴ */ //void ltDbClose(ltDbConn *psConn); /*¼*/ //LT_DBROW ltDbOneRow(ltDbConn *pConn,int *fieldnum,char *pSmt,...); //void ltDb...
C
#include<stdio.h> int main(void){ int num[]={125814,225547,132254,224321,352124,342214,382154,321014,112254,153789}; /**/ int numm[]={10000,5000,1000,500,100,50,10,5,1}; /*̗*/ int n[]={0,0,0,0,0,0,0,0,0,0}; /**/ int i, j; /*JԂp*/ for(i=0;i<=9;i++){ for(j=0;j<=8;j++){ while(num[i...
C
/********************************************************************* * FileName: vector.h ********************************************************************/ #include <math.h> struct vector3 { float x; float y; float z; }; struct matrix { float m11, m12, m13; float m21, m22, m23; float m31, m32, ...
C
#include <stdio.h> #include <stdlib.h> int main() {int x, y; double f; scanf("%d%d",&x, &y); if (x>-2 && 2<y && y<10){ f= sqrt(abs(pow(x,2)-pow(y,2)));} else if (x<-5 || y<2){ f=log10(-x)+ 2 * y;} else { f=sin(y);} printf("%f", f); return 0; }
C
#include <memory.h> /* API provided by system */ void ip_DiscardPkt(char * pBuffer ,int type); void ip_SendtoLower(char *pBuffer ,int length); void ip_SendtoUp(char *pBuffer, int length); unsigned int getIpv4Address(); int stud_ip_recv(char * pBuffer, unsigned short length){ // in case version == 1xxx, which wo...
C
#ifndef LAB1_5_PRINT_H #define LAB1_5_PRINT_H #include "Matrix.h" void PrintMatrixToFile(Matrix &A, ofstream &fout) { int32_t n = A.size(); for (int32_t i = 0; i < n; ++i) { for (int32_t j = 0; j < n; ++j) { fout.width(10); fout.precision(3); fout << left << A.get(i...
C
#include <stdio.h> int fun(char *a){ printf("fun: %lu\n",sizeof(a)); return 1; } int main(void){ char a[20]; int *ptr = a; printf("main: %lu\n",sizeof(fun(a))); printf("main: %lu\n",sizeof(fun)); return 0; }
C
#include<stdio.h> int greatNum(int a, int b); // function declaration int main() { int i, j, result; printf("Enter 2 numbers that you want to compare..."); scanf("%d%d", &i, &j); result = greatNum(i, j); // function call printf("The greater number is: %d", result); return 0; } int great...
C
// This program reads input with floating-point conversion specifier // by Ericka.H #include<stdio.h> int main(void) { double a; double b; double c; puts("Enter three floating-point numbers:"); scanf("%le%lf%lg", &a, &b, &c); printf("\nHere are the numbers entered in plain:"); ...
C
#include <wiringPi.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> /** * A program to turn on/off a LED through a button(the polling way). * * @author Darran Zhang @ codelast.com */ int main (int argc,char* argv[]) { if (argc < 3) { printf("Usage example: ./%s button_gpio_port led_gpio_port\n"...
C
// base on https://github.com/bk138/Multicast-Client-Server-Example #include <stdio.h> #include <errno.h> #include <unistd.h> #include "mcast-socket.h" #define LOG_TAG "MCAST" #include "Log.h" #if 0 static void dump_hex(char* title, unsigned char* raw, int length) { int i; printf("dump_hex(%s):\n", title); for (...
C
#define GPS_STRUCT_GLOBAL #include "include.h" ///1=1/Сʱ=1.852ǧ/Сʱ uint8 GpsGetTime(uint8 utc_time[],uint8 hex_time[]) { uint8 i,res,u8_val; res = IsValidNum(utc_time,6); if(!res) { goto RETURN_LAB; } for(i=0;i<3;i++) { u8_val = (utc_time[i*2] - '0')*10; u8_val += utc_time[i*2+1] - '0'; hex_time[...
C
#include <stdio.h> int main(void) { int a, b; int t; scanf("%d%d", &a, &b); t = a > b; if (t == 1) { goto true; } printf("a is lower than b\n"); goto done; true: printf("a is higher than b\n"); done: return 0; }
C
/*Задача 10. Как работи? Дефинираме променлива “а“, дефинираме пойнтер, но още не му задаваме стойност. Отпечатайте адреса на “а”. След това присвояваме стойност на пойнтера, като внимаваме типовете на пойнтера и променливата да са от един и същи тип. Отпечатваме на екрана стойността на пойнтера с %р, стойността на „а“...
C
/* 剑指 Offer 10- I. 斐波那契数列 非递归实现 Garker-gan 2020-11-10 */ //非递归 int fib(int n){ int a = 0; int b = (n == 0) ? 0 : 1; int c = 1e9 + 7; //防止溢出 int res = a+b; for(int i = 0 ; i < n-1 ; i++) { res = (a + b)%c; a = b; b = res; } return res; }
C
// Created by Akira Kyle on 10/26/14. #include <stdio.h> #include <stdlib.h> #include <math.h> #include <time.h> int main (void) { //Setup clock_t start = clock(), diff; FILE *file = fopen("Developer/MatterAndInteractionsIProject/Data/gasSimData.txt", "w"); if (file == NULL) { printf("Erro...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_history.c :+: :+: :+: ...