language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include<stdio.h> struct tree { struct tree*l; int a; struct tree*r; }; struct tree*create(struct tree*,int); void inorder(struct tree*); void preorder(struct tree*); void postorder(struct tree*); struct tree*root; void main() { int n,num,i; printf("enter the no. of values insert in the binary searc...
C
/*The city bus stations are located at equal distances (unit distance) from each other along a straight road. Each station has a unique station ID. The buses do not travel to all of the bus stations. The highway administration needs to determine the total distance that the buses cover. Given the IDs of the bus station...
C
#include <stdio.h> #include <stdlib.h> int main(){ int numero, idade; char t; printf("Digite seu numero de aluno: "); scanf("%d",&numero); printf("Digite sua idade :"); scanf("%d", &idade); printf("E trabalhador estudante ? [S] ou [N]"); getch("%c",t); printf("\nBem-Vindo ...
C
#include <stdio.h> #include <stdlib.h> #define less(A, B) (A < B) #define exchange(A, B) {int t = B; B = A; A = t;} void selectionSort(int * v, int l, int r) { int menor; for(int i = l; i < r; i++) { menor = i; for(int j = i; j < r; j++) { if(v[j] < v[menor]) { meno...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "calculations.h" void usage(); FTYPE input_fract(char* var_name, int quiet); //for inputting fractions FTYPE input_exp(char* var_name, int quiet); void print_int(interval inp); void newline(); int main(int argc, char* argv[]) { int i, opt, var, ...
C
#include "../../includes/verify.h" #include "../../includes/math_functions_double.h" #include "double_sqrt.h" int main() { /* * REQ-BL-0730: * The sqrt and sqrtf procedures shall return the argument if the argument x is +-0 or +Inf. */ double x = 1.0/0.0; // INF __VERIFIER_precond_reach(); double r...
C
#include "../rfxswf.h" static inline double sqr(double x) {return x*x;} static void draw_line(float*row, float x1, float x2, float y1, float y2, int min, int max) { if(x2<x1) {int x=x1;x1=x2;x2=x;} if(x1<min || x2>max) { fprintf(stderr, "error: glyph x stroke out of bounds\n"); return; } x1 -= min; ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int ip_placement(int a, int b, int c, int d) { int result = 0; a <<= 24; b <<= 16; c <<= 8; result += a; result += b; result += c; result += d; return result; } int main(int argc, char** argv) { char* string = argv[...
C
// num ϴ Լ ϰ, ̸ ȣϴ main Լ ۼ #include <stdio.h> #define _CRT_SECURE_NO_WARNNINGS void Swap3(int *ptr1, int *ptr2, int *ptr3) { /*int temp = *ptr3; *ptr3 = *ptr2; *ptr2 = *ptr1; *ptr1 = temp;*/ // ߴ ˰ ݴ ´. ̷ ڵ ˰ ϰ ڵ ؾ . int temp = *ptr1; *ptr1 = *ptr2; *ptr2 = *ptr3; *ptr3 = te...
C
/* * normalPCA.c * * Created on: Apr 2, 2016 * Author: sfma * Description: normalPCA, well, normalSVD proposed in "Multi-Fourier spectra descriptor and augmentation with * spectral clustering for 3D shape retrieval", whose implementation has much in common to pointPCA. Because I * cannot find a stable s...
C
#pragma once #define MAX_VERTEX_NUM 20 #define INTEGER_MAX 0xffff // -----图的邻接矩阵存储表示----- // VRType: 顶点关系类型。对于无权图,用1或0表示是否相邻;对于带权图,为权值类型。 typedef int VRType; // VertexType: 顶点类型 typedef char VertexType; // GraphKind: 图的类型 typedef enum{ DG, UDG, DN, UDN } GraphKind; // 有向图,无向图,有向网,无向网 // InfoType: 弧的相关信息 typedef...
C
/* -*- linux-c -*- * * Copyright (c) 2003 by Intel Corp. * (C) Copyright IBM Corp. 2003 * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. This * file and program are li...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> typedef struct { int x, y, rad, index; } Circle; Circle circles[1080]; int circleCount; short visited[1080]; int main() { scanf("%d", &circleCount); int remaining = circleCount - 1; Circle curr; int i; for(i = 0;...
C
#include<stdio.h> typedef struct complex{ int real,im; }complex; complex product(complex a,complex b); void print(complex); int main(){ complex c1,c2; scanf("%d%d%d%d",&c1.real,&c1.im,&c2.real,&c2.im); complex ans=product(c1,c2); print(ans); return 0; } complex product(complex a,complex b){ ...
C
#include<stdio.h> #include<ctype.h> #include<string.h> #include<stdlib.h> int main(){ char ch, buffer[50]; FILE *fp; int j = 0, lineno = 1; fp = fopen("program.txt", "r"); if(fp == NULL){ printf("Error opening file.\n"); exit(0); }else{ while((ch = fgetc(fp)) != EOF){ ...
C
#include <stdio.h> #include <string.h> #define DIM 5 void writeBinary(FILE *, char [], int [], int); void loadBinary(FILE *, char [], int [], int); int main(){ FILE *fp; char filename[DIM + 1]; int content[DIM]; int i; scanf("%s", filename); for(i = 0; i < DIM; i++){ scanf("%d", &co...
C
#pragma once struct CellsRange { CellsRange(int const cStart = 0, int const rStart = 0, int const cEnd = 0, int const rEnd = 0) : colStart{ cStart }, rowStart{ rStart }, colEnd{ cEnd }, rowEnd{ rEnd } {} int const colStart; int const rowStart; int const colEnd; int const rowEnd; };
C
#include <stdio.h> #include <fcntl.h> #include <string.h> int sum[150]; char inputstring[150]; int inputint[150]; void addstring(char *s,int l) { int c=0; int j=149; int t,i; for(i=0;i<150;i++) inputint[i]=0; for(i=l-1;i>=0;i--){ inputint[j--]=s[i]-...
C
// Questão 2) [SEMANA01_q02.c] Escreva um programa que receba 2 números inteiros distintos e apresente na tela uma lista ordenada contendo os números e seus respectivos antecessores e sucessores. Assuma que os números de entrada são sempre 2 unidades maior que o outro, ainda que possam vir em qualquer ordem. Entrada : ...
C
/* ex.3.5 */ /* Write the function itob(n,s,b) that converts the integer n into a */ /* base b character representation in the string s. In particular, */ /* itob(n,s,16) formats s as a hexadecimal integer in s. */ #include <limits.h> #include <stdio.h> #include <stdlib.h> #define BUFSIZE 512 /* reverse: reverse li...
C
// section 1.10 // ex 1-20: write a program that replaces tabs with spaces, // using the proper number of spaces for each column #include <stdio.h> #define TABLENGTH 8 // 8 spaces per tab #define MAXLINE 1024 int getline_f(char[], int); int detab(char[], char[]); int main() { int len = 0, len2 = 0; // for copying...
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> int main() { int a, b; int i; scanf("%d %d", &a, &b); int max = a > b ? a : b; int min = a < b ? a : b; for (i = min; i <= max; i++) printf("%d ", i); return 0; }
C
/* * list.h * * Created on: Aug 22, 2019 * Author: wanji-hxy */ #ifndef INCLUDE_LIST_H_ #define INCLUDE_LIST_H_ #ifndef NULL #define NULL (void *)0 #endif typedef unsigned int u32; //the struct of the list struct list_head { struct list_head *next, *prev; }; /************************************...
C
// // main.c // listADT // #include <stdio.h> #include <assert.h> #include "listADT.h" #include <stdlib.h> elemType doble (elemType elem){ return elem * 2; } int main(void) { listADT list1 = newList(); assert(size(list1)==0); assert(add(list1, 10)==1); assert(size(list1)==1); asse...
C
#include <wiringPi.h> #include <stdio.h> #include <stdlib.h> #include <stdint.h> #define MAXTIMINGS 85 #define DHTPIN 7 int dht_dat[5]={0, 0, 0, 0, 0}; void read_dht_dat(){ uint8_t laststate = HIGH; uint8_t counter = 0; uint8_t j = 0, i; float f; dht_dat[0] = dht_dat[1] = dht_dat[2] = dht_dat[3] = dht_dat[4] = ...
C
#include "functions.h" void print_decrypted(char message[] ,char row_1[] ,char row_2[] ,char row_3[] ,int message_id[] ,int row_number[],int position){ int i; for(i = 0; i < strlen(message); i++){ if (message_id[i] == 12){ message[i] = ' '; row_number[i] = 0; continu...
C
#include "/players/francesco/univ/ansi.h" #define tp this_player() #define tpn this_player()->query_name() #define tpp this_player()->query_possessive() inherit "room/room"; reset(arg) { if(arg) return; set_light(1); short_desc = "Letters Department" ; long_desc = " The library of the Letters Department co...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> const long ENF = (long)1<<32; int n; long k; int lis[501]; int cache[501]; long count[501]; int answer[50][500]; int answerLis[50]; int len; //병합 정렬 소스 void merge(int arr[], int start, int half, int end){ int temp[end-start+1]; for(int i = 0; i<end-start+...
C
/* 说明: 数字为正整数,长度不超过九位,不考虑小数,转化结果为英文小写; 输出格式为twenty two; 非法数据请返回“error”; 关键字提示:and,billion,million,thousand,hundred。 输入描述: 输入一个long型整数 输出描述: 输出相应的英文写法 示例1 输入 复制 2356 输出 复制 two thousand three hundred and fifty six 递归 */ #include <stdio.h> #include <string.h> const char *dgt[] = {"", "one", "two", "three", "fou...
C
#include <stdio.h> #include <stdlib.h> /* This is an understandably difficult exercise for many (including myself, even today). I recommend starting with ex1c, which demonstrates a contigious 2d array. The underlying idea is the same, but it's very easy to mess up. I have added a few print statements so you can verif...
C
#include "sys.h" #include "delay.h" #include "usart.h" #include "led.h" #include "FreeRTOS.h" #include "task.h" #include "time.h" /************************************************ ALIENTEK սSTM32F103 FreeRTOSʵ2-1 FreeRTOSֲʵ-⺯汾 ֧֣www.openedv.com Ա̣http://eboard.taobao.com ע΢Źƽ̨΢źţ"ԭ"ѻȡSTM32ϡ ӿƼ޹˾ ߣԭ @ALIENTEK ...
C
/* auther: C.H King * buildtime: 2013/5/3 * m^x*x/n */ #include <stdio.h> long long gcd (long long a, long long b) { if (b == 0)return a; return gcd (b, a%b); } int main () { int t, iCase; long long n, m; scanf ("%d", &t); for (iCase = 1; iCase <= t; ++ iCase){ scanf ("%lld%lld", &n, &m); int i; long ...
C
#include<stdio.h> int main(){ int n,m,y=0,i,j; char p; scanf("%d %d",&n,&m); for(i=0;i<=n;i++){ for(j=0;j<=m;j++){ scanf("%c",&p); if(p=='C' || p=='M' || p=='Y'){ y=1; } } } if(y==0){ printf("#Black&White...
C
#ifndef LISTA_H #define LISTA_H #include <stdbool.h> #include <stdlib.h> // Primitivas básicas struct lista; typedef struct lista lista_t; // Crea una lista. // Post devuelve una lista vacia. lista_t *lista_crear(void); // Devuelve true o false depende de si hay elementos en la lista. // Pre: La lista fue c...
C
#include <gtk/gtk.h> #include <time.h> static void hello(GtkWidget *widget, gpointer data) { printf("Hello World\n"); } static void show_time(GtkWidget *widget, gpointer data) { time_t t; char buffer[16]; struct tm *tm_info; time(&t); tm_info = localtime(&t); strftime(buffer, 16, "%H:%M:%S", tm_info); print...
C
#include <stdio.h> /* Recursive way to find fibonacci numbers. int fib(int n) { if (n <= 1) return n; return fib(n - 1) + fib(n - 2); } */ // More efficient way to find fibonacci numbers. int fib(int n) { int f[n+2]; // 1 extra to handle case, n = 0 f[0] = ...
C
#include "phoneBook.h" /*********************************************main******************************************************/ int main() { Person** person; int count; person = (Person**)malloc(sizeof(Person*) * 200); // ȭȣ ִ 뷮 200 if (person == NULL) { puts("Error\n"); return -1; } count =...
C
#include <stdio.c> typedef struct{ char titulo[30], autor[30]; unsigned int genero, editora, paginas; float peso; char isbn[1]; } Livros; int main(void){ int titulos=2, autores=2, generos=2, editoras=2, paginas=2, pesos=2, isbn=2; for Livros biblioteca [titulos][autores][generos] [editoras][paginas]...
C
#include <stdio.h> // prototyping double owed_amount(double interest_rate, double previously_owed, double purchase_amount, double monthly_payment) { double amount_due; amount_due = previously_owed + purchase_amount + ((purchase_amount+previously_owed)*interest_rate) - monthly_payment; if(...
C
#include "dog.h" #include <stdlib.h> /** * new_dog - initialize a variable of type struct dog. * @name: name parameter * @age: age parameter * @owner: owner parameter * Return: pointer */ dog_t *new_dog(char *name, float age, char *owner) { dog_t *new; char *newname, *newowner; int i = 0, j = 0, k; new = ma...
C
#include <stdlib.h> #include <stdio.h> #ifndef LINKED_LIST_H #define LINKED_LIST_H struct Node { struct Node *next; int value; char *key; }; size_t ll_length(char *list); struct Node *node_new(char key[], int value); void ll_add_node_to_head(struct Node **head, char key[], int value); void ll_print_list...
C
#include "get_next_line.h" #include <fcntl.h> #include <stdlib.h> #include <unistd.h> #include "libft/libft.h" int main(int argc, char **argv) { int fd; char *s; (void)argc; fd = open(argv[1], O_RDONLY); while (get_next_line(fd, &s)) { ft_putendl(s); free(s); } //sleep(30); return (0); }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #define ARG_SIZE 20 #define ARGS_NUMBER 20 #define PATHS_NUMBER 20 void cleanTable(char* table[], int elementsNumber) { int i; for(i = 0; i < elementsNumber; i++) table[i] = NULL; } v...
C
/*! \file icmp.c \brief ICMP Protocol Library. */ //***************************************************************************** // // File Name : 'icmp.c' // Title : ICMP (Internet Control Message Protocol) Protocol Library // Author : Pascal Stang // Created : 9/10/2004 // Revised : 7/3/2005 // Version ...
C
/*========================================================= 7-6` ƱƧǪk Radix_Sort() ƱƧǪk禡 get_key() oSwƭ(pӦ,Q) a[ARR_NUM] ƧǤ ARR_NUM ƧǤƼƥ(}Cjp) ========================================================= */ #inclu...
C
#ifndef _LSH_COMMON_H #define _LSH_COMMON_H #include <stdint.h> typedef uint8_t u8; /* 8-bit type */ typedef uint32_t u32; /* 32-bit type */ typedef uint64_t u64; /* 64-bit type */ typedef uint8_t Byte; /* type for raw data */ typedef uint64_t DataLength; /* 64-bit word */ //We are on a little-endian...
C
#include<stdio.h> int main() { int a=1, b=0, c=0; for (a = 1; a < 8; a++) { printf("%d\n", a); if (a <= 4) { for (b = 3; b > b - a; b--); printf(" "); } } }
C
/** * \file manip_bits.c * \brief Représente les fonctions concernant la manipulation de structures bas niveau. * \author Clément CAUMES * */ #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include "../inc/errors.h" #include "../inc/key_schedule.h" /** * \fn uint8_t get_bit_uint64_t (uint64_t ele...
C
/* gcc example1.c -lOftp -o example1 ./example1 */ #include <stdio.h> #include <string.h> #include <errno.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> #include <sys/time.h> #include <sys/socket.h> #include <netdb.h> #include <sys/stat.h> #include <netinet/in.h> #include <netdb.h> #include <fc...
C
#include<stdio.h> #include<stdlib.h> void additem(); void deleteitem(); void updatebill(); void displaycart(); int stock[5][3]={{0,0,0},{1,12,100},{2,15,200},{3,17,150},{4,25,250}}; typedef struct{ int code; int quantity; float cost; }cartitems; cartitems c[10]; //array of structure int inum=...
C
#include <stdlib.h> static int ft_strlen(const char *str) { int i; i = 0; while (str[i] != '\0') i++; return (i); } char *ft_strrchr(const char *s, int c) { char *last_c; if ((char)c == '\0') return ((char *)&s[ft_strlen(s)]); last_c = (char *)malloc(sizeof(char) * 1); last_c = (char *) NULL; while (*...
C
// This file is a dummy C file to aid in showing how to clone and pull with Git. #include <stdlib.h> void main(int argv, char *argc) { // It had to be done... printf("Hello world!\n"); }
C
/* VECTORES */ /* EJERCICIO 6 PAG 149 */ #include <stdlib.h> #include <stdio.h> #include <conio.h> #define NUM 5 void CARGAR ( int [] , int ); void MIRAR ( int [] , int ); int ORDEN( int [] , int ); int main() { int VEC[NUM] ; rand()%100; CARGAR( VEC, NUM ); MIRAR( VEC, ...
C
#include <stdio.h> #include <errno.h> #include <sys/stat.h> #include "config.h" #include "mkdirp.h" #define BUFFER_LEN 1024 static int exist_dir(char *buffer) { struct stat _s; stat(buffer, &_s); if (S_ISDIR(_s.st_mode)) { return 1; } else if (S_ISLNK(_s.st_mode)) { char buffer_link_v...
C
#include <stdio.h> //0-1 knapsack problem #define MAX 10000 inline int max(int a,int b){ return (a>b)?a:b; } int dp[MAX][MAX]; void init(int size,int weight){ for(int i=0;i<=size;i++){ for(int j=0;j<=weight;j++){ dp[i][j]=-1; } } } int knap(int *val,int *w,int i,int weight){ ...
C
#include <linux/module.h> #include <linux/init.h> #include <linux/fs.h> #include <linux/cdev.h> #include <linux/uaccess.h> #include <linux/gpio.h> /* Meta Information */ MODULE_LICENSE("GPL"); MODULE_AUTHOR("Johannes 4 GNU/Linux"); MODULE_DESCRIPTION("A simple gpio driver for setting a LED and reading a button"); /* ...
C
#include "holberton.h" /** *jack_bauer - outputting the time from 00:00 to 23:59 *Description: printing out all minutes of the time till 23:59 *Return: no value is returned * */ void jack_bauer(void) { int i = 0, j = 0, k, l, f, s; while (i <= 23) { while (j <= 59) { s = j % 10; f = j / 10; l = i...
C
/* Kelompok : UAS Nama file : grafRuangan.h Deskripsi : ADT Graf Ruangan dengan implementasi multilist*/ #ifndef GRAFRUANGAN_H #define GRAFRUANGAN_H #include "../../../std.h" #include "../ruangan.h" #include "../door.h" /* Definisi Graf : */ /* Graf kosong : GR_First(GR) = Nil */ /* Setiap Node dengan addres...
C
#include <stdio.h> int main(int argc, char *argv[]) { int distance = 100; char initial = 'A'; char fist_name[] = "Zed"; char last_name[] = "Shaw"; printf("you are %s %s", fist_name, last_name); printf(", you are %d miles away\n", distance); return 0; }
C
/* * da6T1.c * * Created: 5/3/2016 6:33:22 PM * Author : Izzy */ #define F_CPU 8000000UL // declare clock frequency as 8MHz for delay function #include <avr/io.h> // library for I/O #include <stdint.h> // needed for uintX_t variables #include <avr/interrupt.h> // library for ADC interrupt #include <...
C
#include <stdio.h> #include <stdlib.h> // auxiliary function to check if writing was done correctly int** check_file(FILE *file){ int signal_size; fread(&signal_size, sizeof(int), 1, file); printf("\n"); double x[signal_size], y[signal_size], xy[signal_size], xy_true[signal_size]; fread(&x, s...
C
//최대 힙 //입력 - 첫째 줄에 연산의 개수 n, 다음 줄에 연산에 대한 정보를 나타내는 정수 x //출력 - 입력에서 0이 주어진 회수만큼 답을 출력. //만약 배열이 비어있는 경우에 가장 큰 값을 출력하라고 한 경우에는 0을 출력 #include <stdio.h> #define MAX_SIZE 100001 int visited[MAX_SIZE]; //노드와 노드의 자리를 바꿔주는 함수 void nodeChange(int *a, int *b){ int temp = *a; *a = *b; *b = temp; } //우선순위 큐를 구조체...
C
#include <stdio.h> #include "atoi.h" #include "itoa.h" #include "test.h" int main() { char dest[180]; TestEqualInt (atoi("123") , 123); TestEqualInt (atoi("-123") , -123); TestEqualInt (atoi(" -123") , -123); TestEqualInt (atoi(" 123") , 123); TestEqualInt (atoi(" 12h3") , 12); TestE...
C
# include <stdio.h> # include <math.h> int main(void) { int a = 0; int b = 0; int c = 0; printf("Type the length of the the first side/ side A: "); scanf("%d", a); printf("Type the length of the the first side/ side B: "); scanf("%d", b); a^2 + b^2 = c; double sqrt(double c); printf("The sides of the triangle measure:...
C
#ifndef SNAKE_GAME_H_ #define SNAKE_GAME_H_ #include <stdint.h> #include "list.h" #define SNAKE_MAP_WIDTH 40 //Size for the game board #define SNAKE_MAP_HEIGHT 40 #define SNAKE_SPEED 150 //Time between each snake movement, lower -> faster snake #define MAX_SNAKE_LENGTH 45 //You win the game when you reach this lengt...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "arbol.h" #define absoluto(x) ((x)<0? -(x):(x)) ////////////////////////// void crearArbol(t_arbol *p) { *p= NULL; } /////////////////////////// void enOrden( const t_arbol *p) { if(*p) { enOrden(&(*p)->izq); verNodo(&(*p...
C
// // prob4.c // // // Created by Pablo Cecilio on 20/10/2017. // #include <stdio.h> void PRAUM (int a, int b) { int n=1, soma=0; int i; if (a<b) { for (i=a+1; i<b-1; i++) n++; int s[n]; for (i=1; i<=n; i++) { s[i-1]=a+i; soma+=s[i-1]; ...
C
#include <stdio.h> int main() { FILE *fp; fp = fopen("test.txt", "w+"); fprintf(fp, "This is text goes in the file...\n"); fputs("This text also goes into the file...\n", fp); fclose(fp); return 0; }
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
/** * Computacion Paralela (Curso 15-16) * * Colocacion de antenas * Version secuencial * * @author Mulero Lorenzo, Marcos */ // Includes generales #include <stdlib.h> #include <stdio.h> #include <limits.h> #include <mpi.h> // Include para las utilidades de computación paralela #include "cputils.h" /** * E...
C
/* * blur.c * Taken from unsharp.c, originally: * Copyright (C) 1999 Winston Chang * <winstonc@cs.wisc.edu> * <winston@stdout.org> * * 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...
C
#include <stdio.h> #include <allegro5/allegro.h> int main(int argc, char **argv) { ALLEGRO_DISPLAY *display = NULL; ALLEGRO_EVENT_QUEUE *event_queue = NULL; // Initialize Allegro Library if (!al_init()) { fprintf(stderr, "failed to initialize allegro\n"); return -1; } // Create...
C
#include <stdio.h> #include <stdlib.h> #include "Node.h" /* ** 函数功能: 对带头节点的无序单链表删除重复的节点 ** 输入参数: head指向链表头节点 */ void RemoveDup(LinkList head) { if (head == NULL || head->next == NULL) { return; } LNode *outerCur = head->next; //外层循环指针, 指向链表的第一个节点 LNode *innerCur = NULL; //内层循环遍历outer...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_print_rights.c :+: :+: :+: ...
C
/* ************************************************************************** */ /* */ /* :::::::: */ /* set_to_print.c :+: :+: ...
C
#ifndef QUEUE_H #define QUEUE_H /* * queue.h */ #include <stdlib.h> #include <string.h> #include <stdio.h> #include <semaphore.h> #include "uthash.h" #define QUEUE_SIZE 10 struct Order_{ char book_title[256]; float price; char id[128]; char category[128]; }; typedef struct Order_* Order; struct shm...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_ltoa_base.c :+: :+: :+: ...
C
int f(int x) { switch(x) { case 1: return 2; case 2: break; default: return 3; } return 4; } void g(int y) { int i; switch (y) { case 1: break; case 2: { } break; case 3: i++; break; } switch (y) { } switch (y) { ca...
C
#include <stdio.h> #define HB 75 #define year 365 #define day 24 #define hour 60 //q5,chapter4 main(){ unsigned int age; long totBeats=0; printf("Please input your age:\n"); scanf("%d",&age); totBeats=(long)(age*year*day*hour*HB); printf("Your heart has beat about %lu times in your lifeti...
C
/** Code file for hash tables. This is primarily where you will need to add things. */ #include <stdlib.h> #include <string.h> #include <stdio.h> #include "storer.h" #include "htable.h" #include "eprintf.h" #define NEED_XMALLOC #include "C_util.h" #include "hash.h" static const int NHASH = 5000; static State ...
C
/* * Example program for the Allegro library, by Shawn Hargreaves. * * This program demonstrates how to support double buffering, page * flipping, and triple buffering as options within a single program, * and how to make things run at a constant rate no matter what the * speed of your compu...
C
/** * \file src/Common/poski_LogFileHandler.c * \brief Handle the message output file. * * This module implements the message output file \<poski_logfile\> support routines based on the environment variable POSKI_LOG_FILE. * * This module sets \<poski_logfile\> to "poski_log.txt" if POSKI_LOG_FILE==1, or to s...
C
#pragma once /* * help() - Print a help message */ void help(char *progname); /* * die() - print an error and exit the program */ void die(const char *msg1, const char *msg2); /* * connect_to_server() - open a connection to the server specified by the * parameters */ int connect_to_serve...
C
#include <stdio.h> #include <assert.h> #include "hvr_common.h" static void verify_id_construction(int pe, uint64_t offset) { uint64_t id = construct_vertex_id(pe, offset); uint64_t computed_pe = VERTEX_ID_PE(id); uint64_t computed_offset = VERTEX_ID_OFFSET(id); if (computed_pe != pe || computed_offs...
C
#include "holberton.h" /** * puts_half -- a function that prints half of a string, followed * by a new line. * * @str: incoming string * * * * Return: Always 0 (Success) * */ void puts_half(char *str) { int count = 0, half = 0; while (str[count] != '\0') { count++; } for (; half < (count / 2) ; h...
C
/* GTThread Scheduler C Source File */ #include "gtthread_sched.h" /* Variable declarations */ struct node * temp; long gt_period; /* Initializes virtual time */ void initVirtualTime(long period) { /* Set gt_period */ gt_period = period; /* Set signal handler to initiate context switch upon receiving SIGVTALRM *...
C
/**/ #include <stdio.h> #include <math.h> int main() { int a, b, c, median; a = 0; b = 0; c = 0; median = 0; printf("Please enter 3 numbers separated by spaces > "); scanf("%d %d %d", &a, &b, &c); if ((a<=b && a>=c) || (a>=b && a<=c)) median = a; else if ((b<=a && b>=c) || (b>=a && b<...
C
// convert hours and minutes to minutes (using functions) #include <stdio.h> int get_total_minutes(int hours, int minutes) { return hours*60 + minutes; } int main() { printf("Enter hours and minutes in format hours:minutes: "); int hours, minutes; scanf("%d:%d", &hours, &minutes); int total_min...
C
/*5# Write a program that produces the following output*/ /* Brazil,Russia,India,China India,China, Brazil,Russia */ /*Have the program use two user-defined functions in addition to main():one named br() that prints"Brazil,Russia" once, and one named ic() that prints"India,China" once.Let main() take care of any additi...
C
#include <stdio.h> #include <stdlib.h> #define MAX_LIN 80 #define SINAL '-' void Erro_Fatal(int num_erro, char *string); int main(int argc, char *argv[]) { FILE *fp = stdin; // stdin por padrão char s[MAX_LIN]; // String int i = 0; // nenhuma linha foi processada ainda int n_lins = 10; // 10 linhas: por pad...
C
#include <stdio.h> int main(void) { /* The following line will print out some text */ printf("Hey!\n"); printf("How are you?\n"); printf("I am fine, thank you.\n"); }
C
// // main.c // prob17 // // Created by Michael Zijlstra on 7/4/12. // Copyright (c) 2012 __MyCompanyName__. All rights reserved. // #include <stdio.h> int transcribe(char * buf, int i) { int count = 0; switch (i / 100) { case 1: buf[count++] = 'o'; buf[count++] = 'n...
C
#include <stdlib.h> #include "huffman_tree.h" #include "huffman_node.h" #include "../common/Bitstream.h" #include "../common/Services.h" #include "huffman_code_tag.h" #include "FrequencyCounter.h" #include "Huffman.h" #include "rle.h" #ifdef _DEBUG #include <assert.h> #endif // in bits, maximum 8! Don't change. // FO...
C
#include <stdio.h> char s[] = "Dies ist ein Test-String. Er enthaelt zwei Saetze."; int main (void) { int count; printf("\nOriginal-String: %s", s); for (count=0; s[count]!=0; count++) { if (s[count] == '.') { s[count+1] = '\0';; break; } } printf("\nGeaenderter String: %s", s); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> void dump(void*, size_t, int); int main() { char *text = "I love to break free"; dump(text, strlen(text) + 1, 5); int array[] = { 7, 3, 2, 10, -5 }; size_t size = sizeof(array) / sizeof(int); dump(array, size * sizeo...
C
/// MentOS, The Mentoring Operating system project /// @file isr.c /// @brief Functions which manage the Interrupt Service Routines (ISRs). /// @copyright (c) 2019 This file is distributed under the MIT License. /// See LICENSE.md for details. #include "isr.h" #include "idt.h" #include "stdio.h" #includ...
C
int ft_str_is_uppercase(char *str); #include <stdio.h> int main() { char str[] = "FdSa fDsafsd FdfDS 45 fds"; printf("%d", ft_str_is_uppercase(str)); return (0); }
C
int MaxSum2(int *A, int n) { int nStart = A[n-1]; int nAll = A[n-1]; for(int i = n-2;i>=0;--i) { if(nStart<0) nStart = 0; nStart += A[i]; if(nStart>=nAll) { nAll = nStart; } } return nAll; }
C
#include "my_tar.h" // initialize the head of linked list of arguments tar_arg* init_args() { tar_arg* head = (tar_arg*)malloc(sizeof(tar_arg)); head->filename = NULL; head->next = NULL; return head; } // add filename to the linked list void add_to_list(tar_arg** args, char* filename) { tar_arg* ...
C
/*入两个整数,求他们相除的余数。用带参的宏来实现,编程序。 输入 a b两个数 输出 a/b的余数 样例输入 3 2 样例输出 1 */ #include<stdio.h> #define CHANGE(a,b) a % b int main(void) { int a, b, t; scanf("%d%d",&a,&b); t =CHANGE(a, b); printf("%d",t); return 0; }