language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include<stdio.h> #include<stdlib.h> void quicksort(long signed int a[],long signed int l,long signed int r) { if(r>l){ long signed int i, j, v, t; v = a[r]; i = l-1; j = r; for(;;) { while (a[++i] < v); while (a[--j] > v); if(i >= j)...
C
#include <lcom/lcf.h> #include <stdint.h> #include <stdio.h> #include "macro_mouse.h" #include "keyboard.h" #include "macro.h" #include "mouse.h" int bit_id_mouse = 12; int ih_mouse_fail; //checks if interrupt handler function was called properly uint8_t read_byte; //byte read during interrupts int (mouse_subscribe...
C
#include "buffers.h" #include "window.h" #include "vector.h" #include "app.h" #include "scene.h" #include <stdio.h> float color_buffer[MAX_WIN_H][MAX_WIN_W][4]; float depth_buffer[MAX_WIN_H][MAX_WIN_W]; int stencil_buffer[MAX_WIN_H][MAX_WIN_W]; POINT g_buffer[MAX_WIN_H][MAX_WIN_W]; float shadow_buffer[MAX_WIN_H][MAX_W...
C
#ifndef VECTOR_H #define VECTOR_H /* Initial vector capacity */ #define VECTOR_INIT_CAPACITY 10 struct vector { void **items; /* The internal array of the vector */ int capacity; /* The amount of elements the vector can currently keep track of */ int size; /* The current number of elements in the vector */ }; ...
C
#ifndef __VOTING_COORDINATOR_H__ #define __VOTING_COORDINATOR_H__ #include <stdio.h> #include <electionguard/voting/messages.h> #include <electionguard/voting/tracker.h> // @todo jwaksbaum What sort of assurances do we make about the // machine being shut off? How does it persist votes? typedef struct Voting_Coordi...
C
// print multiplication table using command line arguments. #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int counter, number; if(argc <= 1) { printf("you have forgot to type number to calculate multiplicaion table."); printf("\nEnter a number to print multiplicaion table: ...
C
#include<stdio.h> int main() { long int a, b, h; double x; scanf("%ld%ld", &a, &b); x = (2.0 * a) / (double)b; if((x - (long int)x) > 0) printf("%ld",(long int)x + 1); else printf("%ld",(long int)x); return 0; }
C
#include <string.h> #include "header.h" int parse_params (int argc, char **argv, int numtags, cl_tag* t) { int ii, ij, status, count; /* Check validity of tags */ for (ii=0; ii<numtags; ii++) { if (strcmp(t[ii].name,"")==0) return TAGERR_NAME; if (t[ii].type > TAGTYPE_STRING) return TAGERR_TYPE; if ...
C
const int MAX=1000; void primeit( double x[MAX], double y[MAX], double xp[MAX], double yp[MAX], int n, bool norm=false) { for(int i=1; i!=n-1; ++i) { double den = x[i+1] - x[i-1]; double num = y[i+1] - y[i-1]; xp[i-1] = x[i]; yp[i-1] = num/den; if(norm) yp[i-1] /= y[i...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* size_hard.c :+: :+: :+: ...
C
/* writen by July from his book The method of Programming 题目描述: 给定一个字符串,要求将字符串前面的若干个字符移到字符串的尾部, 例如将字符串“abcdef”的前3个字符a,b,c移到字符串的尾部,那么 原字符串将变为"defabc",请写一个函数实现此功能 */ #include<stdio.h> //该方法时间复杂度为O(mn),空间复杂度为O(1) void LeftShiftOne(char *s, int n){ //保存第一个字符 char t = s[0]; for(int i = 1;i<n;i++){ ...
C
#include "dominion.h" #include "dominion_helpers.h" #include <string.h> #include <stdio.h> #include "rngs.h" //numHandCards() test void assertTrue(int a, int b){ if(a==b) { printf("TEST SUCCESSFULLY COMPLETED\n"); } else{ printf("TEST FAILED\n"); } } int main() { struct gameState G, oG; int k[10] = {adv...
C
#include "header.h" // Function to Display All Present Node Record *search_node (Record *node) { Record *temp = node; int flag = 0; unsigned int num_id = 0; int index = 1; if (NULL != node) { // Calling Fuction to Take Search Element print ("\n Enter Node to Search: "); num...
C
#include<stdio.h> #include<math.h> int main() { int side1, side2; float h, sq; scanf("%d %d", &side1, &side2); h = side1 * side1 + side2 * side2; sq = h / 2; int temp = 0; while(sq != temp) { temp = sq; sq = (h / temp + temp) / 2; } printf("area of triangle is :%f\n", sq); return 0; }
C
int length (LInt *l){ int r=0; while((*l) !=NULL){ r++; l=&((*l)->prox); } return r; } LInt parteAmeio (LInt *l){ LInt res=NULL,ir; int m=length(&(*l)); int i=1; int n; if (m%2!=0){ n=((m-1)/2); }else{ n=m/2; } if (n==0)return res; res...
C
#include <unistd.h> #include <stdlib.h> #include <string.h> #include <assert.h> #include <commons/log.h> #include "memory.h" #include "ram.h" #include "cache.h" #include "../commons/structures.h" #include "../commons/declarations.h" #include "../commons/error_codes.h" void memory_init() { ram_init(); cache_init(); }...
C
#include <stdio.h> typedef struct { unsigned a,b; }Razlomak; Razlomak skrati (Razlomak raz) { Razlomak rez = raz; int zaj, i; for (i=1; i<=raz.a && i<=raz.b;++i) { if(raz.a%i==0 && raz.b%i==0) zaj=i; } rez.a=raz.a/zaj; rez.b=raz.b/zaj; return r...
C
/* { dg-do run { target { lp64 || ilp32 } } } */ /* { dg-options "-fsanitize=float-cast-overflow -Wno-overflow" } */ /* { dg-additional-options "-ffloat-store" { target { ia32 } } } */ /* { dg-additional-options "-mieee" { target { { alpha*-*-* } || { sh*-*-* } } } } */ #include <limits.h> #include "float-cast.h" int...
C
/******************** (C) COPYRIGHT 2017 SOFT_SENSE PROJECT ********************************** * File Name : init_flash.c * Author : pangda_wang * Date First Issued : 2018/04/08 * Description : flashеIJʼ * version : v1.0 *************************************************************...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <getopt.h> #include <debian-installer/system/subarch.h> static struct option long_options[] = { {"guess", 0, 0, 0}, {0, 0, 0, 0} }; int main(int argc, char *argv[]) { const char *subarch; int guess = 0; while (1) { int option_...
C
#include <stdio.h> //Faça um programa que receba o preço de um produto, calcule e mostre o novo preço, sabendo-se que este sofreu um desconto de 10%. int main(){ int v1; printf("A valor do produto eh:\n"); scanf("%d",&v1); int des = (v1) - (v1 * 10 / 100); pr...
C
#include <stdio.h> #define MAX_COUNT 100 + 1 int main() { int n=0, input[MAX_COUNT]={0}; scanf("%d", &n); for(int i=0; i<n; i++) { scanf("%d", &input[i]); } for(int i=0; i<n; i++) { printf("Pairs for %d:", input[i]); for(int j=1; j<=input[i]; j++) { if(j >= (...
C
/* Navn: Ane Søgaard Jørgensen * Dato: 02/11-2018 * Beskrivelse: Afleveringsopgave 9. Rekursiv og iterativ funktioner, der finder palindromer. */ # include <stdio.h> # include <stdlib.h> # include <string.h> # define MAX_LEN 30 char *is_palindrome_iter(const char *); char *is_palindrome_rec(const char *); int ma...
C
#pragma once #include <stdlib.h> typedef int IndexType; typedef float ValueType; #define MAX_NMODES 8 #ifndef max #define max(a,b) ((a) > (b) ? (a) : (b)) #endif #ifndef min #define min(a,b) ((a) < (b) ? (a) : (b)) #endif //lo is inclusive, hi is exclusive typedef char hash_t; hash_t *hash_create (); vo...
C
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward d...
C
#include <stdio.h> #include <stdlib.h> //DONE int main(int argc, char const *argv[]) { int c = -1; int steps = 0; while(c<=1){ printf("Input the number greater than 1\n"); scanf("%d",&c); if (c<=1) { printf("Number smaller or equal to 1\n"); continue; ...
C
#define N 4 int is_diag_dom( int mat[ ][N]); double fabs(double x); double sum=0,diag,temp; int check = 1;// The value which is outputted is_diag_dom(int mat[][N]){ for (int i=0; i<N;i++){ diag = mat[i][i];// Finds the diagonal element of the current row sum=0;// Resets the sum ...
C
/* ********************************* * Programa testador do TAD Pilha ********************************* */ #include <stdio.h> #include "pilha.h" int main() { // criando pilhas vazias Pilha *p = cria_pilha(); Pilha *p2 = cria_pilha(); // tentando imprimir a pilha (ainda vazia neste momento) imprime_pilha(p)...
C
/* * redirect_rewrite.c * * Created on: Apr 15, 2013 * Author: Sebastian Mäki */ #include "redirect_rewrite.h" #include "urldecode.h" /* The default buffer size is the maximum path portion size * that IE can handle, so we should never have to realloc */ #define BUF_SIZE 2048 /* In case we do have to realloc, ...
C
/* * license and disclaimer for the use of this source code as per statement below * Lizenz und Haftungsausschluss f� die Verwendung dieses Sourcecodes siehe unten */ #include "ring.h" #include "../DynamicMemory.h" void ring_construct(ring_t* ring) { ring->current = 0; ring->begin = 0; } static void putI...
C
/* * vtrr.h * * Created on: Jun 4, 2020 * Author: krad2 */ #ifndef INCLUDE_SCHEDULERS_VTRR_H_ #define INCLUDE_SCHEDULERS_VTRR_H_ #include <stdint.h> #include <stddef.h> #include <stdbool.h> #include <limits.h> #include "rbtree.h" #ifdef __cplusplus extern "C" { #endif /*---------------------------------...
C
#include<stdio.h> #include<stdlib.h> #define maxStudents 250; //void rollNumberDetails(int); struct student; void yearOfJoining(int,int,struct student*[]); typedef struct student { int rollNumber; char nameStudent[20]; char nameDepartment[20]; char nameCourse[20]; int yearJoining; }student ; int main () { in...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* tags_and_links.c :+: :+: :+: ...
C
/****************** CLIENT CODE ****************/ #include <stdio.h> #include <sys/socket.h> #include <netinet/in.h> #include <string.h> #include <errno.h> int main(int argc , char *argv[]) { int port = 8888; if (argc > 1) { port = atoi(argv[1]); printf("Port number: %d\n", port); ...
C
/* * * MOR ActionLog AGI script * Copyright Mindaugas Kezys / Kolmisoft 2012 * * v1.0 * * 2012.07.06 v1.0 Initial release * * This AGI updates DB ivr_action_log with the info from IVR */ #include <stdio.h> #include <stdarg.h> #include <mysql.h> #include <mysql/errmsg.h> #include <time.h> #include <sys/stat.h> #incl...
C
#include<stdio.h> #include<stdlib.h> typedef struct elemento_pilha{ char info; struct elemento_pilha *prox; }elemento_pilha; elemento_pilha *topo; elemento_pilha* cria_pl(void){ return NULL; } void push(char dado){ elemento_pilha *novo; novo = (elemento_pilha *)malloc(sizeof(elemento_pilha)); ...
C
/* Nmeros perfeitos */ /**************************************************************/ /* Computacao Cientifica - EEL 7021 /* Grupo 9B /* Bruno Luiz da Silva Matricula:11103495 /* Vincius Bernardi Matricula:11100737 /* Exercicio 4 /**************************************************...
C
#include <stdio.h> typedef struct //三階方陣結構 { float element[3][3]; }matrix; const matrix I = {1,0,0,0,1,0,0,0,1}; //三階單位矩陣 float three_det(matrix A); //三階方陣行列式 //........................三階方陣的加減乘.........................// matrix matrix_add(matrix A, matrix B); //三階方陣加法 matrix matrix_sub(matrix A, matrix B)...
C
#include<stdio.h> #include<string.h> int x; int main(){ char str_arr[20][20]={"water","air","milk","coffee"}; for(int i=0;i<10;i++){ for(int j=0;j<10;j++){ printf("%c",str_arr[i][j]); } printf("\n"); } return 0; }
C
/** ****************************************************************************** * File Name : main.h * Description : This file contains the common defines of the application ****************************************************************************** */ #ifndef __MAIN_H #define __MAIN_H ...
C
#include <stdio.h> #define true 1 #define false 0 #define is_leaf(n)\ { ((n == NULL) ? true : false) } int main() { char* c = NULL; int bools = is_leaf(c); printf("result : %s\n", is_leaf(c) ? "true" : "false"); return 0; }
C
#include "array.h" #include <stdio.h> #include <malloc.h> int main (void){ Array a = array_new(10); for (int i = 0; i < 100; i++){ array_insertBack(&a, 2); } array_print(a); array_destroy(a); return 0; }
C
#include <stdio.h> #include <math.h> #include <cs50.h> int main(int argc, const char * argv[]) { float total = 0, cents, change; int quarters = 0, dimes = 0, nickels = 0, pennies = 0; printf("How much change are you owed? \n"); change = GetFloat(); if (change <= .0) { printf("Bogus...
C
#include <stdio.h> #include <sys/time.h> #include "timebreak.h" /* Created for us by rpcgen - has everything we need ! */ int timebreak( CLIENT *clnt, long *sec) { int *result; result = timebreak_1(sec,clnt); if (result==NULL) { fprintf(stderr,"Trouble calling remote procedure timebreak\n"); exit(0);...
C
#include <fcntl.h> #include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <time.h> #include <unistd.h> #define MAX_NUM 50000 // Dealing with the array void swap(int *xp, int *yp); void printArray(); void writeArray(char *file); void generateArray(); // Dealing with the threads + mutex for accessing glo...
C
#include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <math.h> #include <pthread.h> # define MAX_THREADS 16 # define INTEGRAL_TOP 1 # define INTEGRAL_BOTTOM 0 static int id; pthread_t threads[MAX_THREADS]; double pi_parts[MAX_THREADS]; /* Formula for PI calculation */ double formula(double x) { ...
C
#include "clientUtils.h" void Handshake(const int *sockPtr, struct addrinfo *servAddr, Pacote **pacote){ send_msg(sockPtr, servAddr, pacote, SYN); recv_msg(sockPtr, servAddr, pacote); send_msg(sockPtr, servAddr, pacote, ACK); } void recv_msg(const int *sockPtr, struct addrinfo *servAddr, Pacote **pkt){ ...
C
#include<math.h> #include<stdio.h> #include<stdlib.h> #include<unistd.h> #include"rdm.h" #define I 5.644079999999997 //compute integral of 6-x^2-y^2-z^2-u^2-v^2 double f(double x,double y,double z,double u,double v) { return 6.-x*x-y*y-z*z-u*u-v*v; } int main() { //prepare a file to write data ...
C
/* Este programa serve para ilustrar algumas funcionalidades da biblioteca ncurses, que é uma versão para Linux mais poderosa que a coino do windows. Ela serve para criar displays que podem servir, mais adiante, para criação d jogos simples. Será utilizada no trabalho final da cadeira de Algoritmos e Programação. No m...
C
#include <math.h> #include <stdio.h> #include "tad_lista.h" #include <stdlib.h> struct lista{ int qtd;//quem diferencia a lista de um vetor. Com ela //controlamos em tempo de execução quantos elementos nossa lista possui int tam_inicial;//vai guardar o tamanho inicial int aux;//vai guardar a atual...
C
// // main.c // quick_sort // // Copyright (c) 2012 __MyCompanyName__. All rights reserved. // #include <stdio.h> #include <time.h> int quick_sort(int array[], int p, int r); int partition(int array[], int p, int q); int quick_sort(int array[], int p, int r) { if (p < r) { int q = partition(array, p, r...
C
#include<stdio.h> #include<string.h> #include<stdlib.h> #include<malloc.h> #include<math.h> char operation[6][10]={"FILL(1)","FILL(2)","DROP(1)","DROP(2)","POUR(1,2)","POUR(2,1)"}; struct queue{ int a; int b; int fa; int step; char op[10]; }q[1000000]; int v[105][105]; int main(){ int num1,num2,...
C
bool isSubsequence(char * s, char * t){ for (int i = 0; i < strlen(t); i++) { if (*s == t[i]) s++; } return *s == '\0'; }
C
#include <stdio.h> #include <stdlib.h> #include "include/queue.h" void main() { int i; Initqueue(); printf("the queue is empty? %d\n",is_empty()); enqueue(1); enqueue(2); enqueue(4); printf("the queue is empty? %d\n",is_empty()); printf("the length of queue is :%d\n",queuetraverse()); printf("top number in the...
C
#include <stdio.h> int main() { int num[10]={1,5,9,4,8,3,0,2,6,7},*a,*b; a=&num[2];//storing the address of num[2] in variable a b=&num[6];//storing the address of num[6] in variable b printf("a = %d\n",a); printf("b = %d\n",b); printf("a-b = %d\n",b-a);//prints the number of elements betwe...
C
# include <stdio.h> # include <sys/types.h> # include <sys/stat.h> # include <unistd.h> # include <fcntl.h> # include "../../sb.h" main (int argc, char *argv[] ) { int fd , acc_no; Account acc; if ( argc != 2 ) do_exit ( 1, "Usage: balance <acc_no> \n" ); fd = open ( "info.data", O_RDONLY ); acc_no = atoi ( ar...
C
#include <planck/kmalloc.h> #include <arch/earlyoutput.h> #include <stdint.h> #include <string.h> extern void *__brk_base, *__brk_limit; static uintptr_t brk_base; static uintptr_t brk_limit; void KiAllocInitialize() { brk_base = (uintptr_t)&__brk_base; brk_limit = (uintptr_t)&__brk_limit; } void *malloc(si...
C
/** * @brief It implements the set * * @file set.c * @author Julia Simon y Miguel Rodriguez * @version 1.0 * @date 14-02-2018 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "../include/set.h" /** * @brief Estructura del set */ struct _Set { Id id[MAX_ID]; /*!< identificador del obj...
C
#include <stdio.h> //To convert Centigrade to Fahrenheit void main() { float Ct,Fh; printf("Enter the Temperature in Centigrade:\n"); scanf("%f",&Ct); Fh=(Ct*1.8)+32.0; printf("The Temperature in Fahrenheit:%f",Fh); }
C
#include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <stdlib.h> /** * @Author Megan Thomas & Cody Krueger * @Date 24 SEP 2018 * CIS 457 Data Comm * PRJ 1-A UDP Echo Client with Sliding Window * **/ int isValidIpAddress(char ...
C
#include <wiringPi.h> #define DEL 10 void clear() { for (int i = 0; i < 8; i++) { digitalWrite(i, LOW); delay(DEL); } } void range(int time) { for (int i = 0; i< 8; i++) { digitalWrite(i, HIGH); delay(time); digitalWrite(i, LOW); delay(time); } } void blinkAll(int time) { for (int i = 0; i < 8; i++) { di...
C
/* * ===================================================================================== * * Filename: struct_rational.c * * Description: 结构体习题2-有理数结构体 * * Version: 1.1 * Created: Tuesday, December 31, 2013 09:45:45 CST * Revision: none * Compiler: gcc * * ...
C
#include "struct.h" #include "lem_in.h" /* ** JUST FOR TESTING********************** */ void print_input(t_input *input) { t_input *copy; copy = input; printf("\n---PRINT INPUT---\n"); while (copy) { printf("%s\n", copy->line); copy = copy ? copy->next : NULL; } // printf("CMD = %s\n", stor->cmd ? (...
C
#include "meminfo.h" /********************auxiliary functions definitions**********************/ void print_mallinfostats(struct mallinfo minfo); void *mem_get_mallinfo(void *arg); int get_type(char *line); int find_index(long long int *array); long long int get_mmap_size(char *line, Mem_info *mem_info); int find_addr...
C
//#include <stdio.h> // //int main() //{ // for (int i = 0; i < 10; i++) { // printf("%d ", i); // if (i == 5) { // break; // } // } // printf("\n"); // // double money = 0; // printf("请输入您要取的钱数:"); // while (1) { // scanf("%lf", &money); // if (money ...
C
#include<stdio.h> int main() { FILE *fptr; char ch; int n; fptr=fopen("myfile.txt","w"); scanf("%c%d",&ch,&n); fprintf(fptr,"%c%d",ch,n); fclose(fptr); return 0; }
C
#include <iostream> using namespace std; int main() { int lbDzieci(0); if (lbDzieci > 0) { cout << "Masz dzieci. Brawo!" << endl; } else { cout << "Ojej, nie masz dzieci?" << endl; } cout << "Koniec programu" << endl; return 0; }
C
/** Copyright 2018 Andrew Cunningham, andyham@uw.edu, 1610973 Abhyudaya Gupta CSE 474 SU 2018 Lab 3 Defines many constants needed for initialization and declares many functions */ #include "header.h" // defines some header functions used in main.c void Enable_All_GPIO(void) { SYSCTL_RCGC...
C
#include <stdio.h> #include <string.h> /* 1) Alice and Bob agree on an elliptic curve EE over a Field FqFq and a basepoint P∈E/FqP∈E/Fq. (Easily done) 2) Alice generates a (random) secret kAkA and computes PA=kAPPA=kAP. Point Arithmetic 3) Bob generates a (random) secret kBkB and computes PB=kBP...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include"funcoes.h" struct filmess{ //depois de usar a strtok passa pra string int codigo; char titulo[100]; int ano; int quantidade; char genero[10]; }vetor[42]; int carregar(){ FILE *arquivo; int n; //numero total de filmes int c=0;//codi...
C
#ifndef __XORSHIFT #define __XORSHIFT #include <stdint.h> struct xorshift { typedef uint_fast32_t result_type; /* The state must be seeded so that it is not everywhere zero. */ uint64_t s[2]; xorshift() { s[0] = 1234567; s[1] = 7654321; } void seed(uint64_t s1, uint64_t s2) { s[0] = s1; s...
C
#include <stdio.h> int main() { int n, teste, qtddiv=0, i; scanf("%d", &n); if(n<0) { printf("Numero Invalido!"); } else { for(i=1; i<=n; i++) { teste=n/i; if(n%i==0) { qtddiv++; } } ...
C
// // spo2_algo.c // CIndexOut // // Created by 倪申雷 on 2021/2/20. // #include "spo2_algo.h" #include <stdlib.h> #include <string.h> // AddressSanitizer (detects addressability issues) int doSpo2Algo(void) { int spo2_size = 10; Student* spo2_array = (Student*)malloc((spo2_size) * sizeof(Student)); // 将某...
C
#ifndef PC_2018_07_RESPONSE_H #define PC_2018_07_RESPONSE_H #include <stdint.h> #include <stdbool.h> #include <string.h> #include <stdlib.h> #include <stdio.h> #include <netdb.h> #include <arpa/inet.h> #include <netinet/in.h> #include "buffer.h" #include "lib.h" struct response { uint8_t * mediaType; bool...
C
#include "mytimer.h" /* time-out parameter */ struct itimerval p_timeout; /* functions that are related to the timer */ void init_timer(void *function) { memset(&p_timeout, 0, sizeof(p_timeout)); p_timeout.it_value.tv_sec = 0; p_timeout.it_value.tv_usec = 0; p_timeout.it_interval.tv_sec = 0; p_timeout.it_interva...
C
/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (c) 2015 National Instruments * * (C) Copyright 2015 * Joe Hershberger <joe.hershberger@ni.com> */ #ifndef __ETH_RAW_OS_H #define __ETH_RAW_OS_H #define IFNAMSIZ 16 /** * struct eth_sandbox_raw_priv - raw socket session * * sd: socket descriptor - the ope...
C
#include "snake.h" /** @file wprowadzenie_wypisanie_nicku.c \brief Przechowuje definicje funkcji odpowiedzialnych za rysowanie klawiatury, pobranie i wypisanie nicku. */ /** * \fn void wypisz_nick(BITMAP * bufor, char * nick, int dlugosc_nicku) * \brief Funkcja wypisuje nick zawarty w tablicy nick[]. ...
C
#include "tl_process.h" #include "tl_thread.h" #include <stdlib.h> #include <stdio.h> static volatile int value = 0; static tl_mutex* mutex; static tl_monitor* mon; static void* mutex_thread( void* arg ) { tl_sleep( 100 ); if( !tl_mutex_lock( mutex, 1000 ) ) exit( EXIT_FAILURE ); if( !tl_mute...
C
//pic12f683 // https://www.youtube.com/watch?v=hkW5O5FCzMg // Button turn on LED //Binary converter: http://www.binaryconvert.com/convert_signed_char.html unsigned char i = 0; void main(void) { TRISIO = 0b00000010; // TRISIO = 0x02; CMCON0 = 0b00000111; //Shutting of comparative module ANSEL = 0; // tells m...
C
// °F to °c and K #include <stdio.h> #include <conio.h> void Temperatures (double Fahrenheit); int main (void) { double F; printf("input a Temperatures in °F"); printf("(float)\n:"); scanf("%lf",&F); // printf(" test %d %f",F,F); // getch(); while (F>0) { Temperatures(F); F = 0; scanf("%lf",&F); } pr...
C
// Recursive solution, Time Limit Exceeded int climbStairs(int n) { if(n <= 2) { return n; } else { return climbStairs(n-1) + climbStairs(n-2); } } // DP solution int climbStairs(int n) { vector<int> result(n+1, 0); result[1] = 1; result[2] = 2; for(int i = 3; i <= n; i++) { res...
C
#include <stdio.h> #include <stdlib.h> #define T 5 int main() { int * pint; int * paux; pint = (int*) calloc(T, sizeof(int*)); for(int i=0; i<T; i++) { printf("%d\n",*(pint+i)); } pint = (int*) malloc(sizeof(int)*T);/**< asigno espacio en memoria del heap para el puntero*/ if(p...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <math.h> #define MAXLINES 5000 #define BUFSIZE 10000 #define LINES 10 char *line[MAXLINES]; int readlines(char *lineptr[], char *buf, int nlines); void printlines(char *lien[], int nlines, int n); int main(int argc, const char * argv[]) { int...
C
//This program receives an integer as a parameter and modifies the array elements by multiplying each one by 10 //Pointers are to be used for the putpose of this program //this program uses the principle of passing by address(reference) #include <stdio.h> void MUL_BY_10(int *arr); //i is a counter //n is the ...
C
#include<stdio.h> #include "array_util.h" int sum_ints(int L[], int size) { int i; int S = 0; for (i = 0; i < size; i++) { S = S + L[i]; } return S; } int main(void) { int fibo_list[10]; int idx; int S; fibo_list[0] = 1; fibo_list[1] = 1; for (idx ...
C
#ifndef _IP_SET_COUNTER_H #define _IP_SET_COUNTER_H /* Copyright (C) 2015 Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifdef...
C
// // Created by camek on 12/02/2020. // #include "lowerCase.h" #include "ctype.h" #include <stdio.h> void toLowerCase(char sentence[MAX_CHAR]) { int i; for(i = 0; sentence[i] != '\0'; i++) // runs until null terminator is present { sentence[i] = (char) tolower((int)sentence[i]); // casts the char ...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> int main() { #ifdef TKD freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif unsigned int n, res; while(1) { scanf("%u", &n); if(n==0) break; res = sqrt(n); if(res*res==n) printf("...
C
extern int reverse(int x) { int num=0; for(;x>0;) { num=(num*10) + (x%10); x/=10; } return num; }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> #include <sys/types.h> #include <sys/socket.h> #include <unistd.h> #include <netdb.h> #include <pthread.h> #define PORT "80" #define HOSTNAME NULL #define MAX_CONNECTIONS 10 const char header[] = "HTTP/1.1 200 OK\nContent-Type: text/html\r...
C
/** *_strncat - concatenates two strings *@dest: pointer parameter destination *@src: pointer parameter source *@n: parameter integer number *Return: destination variable */ char *_strncat(char *dest, char *src, int n) { int i = 0, j = 0, x = 0, k = 0, y = 0; while (dest[i]) i++; while (src[y]) y++; if...
C
#include <stdio.h> #include <math.h> // Nhap vao 2 day so, tinh gia tri theo cong thuc int main() { float x[100], y[100]; int n, i; float s1, s2; // Nhap du lieu cho mang printf("Nhap so phan tu: "); scanf("%d", &n); for (i = 0; i < n; i++) { printf("Nhap x[%d]: ", i); scanf("%f", &x[i]); printf("Nh...
C
/* ========================================================================== */ /* === CHOLMOD/MATLAB/mread mexFunction ===================================== */ /* ========================================================================== */ /* -------------------------------------------------------------------------...
C
//calcAsFunction #include<stdio.h> #include <stdlib.h> float add(int,int); float subtract(int,int); float multiple(int,int); float divide(int,int); int main() { int a,b; float result; char op; printf("Enter two numbers :\n"); scanf("%d %d",&a,&b); printf("Enter +, -, *, /: "); scanf(...
C
#include <assert.h> #include <complexe.h> #include <mnblas.h> #include <stdio.h> int main(int argc, char const *argv[]) { printf("TEST DES FONCTIONS BLAS1 COPY :\n"); // ---- FLOAT ---- float af[5] = {1.0, 2.0, 3.0, 4.0, 5.0}; float bf[5]; mncblas_scopy(5, af, 1, bf, 1); int i; for (i = 0; i < 5; i++) { as...
C
/* 输入人名和对应人名买的书籍金额,要求输入根据花费金额大小的人名排行 如输入:名字长度20以内 3 A B C 4 A 1000 B 1000 B 2000 C 2000 输出: B C A 只使用了数组和字符串交换函数 */ #include <stdio.h> #include <string.h> int main(void){ int n, m; scanf("%d", &n); //输入人名个数 char name[n][20]; //名字数组 char book[20]; //临时储存人名变量 int price; //临时储存金额变量 ...
C
#ifndef DATASTRUCTURES_BS_TREE_H_ #define DATASTRUCTURES_BS_TREE_H_ #define BST_LINE_T "|--- " #define BST_LINE_L "'--- " #define BST_LINE_I "| " #define BST_BLANK " " typedef int (*tree_cmp_fn)(void *, void *); typedef void (*tree_traverse_fn)(void *, void *); typedef struct tree_node tree_node; struct tree_n...
C
#include "srt_quick.h" #include "srt_tools.h" int part(char **a, int lo, int hi) { char *pivot = a[(lo+hi)/2]; int i = lo-1, j = hi+1; while(i < j) { do ++i; while(cmp(pivot, a[i])); do --j; while(cmp(a[j], pivot)); if(i < j...
C
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> int main() { int n; scanf("%d", &n); int row; row = (n*n) - ((n-1)*(n-1)); for (int i=1;i<=row;i++) { for (int j=1;j<=row;j++) { int r,c; int diff; if(r...
C
/** * Zentralbung 10 * * Frage 1 * * Schreiben Sie ein vollstndiges C-Programm welches Personendaten erfasst und in eine Textdatei schreibt. * Erfasst werden sollen der Nachname und das Geburtsjahr der Personen. Es soll zunchst eine Textdatei * erstellt werden und der Nutzer gefragt werden, ob er Daten eingeben...