language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
unsigned char funx(unsigned char ,int ,int); int compress7(int fo,int count ,int mcount) { int fm,fc,i = 0; unsigned char a,b,c,x,value; char org[count],marray[mcount]; lseek(fo,SEEK_SET,0); fm = open("/home/avtar/project1/mdcproject/masterarrayg.txt",O_RDONLY); fc = open("/home/avtar/project1/mdcproject/compress...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char* argv[]) { char* text = NULL; if (argc < 3) { printf("Usage: repeater [STRING] [QUANTITY]\n"); exit(1); } int times = atoi(argv[2]); if (times == 0) { exit(0); } char* str = argv[1]; int len = strlen(str)...
C
// // Created by Jeongho on 2018-01-04. // #include <stdio.h> #include <stdlib.h> int heapSize=-1; int* heapArray; void insertHeap(int num); void deleteHeap(); int main(){ int command_count; scanf("%d",&command_count); //입력할 명령어 수 입력 heapArray=(int*)malloc(sizeof(int)*command_count+1);//명령어 수에 따른 배열 동적 할...
C
// pthread에 구조체 인자 전달 #include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <unistd.h> #include <string.h> void *print_structure(void *); typedef struct{ char name[20]; char major[30]; char univ[30]; } thread_args; int main(void) { pthread_t t1, t2; // stu1 구조체 선언 thread_args stu1; strc...
C
#include <stdbool.h> #include <stdio.h> #include <stdlib.h> struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; }; bool isSameTree(struct TreeNode *p, struct TreeNode *q) { if (p == NULL && q == NULL) { return true; } if (p == NULL || q == NULL) { return false; } if (is...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* update_env.c :+: :+: :+: ...
C
#include "libs_support.h" #include "util.h" /* -------------------------------- YMD_aGTEb ---------------------------------------- Return true if 'a' id the same date & time as 'b' or later. Handles wildcards; if year or month in 'a' or 'b' is a wildcard then that field in 'a' is NOT greater or equal than t...
C
#include <stdio.h> #include <unistd.h> #include <pthread.h> #define rozm 4 pthread_mutex_t mx = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t c = PTHREAD_COND_INITIALIZER; int buf[rozm], poz_zap=0, poz_odcz=0, ile_jest=0; void* prod(void* info) { int i; while(1) { sleep(2); pthread_...
C
#include <mm/pmm.h> #include <mm/vmm.h> #include <kernel/log.h> uintptr_t* pmm_bitmap = NULL; size_t pmm_frames = 0; size_t pmm_framesz() { return vmm_pgsz(); } int pmm_alloc(size_t frame) { size_t off = frame / (sizeof(uintptr_t) * 8); size_t bit = frame % (sizeof(uintptr_t) * 8); if(pmm_bitmap[off] & (1 << bit...
C
#ifndef BSTlib_h #define BSTlib_h typedef struct node node_t; void insertNode(void *element, node_t **root, int (*cp)(void *A, void *B));///J@Ӹ`IiBST node_t *deleteNode(void *target, node_t **root, int (*cp)(void *A, void *B), void(*print_node)(void*));///RBST node_t *findMinNode(node_t *root);///XBSTȳ̤p node_t...
C
/* Based on Task example from "Mastering the FreeRTOST Real Time Kernel: A Hands-On Tutorial Guide" */ /* Kernel includes. */ #include "FreeRTOS.h" #include "task.h" #include "queue.h" #include "timers.h" /* Common demo includes. */ #include "blocktim.h" #include "countsem.h" #include "recmutex.h" /* RISCV includes ...
C
/////////////////////////////////////////////////////////////////////////// //// LCDD.C //// //// Driver for common LCD modules //// //// //// //// lcd_init()...
C
/* * William Wood cssc1167, Nadim Tahmass cssc1158 * CS570, Summer 2018 * Assignment #2, File Editor * copyFile.c */ //Holds all of our big file copying functions #include "fileEditor.h" //Copy a file into .bak void copyFile(char *nameCpy){ file1 = open(nameCpy, O_RDONLY); if(file1 < 0){ printf("Fi...
C
// Copies a BMP file #include <stdio.h> #include <stdlib.h> #include <math.h> #include "bmp.h" int main(int argc, char *argv[]) { // ensure proper usage if (argc != 4) { fprintf(stderr, "Usage: copy infile outfile\n"); return 1; } // get scaleFactor char *tempFactor = argv[1]...
C
/* This file is written by Lepidum Co., Ltd. Copyright (c) 2005-2006 by Lepidum Co., Ltd. */ /** * @file unix/dir.test.c */ #include <dirent.h> #include "common.h" /** * @testname opendir_closedir_readdir_rewinddir_1 * @testfor opendir * @testfor closedir * @testfor readdir * @testfor rewinddir */ TES...
C
/* ************************************************************************** */ /* */ /* :::::::: */ /* print.c :+: :+: ...
C
/* Assignment 3 Roll Number: CS19BTECH11026 Name: Naitik Malav */ #include<stdio.h> #include<string.h> #include<stdlib.h> struct node { char numPlate[7]; struct node *left; struct node *right; struct node *parent; }; /* this time I have modified compare function..it is not same as Assignment0 and A...
C
#define _BSD_SOURCE #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <dirent.h> #include <stddef.h> #include <stdlib.h> #include <unistd.h> #include <time.h> #include <string.h> #include <errno.h> #include <libgen.h> int ProcessDir(char* prog, char* directory, int from, int to, FILE* fd_output...
C
#include "map.h" MAP *newMap(int colors, int map_size){ if(colors<=0 || map_size<=0) return NULL; MAP *rt=(MAP *)malloc(sizeof(MAP)); int i; if(rt!=NULL){ rt->headers=(NODE **)malloc(map_size*sizeof(NODE *)); for(i=0;i<map_size;i++){ rt->headers[i]=newNode(); rt->headers[i]->header=HEADER; ...
C
/* Comp 40 - HW6 - memory.h * Reed Kass-Mullet (rkassm01) and Jerry Wang (jwang35) * November 17, 2020 * Purpose: Interface for the Memory Module. This module contains all * the functions needed to initialize, modify, or retrieve * information from UM memory. */ #include <stdio.h> ...
C
/* * This program checks for a doorbell from a modified * version of the Weever bootloader. * It maps in the Phi's GDDR (low) * memory into host memory, and looks for the value * 0xdeadbeef at a special address. * * Kyle C. Hale 2014 * */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <...
C
#include<stdio.h> #include<math.h> int main (){ float a, b, c, delta, rp, rn; scanf("%f %f %f", &a, &b, &c); if (a == 0){ printf("Impossivel calcular\n"); return 0; } delta = (b * b) -4 * a * c; if (delta < 0){ printf("Impossivel calcular\n"); return 0; } rp = (-b + sqrt(del...
C
/* ** EPITECH PROJECT, 2018 ** CPool_Day06_2018 ** File description: ** test_my_strncmp */ #include <criterion/criterion.h> int my_strncmp(char const *s1, char const *s2, int n); Test(my_strncmp, return_value_cut_by_ocurence) { cr_assert_eq(my_strncmp("azzzzz", "zaaaaa", 2), -25); }
C
#include "runtime.h" #include <stdlib.h> #include <string.h> #include <assert.h> static JsObject *dummy; // forward declarations static JsDictEntry* lookdict_string(JsDictObject *mp, JsObject *key, uhash hash); #define EMPTY_TO_MINSIZE(mp) do { \ memset((mp)->ma_smalltable, 0, ...
C
// wait example, explained in depth #include <unistd.h> #include <wait.h> // contains macros for testing information returned by wait #include <stdio.h> #include <stdlib.h> void run_child_code(); void run_parent_code(); int main() { int fork_rv; printf("Before fork: I am %d\n", getpid() ); /...
C
#include <stdio.h> #include <float.h> /************************************************************************/ /* practice 1 */ /************************************************************************/ void p4_1(void) { char first_name[40]; char ...
C
#include "lists.h" #include <stdio.h> #include <stdlib.h> #include <string.h> /** *get_nodeint_at_index - return the pointer to the number node of index say *@head: the head of the node *@index: the number of the node to return *Return: the pointer to the node */ listint_t *get_nodeint_at_index(listint_t *head, u...
C
/* * index: associative dictionary * * (c) 1999-2011 IOhannes m zmölnig, forum::für::umläute, institute of electronic music and acoustics (iem) * * This program 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 Found...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <math.h> #define Gmax 5000 #define error 0.000001 //le ponemos 4 ceros y genera mas rapido #define ranf() ((double)rand()/(1.0+(double)RAND_MAX)) //intervalo uniforme de [0,1) typedef struct dat { double x; double sigma; } x_delt; ...
C
#include <sys/types.h> #include <pthread.h> #include <stdlib.h> #include <stdbool.h> #include "buffers.h" typedef struct link_list { job_t *value; struct link_list *next; } link_list_t; link_list_t *scissors_head = NULL; pthread_mutex_t scissors_mutex; link_list_t *drill_head = NULL; pthread_mutex_t drill_m...
C
#include"header.h" int main() { int fd[2]; char s[10],a[10]; char buff[10]; if(pipe(fd)==-1) { perror("pipe"); return 0; } if(fork()==0) { sleep(1); read(fd[0],a,sizeof(a)); printf("in child out put......%s\n",a); } else { printf("enter the string in parent.......\n"); scanf("%s",s); write(fd...
C
#include<stdio.h> //#include<conio.h> #include<ctype.h> #include<stdlib.h> void main() { int i=2,j=0,k=2,k1=0; char ip[10],kk[10]; FILE* fp; //clrscr(); printf("\nEnter the filename of the intermediatecode"); scanf("%s",&kk); fp=fopen(kk,"r"); if(fp==NULL){ printf("\nError in Opening the file"); //getch(); }//clrscr();...
C
#include <llbmc.h> /* #include <stdlib.h> */ typedef struct _SLL_ENTRY { int Data; struct _SLL_ENTRY *Flink; } SLL_ENTRY, *PSLL_ENTRY; PSLL_ENTRY SLL_create(int length) { int i; PSLL_ENTRY head, tmp; head = NULL; for(i = 0; i < length; i++) { tmp = (PSLL_ENTRY)malloc(siz...
C
#include<stdio.h> #include<string.h> #define MEDIA 5 typedef struct { char nome[20]; float mediaFinal; int matricula; }Talunos; main(){ Talunos aluno[3],*Paluno,AlunoRp[3],AlunoAp[3],*PAAP,*PARP; Paluno = aluno; PAAP = AlunoAp; PARP = AlunoRp; int i,contAp=0,contRp=0; for (i=0;i<3;i++){ fflush(stdin); ...
C
/* Author: Abida Hassan Filier: SDAD */ #include<stdio.h> void afficherMatriceReelle(double **A,int L,int C){ int i,j; for(i = 1;i<=L;i++){ for(j = 1;j<=C;j++){ printf("%lf ",*(A[i]+j)); } printf("\n"); } }
C
#include <stdio.h> #include <stdlib.h> /*Elabore um programa que faça a leitura de vários números inteiros até que se digite um número negativo. O programa tem de retornar o maior e o menor número lido */ int main(void){ int numUsuario, maiorNum = 0, menorNum = 0, aux = 0; printf("\nDigite um numero inteiro...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> /*Declaracao da variaveis globais de controle...*/ int cont,cont2; float mediaturma; /*Declaraзгo da Struct alunos onde estao guardadas todas a veriaveis ultilizadas no Programa...*/ struct aluno{ char nome[15], sobrenome[15]; int n...
C
#include <stdio.h> #include <string.h> void convert(char *str, char *buf) { int i = 0; while (str[i]) { if (str[i] > 'a' && str[i] < 'z') { buf[i] = str[i] - 'a' + 'A'; } else if (str[i] > 'A' && str[i] < 'Z') { buf[i] = str[i] - 'A' + 'a'; } else { // 其他的不变 buf[i] = str[i]; ...
C
#include<stdio.h> #include<conio.h> void main() { int n,i,j,a,b[50]; clrscr(); printf("Enter the number:"); scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&b[i]); } printf("Enter the target number:"); scanf("%d",&a); for(i=0;i<n;i++) { for(j=0;j<n;j++) { if(b[i]+b[j+1]==a) { printf("%d %d",b[i],b[j+1]); } } } getch(); }...
C
/*************************************************** * Single Author Info * mghegde Mahendra Hegde * * Group Info * mghegde Mahendra Hegde * ssingh24 Siddharth Singh * skumar23 Sudhendu Kumar ***************************************************/ #include<stdio.h> #include "mymutex.h" int mythread_mutex_init(mythread...
C
/********************************************* *********************************************** SERVER file Name- Kavya Kandhway Adm no. 18JE0408 DD CSE ************************************************ ************************************************ */ #include <netinet/in.h>...
C
#include "header.h" subway metro = {NULL, NULL, 0, NULL, 0}; graphlist graph_list = {NULL, 0}; graphmatrix matrix = {NULL, 0}; char init_name(FILE *); char init_lines(FILE *, size_t); char init_stations(FILE *, size_t, RUN_MODE); char init_station_line(FILE*); char init_station_graph(FILE *, size_t, RUN_MODE); // ...
C
#include <stdio.h> #include <stdlib.h> int main () { int N, *n; double M, *m; char O, *o; n = &N; m = &M; o = &O; scanf("%d\n", &N); scanf("%lf\n", &M); scanf("%c\n", &O); printf("%d %lu %x\n", N, sizeof(N), n); printf("%lf %x %d\n", M, m, sizeof(M)); printf("%c %x %d\n", O, o, sizeof(O)); r...
C
size_t ft_strlcat(char *dst, const char *src, size_t size) { size_t i; size_t j; i = 0; j = 0; while (dst[i]) i++; if (size) { while ((i + j) < (size - 1) && src[j]) { dst[i + j] = src[j]; j++; } dst[i + j]...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <time.h> #include "state.h" /* Arreglo con patrones de cuatro unos consecutivos */ int masks[8]; /* Arreglo con el complemento de cada patron del arreglo anterior*/ int cMasks[8]; /* Metodo para inicializar el arreglo de mascaras...
C
#ifndef GML_PERSPECTIVE_PROJECTION_H #define GML_PERSPECTIVE_PROJECTION_H #include <gml/matrix/matrix4.h> #include <cmath> static void gmlPerspective(float fov, float aspect_ratio, float* left, float* right, float* bottom, float* top, float near){ *top = tan(fov/2)*near; *right = aspect_ratio * (*top); *left = ...
C
/* glfuncs.h: cs316 lab02 include file Created by: Kevin Sahr, 10/5/17 */ #ifndef GLFUNCS_H #define GLFUNCS_H #include <stdio.h> #include <string.h> /*** GL include files ***/ #ifdef __APPLE__ #include <OpenGL/gl.h> #include <OpenGL/glu.h> #include <Glut/glut.h> #else #define GL_GLEXT_PROTOTYPES #include <GL/...
C
/* !!DESCRIPTION!! !!ORIGIN!! testsuite !!LICENCE!! Public Domain !!AUTHOR!! */ #define OUTFILE "cc65080328.out" #define THISFILE "cc65080328" /* always include this _after_ the above macros have been defined */ #include "testsuite.h" /* The following code produces an 'Error: Incompatible pointer ...
C
#include <stdio.h> int main(void) { int size; do { printf("Inserisci la dimensione delle aste, dispari e non negativa: "); scanf("%i", &size); } while (size < 0 || size % 2 == 0); int x, y; for (y = 0; y < size; y++) { for (x = 0; x < size; x++) printf("%c", (x == size / 2 || y == size ...
C
#include <stdlib.h> #include <stdio.h> #include <stdbool.h> #include "queue.h" #include "list.h" struct node; struct Queue *queue_create(void) { struct Queue *q = malloc(sizeof(*q)); if (q == NULL) { return NULL; } q->first = NULL; q->last = NULL; return q; } /** * adds an element...
C
/* ** OCTAL ASCII TO INTEGER CONVERSION ** ** The ascii string 'a' which represents an octal number ** is converted to binary and returned. Conversion stops at any ** non-octal digit. ** ** Note that the number may not have a sign, and may not have ** leading blanks. ** ** (Intended for converting the status codes in...
C
#include<stdio.h> #include<math.h> void raiz4(){ printf("A raiz quadrada de %d é %.0f\n", 4, sqrt(4)); } void raiz9(){ printf("A raiz quadrada de %d é %.0f\n", 9, sqrt(9)); } void raiz25(){ printf("A raiz quadrada de %d é %.0f\n", 25, sqrt(25)); } void raiz41(){ printf("A raiz quadrada de %d é %.0f\n", 41, sqrt(41...
C
#include<stdio.h> int main() { long int t,i; scanf("%ld",&t); for(i=1;i<=t;i++) { long long int n, reversedInteger = 0, remainder, originalInteger; scanf("%lld", &n); originalInteger = n; while( n!=0 ) { remainder = n%10; reversedInteger = reve...
C
#include "map.h" #include <stdlib.h> #include <string.h> /* Based on rxi's type-safe hashmap implementation */ /** * Copyright (c) 2014 rxi * * This library is free software; you can redistribute it and/or modify it * under the terms of the MIT license. See LICENSE for details. */ typedef struct edgex_map_node...
C
#include <stdio.h> /* what is in the function */ struct CharacterSet{ char name[12]; char race[12]; int attack; int defense; }; struct CharacterSet createCharacter(){ struct CharacterSet aCharacter; /* make me a new one */ printf("Enter character's name: "); scanf("%s", aCharacter...
C
/* Copyright (c) 2011-2012 Hiroshi Tsubokawa See LICENSE and README */ #include "Tiler.h" #include "Vector.h" #include "Numeric.h" #include <stdlib.h> #include <assert.h> struct Tiler { int i; int total_ntiles; int xntiles, yntiles; struct Tile *tiles; int xres, yres; int xtile_size, ytile_size; }; struct Til...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/time.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/mman.h> #include <fcntl.h> #include <unistd.h> #include <termios.h> #include <signal.h> #define DEVNAME "/dev/iommap" #define MAPSIZE 0x1000000 #define OFFSET 0x0FFFFF0 int main(...
C
#include <stdio.h> void main(){ int S; float FA; printf("\nCuantos sonidos por minuto emite su termo-grillo?: "); scanf("%d",&S); FA = S/4+40; printf("\nLa temperatura es de: %4.2f grados farenheit",FA); }
C
/* ** EPITECH PROJECT, 2019 ** my_runner_2019 ** File description: ** map object */ #include "my_runner.h" #include "map.h" extern const int NB_TYPE_BLOCK; extern const int BLOCK_SIZE; static void map_destroy(map_t *map) { map->parallax.destroy(&map->parallax); if (map->buffer != NULL) { free(map->bu...
C
/* poj 1067 取石子游戏 */ #include <stdio.h> #include <math.h> int main() { double _sqrt5 = sqrt(5.0); int a, b, k, ak, bk, ak_1, bk_1; while (2 == scanf("%d %d", &a, &b)) { if (a > b) { k = a; a = b; b = k; /* a = a ^ b; b = a ^ b; a = a ^ b; */ /* a ^= b; ...
C
/* This program takes two inputs from the user and checks every value in between those two numbers, including the numbers itself. The program checks whether each value is a semiprime, meaning whether that number is a product of two prime numbers, or not by determining whether the number and its prime factor are both pr...
C
// // main.c // square // // Created by choihyunill on 2016. 3. 26.. // Copyright © 2016년 choihyunill. All rights reserved. // #include <stdio.h> int main(int argc, const char * argv[]) { int n; int i,k; printf("출력 라인의 수"); scanf("%d",&n); for(k=0;k<n; k++) { for(i=0;i<n;i++) ...
C
#include <stdio.h> #include "watchdog.h" static void dump_watchdog_info(struct wdinfo *info) { printf("Device:\t\t%s\n", WATCHDOG_PATHNAME); printf("Identity:\t%s [version %d]\n", info->identity, info->firmware_version); printf("Timeout: \t%d seconds\n", info->timeout); printf("Pre-timeout: \t%d seco...
C
#ifndef HOLBERTON_H #define HOLBERTON_H #include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include <math.h> /** * struct complex_t - doubles struct * @rn: real num * @in: img num */ typedef struct complex_t { double rn; double in; } complex; void display_complex_number(complex c); complex conjugate(co...
C
#include <stdio.h> #include<math.h> int main() { double a,b,c,det; double realPart,imagPart; float root1,root2; printf("Enter the coordinates a,b,c : "); scanf("%lf%lf%lf",&a,&b,&c ); det= b*b - 4 * a * c ; if(det<0) { realPart =-b/(2*a); imagPart =sqrt(-det)/(2*a); printf("the roots are imaginary\n"); p...
C
/* Author: Mark Vincent * Partner(s) Name: NA * Lab Section: A01 * Assignment: Lab #6 Exercise #3 * Youtube Link: https://youtu.be/MxQY58C0p2s * Exercise Description: * * Take an old lab an add a timer to it. * * I acknowledge all content contained herein, excluding template or example * code, is my own o...
C
#include<stdio.h> #pragma warning(disable:4996) typedef struct { int tanka; int suryou; int kingaku; int zeikomi; int zei; }ren02; int main() { ren02 r = {0}; printf("P\n"); scanf("%d", &r.tanka); printf("ʂ\n"); scanf("%d", &r.suryou); r.kingaku = r.tanka*r.suryou; r.zei = r.kingaku*0.08; r.zeikomi =...
C
#include <stdio.h> int main(void) { int average; int grades[3]; grades[0] = 80; grades[1] = 80; grades[2] = 75; average = (grades[0] + grades[1] + grades[2])/3; printf("The average of the 3 grades is: %d", average); return 0; }
C
/* * value_exception.c * Calculator * * Created by Michael Dickens on 7/13/10. * */ #include "value.h" exception exception_init(exception *parent, char *name) { exception res; res.parent = parent; res.name = value_malloc(NULL, strlen(name) + 1); if (res.name) strcpy(res.name, name); res.description = NU...
C
/******************************************************************************************************** * * Title : bubble_sort.c * Description : Bubble Sort ALgorithm * Author : Aniruth Oblah * * * Revision History: * ______________________________________________________________________________...
C
/********************************************************************************************* * Description:一些笔试中会编写的测试程序 * name:merlin time:2017-11-30 * *******************************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> /*brif:删...
C
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> int main() { int a; scanf("%d", &a); int i, sum = 0, tmp = a; for (i = 1; i <= 5; ++i) { tmp = tmp * 10 + a; sum += tmp; } printf("%d", sum); system("pause"); return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_putstr.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> /* 入力した文字列が数値のみで構成されているか確認する*/ int isdigits(char *str){ int result = 0; for(int i = 0; i < strlen(str); i++){ if(isdigit(str[i])){ result++; }else{ result = 0; break; } } return result; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* print.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> #include "table.h" struct slot { int id; struct object *obj; int next; }; struct table { int size; int lastfree; struct slot *slot; }; void rehash(struct table *t) { struct slot *oslot = t->slot; int osize = t->size; t->size = ...
C
/* This is the main body of the program. It is just a simple skeleton * and should be fleshed out as desired. Mainly what you'll do to flesh * it out is to edit the data structure defined in main.h so that it contains * the information your program needs. Then modify init_display() to create * the interface yo...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> #include <unistd.h> void change_password(); struct customer { char username[1000]; char password[100]; char phone_number[20]; double money; }; void clear_screen() { system("clear"); } static char *get_input() { char...
C
#include<stdio.h> int gcd(int x,int y){ if (y==0) return x; else return gcd(y,x%y); } int main(){ int x,y; puts("请输入x和y"); scanf("%d%d",&x,&y); int k = gcd(x,y); printf("他们最小公约数是%d",k); return 0; }
C
#include <stdio.h> #define MAX 2000000 int H, A[MAX+1]; void swap(int *a, int *b) { int t = *a; *a = *b; *b = t; } void maxHeapify(int i) { int l, r, largest; l = 2 * i; r = 2 * i + 1; if (l <= H && A[l] > A[i]) largest = l; else largest = i; if (r <= H && A[r] > A[largest]) larg...
C
/* Copyright (c) 2013, Linaro Limited * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause */ #include <odp_coremask.h> #include <odp_debug.h> #include <stdlib.h> #include <string.h> #define MAX_CORE_NUM 64 void odp_coremask_from_str(const char *str, odp_coremask_t *mask) { uint64_t mask_u64; ...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> int comp( const void* s1, const void* s2 ) { char c1 = * (char*) s1; char c2 = * (char*) s2; return c1 - c2; } /* Sort chars in string then compare */ int anagram( char* str1, char* str2 ) { int max_strlen = (strlen( str1 ) > strlen( str2 ) ...
C
#ifndef RANDOM_H_ #define RANDOM_H_ /* * Encapsulation of standard C random number generator. * We provide a way to randomize the state of the RNG. */ // Randomize the C RNG with a time-related seed. // Can be called multiple times, it will only randomize on the first call. void randomize(void); // Return a rando...
C
#include "helpers.h" #include <math.h> // Convert image to grayscale void grayscale(int height, int width, RGBTRIPLE image[height][width]) { // Make the average of the three color for each pixel // Ensure the result is an integer float avg; for (int i = 0; i < height; i++) { for (int j = 0...
C
/* * CS:APP Data Lab * * <Omar Ahmad ID:804801272> * * bits.c - Source file with your solutions to the Lab. * This is the file you will hand in to your instructor. * * WARNING: Do not include the <stdio.h> header; it confuses the dlc * compiler. You can still use printf for debugging without inc...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> void strreverse(char* begin, char* end); void itoa_(int value, char *str); int main(){ char buf[BUFSIZ]; int n = 2000; // sprintf(buf,"%d", n); // puts(buf); itoa_(n,buf); int tamano = strlen( buf); printf("%d",tamano); int ente...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strjoin.c :+: :+: :+: ...
C
/*Exercicio: Ler um numero inteiro e imprimir seu sucessor e antecessor. */ #include<stdio.h> int main() { int num, suc, ant; printf("Insira o numero:" ); scanf("%d", &num); suc = num + 1; ant = ant - 1; printf("O sucessor de ", num); printf("%d", suc); }
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> enum colors {red , yellow , blue }; void printfcolors (enum colors c); int main() { enum colors i = 0 ; printf("请输入你想看到的颜色呢:\n"); scanf("%d",&i); printfcolors(i); return 0; } void printfcolors(enum colors c){ printf("是%d色呢\n",c); }
C
#include <stdlib.h> #include <stdio.h> #include <assert.h> #include <string.h> #include "sorting.c" int main() { char* arr[6] = {"Taber", "Brendan", "Gavin", "Nick", "Cheyenne", "Alyssa"}; printf("Unsorted:\n"); for (int i = 0; i < 6; i++) { printf("%s\n", arr[i]); } quicksort(arr, 0, 6); printf(...
C
#include <stdio.h> int main(void) { int Count, Counter; printf("How many natural numbers you want to print?"); scanf("%d", &Count); printf("The first %d natural numbers are", Count); for ( Counter = 1; Counter <= Count; Counter ++ ) { printf(" %d", Counter); } printf("."); return 0; }
C
#include "Controladores/AlDesenhosController.h" ALLEGRO_MUTEX *mutex; typedef struct jogo{ ALLEGRO_BITMAP* fundo; ALLEGRO_DISPLAY *janela; ALLEGRO_FONT *fonte; ALLEGRO_EVENT_QUEUE *filaEventos; ALLEGRO_TIMER *timer; ListaDesenho *listaDesenho; ListaDesenho *listaTiros; ListaDesenho *li...
C
/******************** ** ⲿԴѹ ** һλЧС ************************/ #include <stdio.h> #include <string.h> #include "FreeRTOS.h" #include "data_type.h" #include "fr_drv_adc.h" #include "fr_drv_gpio.h" #define AD_CH_NUM 3 static unsigned int AdcValueTmp[AD_CH_NUM][5]; static unsigned int AdcValueSum[AD_...
C
#import <stdio.h> /*Ejercico de Nota por medio de switch*/ int main(){ char nota; printf(" Digite su nota:\n "); scanf("%c",&nota); switch(nota){ case 'A': printf("\nExcelente"); break; case 'B': printf("\nNotable"); break; case 'C': printf("\nP...
C
#include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> using namespace cv; int main(int argc, char *argv[]) { // 変数宣言 Mat img; // カメラのキャプチャ VideoCapture cap(0); // キャプチャのエラー処理 if (!cap.isOpened()) return -1; while (1) { // カメラ映像の取得 cap >> img; // 映像の表示 namedWindow("Camera", CV_WINDOW_...
C
#include <stdio.h> #include <string.h> struct Drivers { char name[23]; char route[12]; int dlNo; int kms; } d1, d2, d3; int main() { printf("Enter the name of first dirver\n"); scanf("%s", &d1.name); printf("Enter the dlNo of first dirver\n"); scanf("%d", &d1.dlNo); printf("Enter t...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* push_swap.h :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "monty.h" /** * analize - analize the code * @stack: the stack * @line_number: number of the line * Return: 0 on failure, else 1 **/ int analize(stack_t **stack, unsigned int line_number) { int type_i; instruction_t type[] = { {"push", push_func...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<unistd.h> #include<signal.h> #include<sys/wait.h> #include<sys/socket.h> #include<arpa/inet.h> #define BUF_SIZE 30 void read_childproc(int sig) { pid_t pid; int status; pid = waitpid(-1, &status, WNOHANG); printf("removed...