language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include<stdio.h> int fib(int n) { if(n==1||n==2) return 1; return(fib(n-1)+fib(n-2)); } main() { int n,x,i; printf("enter nth no. of fibonacci"); scanf("%d",&n); printf("%d",fib(n)); printf("\nenter no. to print fibonacci"); scanf("%d",&x); for(i=1;i<=x;i++) { printf(" %d ",fib(i)); } }
C
/* acc.c Purpose: An integer accumulation and calculation program. Allows for the user to enter any integer in binary, octal, hexadecimal, or decimal mode, and have that integer displayed in binary, octal, hex, and decimal bases. Also allows simple bit-level calculations including negation, bitwise bool...
C
/*====================================================================================================*/ /*====================================================================================================*/ #include "drivers\stm32f3_system.h" #include "modules\module_serial.h" #include "main.h" /*==================...
C
// Maciej Poleski #ifndef DEBUG #ifndef NDEBUG #define NDEBUG #endif #define init(x,y) #define end() #define check(x) #else #include <stdio.h> #include <stdlib.h> void init(int argc,char**argv) { if(argc!=3) { fprintf(stderr,"Potrzebne są dwa argumenty <wejście> <wyjście>\n"); exit(1); } ...
C
/* - Questão 3.20 - */ /* diretivas ao pré-processador */ #include <stdio.h> /* necessária para as funções printf e scanf */ # include <stdlib.h> /* necessária para a função system */ /* início da função main (execução principal do programa) */ int main( void ) { /* declaração das variáveis do tipo ponto...
C
#include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <unistd.h> void *tfn1(void *arg) { printf("the thread\n"); sleep(3); printf("the thread done\n"); return NULL; } int main(void) { int err; pthread_t tid; err=pthread_create(&tid,NULL,tfn1,NULL); if(err!=0) { printf("can't create thread %d\n...
C
#include "holberton.h" #include <stdlib.h> /** *string_nconcat - Concatenate two strings * * */ char *string_nconcat(char *s1, char *s2, unsigned int n) { char *p; unsigned int i, j, counter = 0; if (s1 == '\0') { s1 = ""; } if (s2 == '\0') { s2 = ""; } for (i = 0; s1[i]; i++) { } for (j = 0; s...
C
// HTTP GET request handlers typedef struct { char *fileName; void (*fn)(void); } getRequestType; // HTTP parameter setting handlers typedef struct { char *paramName; void (*fn)(char *); } httpParamType; // CLI command typedef struct { char *cmdName; void (*fn)(void); } cmdT...
C
#include <fcntl.h> #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include "holberton.h" /** *read_textfile - 0 *@filename: filename *@letters: number of letters *Return: ssize_t */ ssize_t read_textfile(const char *filename, size_t letters) { char *c; int file, b; unsigned long int a; if (!filename) ...
C
/* : osccal.c * : Christian Starkjohann * : microsin.ru * : 2008-04-10 * : 4 * Copyright: (c) 2008 by OBJECTIVE DEVELOPMENT Software GmbH * : GNU GPL v2 (. License.txt) (CommercialLicense.txt) * : $Id: osccal.c 553 2008-04-17 19:00:20Z cs $ */ #include <avr/io.h> /* ---------------------------------------...
C
//Most functions taken from Neill_sdl.c, these have Neill in the function name, added draw_turtle here to avoid having SDL in my main parser.c function. #include "ashley_sdl.h" void Neill_SDL_Init(SDL_Simplewin *sw) { if (SDL_Init(SDL_INIT_VIDEO) != 0) { fprintf(stderr, "\nUnable to initialize SDL: %s\n"...
C
#include <stdio.h> void squeeze(char *s1, char *s2) { char *temp = s1; //用于存储每次修改的值 char *newstr = temp; //用于初始化修改后的值 while ('\0' != *s2){ s1 = newstr; temp = newstr; while ('\0' != *s1){ if (*s1 != *s2){ *temp++ = *s1; } s1++; } *temp = '\0'; s2++; } } int main(void) { char s1[] =...
C
// error.c // Řešení IJC-DU1, příklad b), 25.3.2015 // Autor: Radovan Sroka, FIT // Přeloženo: gcc 4.9.2 20150204 #include "error.h" #include <stdio.h> #include <stdarg.h> #include <string.h> #include <stdlib.h> const int max_lenght_of_message = 500; void FatalError(const char *fmt, ...){ va_list arguments; va...
C
/* * @Author: zero * @Date: 2021-07-14 08:29:21 * @Description: Evaluate the value of an arithmetic expression in Reverse Polish Notation. * Valid operators are +, -, *, and /. * Each operand may be an integer or another expression. * Division between two integers should truncate toward zero. */ #include <string.h> #...
C
// PROGRAMAÇÃO IMPERATIVA // 50 QUESTÕES #include <stdio.h> #include <stdlib.h> #include <string.h> // 1 int main1 () { int x; int maior = 0; scanf("%d", &x); while (x != 0) { if (x > maior) { maior = x; } scanf("%d", &x); } printf("%d\n", maior); retu...
C
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ SINGLE-HEADER C/++ IMGUI LIBRARY ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ DESCRIPTION This is a single-header library that provides the input groundwork for an immediate-mode GUI s...
C
/* ** free.c for epitech in /home/chapui_s/travaux/malloc/ ** ** Made by chapui_s ** Login <chapui_s@epitech.eu> ** ** Started on Sun Feb 15 19:50:03 2015 chapui_s ** Last update Sun Feb 15 23:03:29 2015 chapui_s */ #include "rbmalloc.h" extern t_malloc g_info; static void invalid_pointer(void *ptr) { printf("E...
C
#include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <string.h> #include <fcntl.h> void *print_message_function (void *ptr); main () { pthread_t thread1, thread2; pthread_attr_t attr; int ret; pthread_attr_init(&attr); ret=pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); /*if i ...
C
/* $NetBSD: expr_binary.c,v 1.7 2023/03/28 14:44:34 rillig Exp $ */ # 3 "expr_binary.c" /* * Test binary operators. */ /* lint1-only-if: lp64 */ /* lint1-extra-flags: -X 351 */ struct incompatible { /* just to generate the error message */ int member; }; void sink(struct incompatible); /* * Test the usual arit...
C
#pragma once #ifndef main_h #define main_h ///////////////////////////////////////////////// /// Definicion De Firmas de Funciones ///////////////////////////////////////////////// /** * Encargada de obtener el primer valor del archivo recibido con el Fin * de poder acceder a la cantidad de vertices que posee el nodo...
C
#include <stdio.h> #include <SDL2/SDL.h> #include "./constants.h" int game_is_running = FALSE; SDL_Window *window = NULL; SDL_Renderer *renderer = NULL; int initialize_window(void) { if (SDL_Init(SDL_INIT_EVERYTHING) != 0) { fprintf(stderr, "Erro ao iniciar o SDL.\n"); return FALSE; } w...
C
//To count the digits in a number #include<stdio.h> int main() { int a,b=0; printf("Enter the number = "); scanf("%d",&a); while(a>0) { a/=10; ++b; } printf("No. of digits is %d",b); return(0); }
C
/****************************************************************************** ** Student name: Jia Jun Yong ** Student number: s3688090 ** Course: Advanced Programming Techniques - S2 2018 ******************************************************************************/ #ifndef POP_H #define POP_H ...
C
#include <stdio.h> #include <stdlib.h> #ifndef WIN32 #include <sys/time.h> #include <unistd.h> #include <pthread.h> #include <signal.h> #else #include <process.h> #include <Windows.h> #include <ShlObj.h> #endif // !WIN32 #include "common.h" int platform_is_admin(void) { #ifndef WIN32 return (...
C
#include <stdio.h> #include <stdlib.h> #include <pthread.h> #include "input.h" #include "interface.h" #include "processo.h" #ifndef COMUM #define COMUM #include "comum.h" #endif int lin, col; tempo t; frame frames[FRAMES]; processo processos[PROCESSOS]; pthread_t tid[PROCESSOS]; int ultimo_proc = 0; // processo...
C
#include<stdio.h> #include<malloc/malloc.h> #include "PLIB2.h" #define N 6 //頂点の数 static int adj[N][N]={ //隣接行列:(隣接有り = 1, 隣接無し = 0) {0,1,0,1,1,0}, {1,0,1,0,1,0}, {0,1,0,0,1,0}, {1,0,0,0,1,1}, {1,1,1,1,0,1}, {0,0,0,1,1,0}, }; static char V[N+1]="S12345"; static int start=0; static int end=5; int main(void){...
C
/*********************************** * FileName: briupBasePeriph.c * CreateDate: 2017-8-24 * Author: Dennis Chen * Description: Իӿڵʵļ * Update: -------- ***********************************/ #include "briupBasePeriph.h" /****************** * FunctionName: basePeriphInit(); * Desciption: ʼ躯ӿ * Input: NULL * Output:...
C
// Program uses for loop to take input and print elements of a one-dimensional array // Header Files #include<stdio.h> // Start of main function int main() { // variable and array Declaration int arr[5], i; /*for loop to take input elements from the user and store it in an array element*/ for(i = 0...
C
#include "holberton.h" #include <stdio.h> /** * _putchar - writes chars c to standard output stream * @c: char to print * * Return: if succesfull, 1 will be returned, else -1 if error */ int _putchar(char c) { return (write(1, &c, 1)); }
C
/* ** EPITECH PROJECT, 2019 ** minishell1 ** File description: ** some functions obviously */ #include "mysh.h" #include <stdlib.h> #include <stddef.h> void print_env(shell_t *shell) { for (int i = 0; shell->env_dup[i] != NULL; i++) { my_putstr(shell->env_dup[i]); my_putchar('\n'); } } int m...
C
#include "arrstack.h" static int max_l = STACKSIZE - 1; static int max_r = 0; int push_l(float num, float stack[], int pos, int side) { if(side == RIGHT) { if(pos <= max_r) printf("STACK IS FULL!"); else { pos--; stack[pos] = num; ...
C
/* \mainpage Linguagens Programao I \author Rui Moreira \author Daniel Mendes 26385 \author Gonalo Silva 26329 \version 1.0 \date 2016 R1. Permitir ao utilizador armazenar e gerir um ou mais conjuntos de peas de domin, i.e., inserir e/ou remover as peas iniciais dum jogo de mo usado no ...
C
#include <stdlib.h> #include <stdio.h> #include "thinkgear.h" void wait() { printf( "\n" ); printf( "Press the ENTER key...\n" ); fflush( stdout ); getc( stdin ); } /** * Program which prints ThinkGear EEG_POWERS values to stdout. */ int main( void ) { char *comPortName = NULL; int ...
C
//Rewrite the function so that it has just one return statement // double median (double x, double y, double z) { double result; if (x <= y) if (y <= z) result = y; else if (x <= z) result = z; else result = x; else { if (z <= y) result = y; else if (x <= z) result = x; else result = z; } retur...
C
#include "0cc.h" void walk(Node* node) { switch (node->type) { case '=': walk(node->lhs); walk(node->rhs); break; case '+': if (node->lhs->type != ND_IDENT) break; if (node->lhs->dtype->type == PTR) { if (node->lhs->dtype->pointer_of->type == PTR) node->rhs->value *= 8; ...
C
/* * @Author: Huang Yuhui * @Date: 2019-03-20 11:22:08 * @Last Modified by: Huang Yuhui * @Last Modified time: 2019-03-20 11:28:59 */ /* * 题目修改题-题目描述如下: * * 函数'fun'的功能是:根据整型形参'n',计算如下公式值: A1 = 1, A2 = 1/1+A1, A3 = 1/1+A2, ··· , An = 1/1+A(n-1). */ #include <stdlib.h> #include <conio.h> #include <stdio.h>...
C
#include "all.h" /* context-lists.c 1211e */ /* private functions for updating lists of expressions in contexts 1212b */ static void fill_hole(Exp e, Value v) { assert(e->alt == HOLE); e->alt = LITERAL; e->u.literal = v; } /* private functions for updating lists of expressions in contexts 1212c */ static Explist ...
C
#include <iostream> #include <string> using namespace std; bool map[1001][1001]; int main() { int i, j, len, max; string str; getline(cin, str); len = str.length(); max = 1; for (j = 0; j < len; j++){ for (i = 0; i <= j; i++){ if (j - i < 2) map[i][j] = (str[i] == str[j]); else ...
C
#ifndef LIB_H #define LIB_H /// <summary> /// Contains a series of functions as part of a library which is used /// by the driver program to accomplish the program goal. Some of the /// functions in this library includes file reading, parsing, and /// data structures. /// </summary> /// /// <author>Oliver Spryn</auth...
C
#pragma once #include <stdlib.h> #include "vec3.h" #define M_PI 3.1415927 double drand() { return (double)rand() / RAND_MAX; } vec3 random_in_unit_sphere() { vec3 p; do { p = 2.0 * vec3(drand(), drand(), drand()) - vec3(1.0, 1.0, 1.0); } while (p.sqrt_length() >= 1.0); return p; } vec3 random_in_unit_disk...
C
#include <stdio.h> // This code demonstrates how getchar() works. // Point out another way of writing while-statements int main() { char in; while((in = getchar())!='Q') printf("%c", in); return 0; }
C
/* file: tokens.c Written by Anthony V. Edwards, TAVVE Software Co. This file contains the routine TOKENIZE that may be useful for various applications =Tokenize (var token_string: tline; pattern: tline; var tokens: StrPtrArr): byte; The value returned from Tokenize is the number of tokens foun...
C
#include <stdio.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/shm.h> #include "shm.h" main() { int shmid; char * ptr, *pData; int * pInt; if ((shmid = shmget(SHM_KEY, SHM_SIZE, SHM_MODE)) < 0) { perror("shmget"); exit(1); } if ((ptr = shmat(shmid, 0, 0)) == (void * ) - 1) { perror("shmat")...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <error.h> #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <arpa/inet.h> #include <string.h> // truct sockaddr_in { // sa_family_t sin_family; /* address family: AF_INET */ // in_port_t ...
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
/* Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms. */ ...
C
/* ============================================================================ Name : kmeans.c Author : Noy Shabtay Version : 1.0 Copyright : Your copyright notice Description : Kmeans clustering algorithm implementation. ========================================================================...
C
#include<stdio.h> #include<windows.h> #include<stdlib.h> #include<string.h> int CompInt(const void* x, const void* y){ int* n1 = (int*)(x); int* n2 = (int*)(y); if (*n1 > *n2){ return 1; } else if (*n1 < *n2){ return -1; } else{ return 0; } } void PrintArr(int arr[], int size){ for (int i = 0; i < size;...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <math.h> #include "FloydWarshall.h" #include "BFS.h" #include "BetweennessCentrality.h" #include "RandomGraph.h" int main(void) { printf("\n-------------------------------------------------------------------------------------------------" ...
C
#include<stdio.h> int main() { int a,b,x,y,temp,ans; scanf("%d %d",&a,&b); x=a;y=b; while(x!=0) { temp=x; x=x%y; y=temp; } ans=(a*b)/y; printf("%d",ans); }
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> #include "parser.c" // Polymorphism in C typedef struct Pixel{ unsigned int r; //create a pixel struct like discussed in class unsigned int g; unsigned int b; }Pixel; typedef struct Image{ //image struct that ...
C
/* ID: zeyuec1 LANG: C TASK: beads */ #include <stdio.h> #include <stdlib.h> #include <string.h> int N; int necklace[2000]; int isEqual(int next, int* now) { if (*now == 0) { *now = next; return 1; } if (next == *now || next == 0) { return 1; } return 0; } int cal() { ...
C
#include <stdio.h> int N; int end; void f(int n, int board[]) { if (end == 1) { return; } if (n == N) { // end int i; for (i = 1; i < N; i++) { printf("%d", board[i]); } end = 1; } if (n == 1) { board[1] = 1; f(2, board); return; } // 1~3 üũ int num; // Ȯ int tmp_posit...
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
/* * Host Dispatcher Shell Project for SOFE 3950U / CSCI 3020U: Operating Systems * * Copyright (C) 2015, Zeerak Ali Sachin Teckchandani Amal Parameswaran Mohtasim Siddiqui * All rights reserved. * */ #include <stddef.h> #include <stdlib.h> #include <stdio.h> #include <stdbool.h> #include <unistd.h> #include ...
C
#include<stdio.h> int main() { int k,i,j,r=1,c=1,n,a[5][5]; scanf("%d", &n); for(i=0;i<n;i++) for(j=0;j<n;j++) scanf("%d", &a[i][j]); for(i=0;i<n;i++) { if(a[i][0]==0) c=0; if(a[0][i]==0) r=0; } for(i=1;i<n;i++) for(j=1;j<n;j++) { if(a[i][j]==0) a[0][j]=a[...
C
#include "holberton.h" /** * _strspn - Function that gets the length of a prefix substring. * @s: char *s * @accept: char *accept * * Return: unsigned int */ unsigned int _strspn(char *s, char *accept) { unsigned int i, j, counter; counter = 0, i = 0; while (s[i] != '\0') { if (counter != i) break; j ...
C
#ifndef SPOOLER_SHARED_H #define SPOOLER_SHARED_H #include <stdbool.h> #include "spooler.h" /* * Function that initializes sp with a buffer of the provided size. */ void spool_init_shared(spool_t* sp, size_t size); /* * Function that returns if the buffer is empty. */ bool spool_empty(spool_t* sp); /* * Functi...
C
#define _POSIX_SOURCE 1 /* = optenir valeur aleatoire = ecrire dans un fichier avec saute de la ligne ('\r') = filtrage des entier depuis char* */ #include<sys/types.h> #include<sys/wait.h> #include<sys/stat.h> #include<fcntl.h> #include<unistd.h> #include<stdlib.h> #include<stdio.h> #include<time.h> #include<errno.h>...
C
#ifndef EDIT_DISTANCE_GENERATOR_H #define EDIT_DISTANCE_GENERATOR_H #include <stddef.h> #include <stdbool.h> struct edit_iter_frame; struct edit_iter { const char *pattern; const char *alphabet; char *buffer; char *cigar; char *simplify_cigar_buffer; struct edit_iter_frame *frames; }; stru...
C
#include <stdio.h> int main(void) { int i, j, tmp, total = 0; for (i = 1, j = 1; i < 4000000; ) { if (i % 2 == 0) total += i; tmp = i; i = i + j; j = tmp; } printf("%d\n", total); }
C
// 17 may 2015 #include "../ui.h" #include "uipriv.h" struct typeinfo { const char *name; uintmax_t parent; size_t size; }; static struct ptrArray *types = NULL; uintmax_t uiRegisterType(const char *name, uintmax_t parent, size_t size) { struct typeinfo *ti; if (types == NULL) { types = newPtrArray(); // r...
C
/* hello1.c*/ #include <stdio.h> float multiplierpar2(float x) { return 2*x; } int main() { printf("le resultat de 2*5 est : %f\n",multiplierpar2(5)); return 0; }
C
#ifndef LIST_H #define LIST_H #include "include.h" struct node_t { // data should _always_ be self contained, that is, no other pointer should ever access it // while it is in the list void * restrict data; // next should never equal prev, if gcc is smart enough this may speed up list operations struct node_t * ...
C
#include <stdlib.h> #include "binary.h" struct b_binary_tree_t* b_binary_tree_new(struct b_binary_tree_t* self, int (*compare)(void*, void*), void* (*mallocFunc)(size_t), void (*selfFree)(void*), void (*keyFree)(void*), void (*valueFree)(void*)) { if (!mallocFunc) { mallocFunc = malloc; } if (!self) { self = ...
C
/* * Types.h * * Created on: 30 wrz 2016 * Author: Uzume */ #ifndef TYPES_TYPES_H_ #define TYPES_TYPES_H_ #include "stdint.h" struct colortype { colortype() : color(0) { } colortype(uint32_t c) { color = c; } inline uint32_t getColor32(){ return color; } operator uint32_t() const { ...
C
/* Hash table interface. */ /* We implement the hash table as an opaque type, all the work will be done * inside hashtable.c. */ struct hash_table; /* Hash table indexed by null terminated strings. If copy_keys is false then * keys must have lifetime at least equal to that of the associated value, * otherwise ...
C
// This program copies text array with dynamic memory allocation. #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<stdlib.h> #include<string.h> #define N 180 #define M 180 void ReplaceStr(char* Target, char* Source) { int* Memory_Block; //Pointer for a memory block for memory allocaton Memory_Block = (...
C
/** * 2lkup.c * * Computer Science 50 * Problem Set 6 * lookup function * * The sole intention of this program is to undertand how const char* works * and dynamically allocate memory for array * */ #include <stdio.h> #include <stdbool.h> #include <ctype.h> #include <stdlib.h> #include <cs50.h> #include <st...
C
/** ****************************************************************************** * @file driver_timer.c * @author Florent Dumazel Clement Souyri Gabriel Aygalenq * @version V1.0.0 * @date 30-Septembre-2014 * @bref Ce fichier fournit des fonctions pour gerer * les fonctionnalites du ti...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* libft.h :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <libgen.h> #include "archiver.h" void print_info(void) { printf("Info:\n"); } void print_usage(char *app_path) { char *app_name = basename(app_path); printf("\n\tUsage:\n\n" ">> %s [-h]: \n\tprint application infor...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include "structs.h" #include "utils.h" short cost(int x) { int i, n_iter = 20; double dcost = 0; for(i = 0; i < n_iter; i++) dcost += pow(sin((double) x),2) + pow(cos((double) x),2); return (short) (dcost / n_iter + 0.1); } /* c[i,j] 0 ...
C
#ifndef BASE_CVECTOR_H_ #define BASE_CVECTOR_H_ #include <assert.h> /* for assert */ #include <stddef.h> /* for size_t */ #include <stdlib.h> /* for malloc/realloc/free */ /** * @brief cvector_vector_type - The vector type used in this library */ #define cvector_vector_type(type) type * /** * @brief cvector_cr...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include "include/list.h" #include "include/maths.h" #include "include/inout.h" //testing functions void printElement(struct point *node){ printf("next: %lf %lf before: %lf %lf beta: %lf theta: %lf\n relatives: %lf %lf absolutes: %lf %lf", node...
C
/* ** EPITECH PROJECT, 2019 ** PSU_2018_nmobjdump ** File description: ** elf_header */ #include "my_objdump.h" char *get_format(int idt) { if (idt == ELFCLASS32) return ("elf32-x86-64"); else if (idt == ELFCLASS64) return ("elf64-x86-64"); return ("unknow"); } char *get_engine(int eng) {...
C
//================================================================= //ļstudent.h //ߣ // V 1.0.0 //գ201825 // 飺ļԶݽṹ //================================================================= #ifndef H_STUDENT_HH //ֵֹܳظ궨 #define H_STUDENT_HH #include <stdio.h> #include <stdlib.h> ...
C
/** sol08.8b.c ** ------------------------------------------------------------ A larger extension of waitdemo1.c that creates and waits for a number of processes specified on the command line is sol08.8b.c. This program raises an interesting question about computing random numbers with rand(). If the random de...
C
// MESSAGE PARTITION PACKING #define MAVLINK_MSG_ID_PARTITION 2 typedef struct __mavlink_partition_t { uint16_t index; ///< First register that was read out. char ID; ///< Partition ID - make this a general purpose message uint8_t size; ///< Holds how many bytes are of importance, begining from index. uint8_t tog...
C
#include <stdio.h> #define sqr(x) x*x int main(){ printf("%i\n",sqr(3+2)); }
C
// Dwarven Newbie Area: Created By Mist Fall 1994 // Addition to the Dwarven Newbie Area: Mist Spring 1997 #include "path.h" inherit ROOM+"baseroom.c"; object caverat; void setup () { my_setup(); set_short("Realm of the Dwarf: Cave"); set_zone("CAVE"); set_light(40); set_long("\n Realm of...
C
//header.c #include "header.h" #include "header.h" void GotoXY(int x, int y) { COORD Pos; Pos.X = x; Pos.Y = y; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), Pos); } void CursorView(char show) { CONSOLE_CURSOR_INFO ConsoleCursor; ConsoleCursor.bVisible = show; ConsoleCursor.dwSize = 1; SetConsoleC...
C
#include <stdio.h> int facotorial(int N); int main(){ int N,K; scanf("%d %d", &N, &K); int nFac = facotorial(N); int kFac = facotorial(K); int nMink = facotorial(N-K); printf("%d", nFac / (kFac*nMink)); } int facotorial(int N){ if(N==0) return 1; else return N *facotorial(N-1); }
C
// SCU COEN 146 // // This program implements the server side of stop & wait protocol // the server receives file contents from a client // // // For the stop and wait protocol, the assumestions are: // -- packet corruption, and packet loss #include "tfv1.h" // global variables int state = 0; // we only have tw...
C
#include<stdio.h> #include<stdlib.h> struct node { int data; struct node* next; }; struct node*head; void ll_traversal(); void ll_insert_first(); void ll_insert_Atindex(); void ll_randominsert(); void ll_insertlast(); void ll_delete_first(); void ll_delete_atindex(); void ll_delete_atend(); void main(){ in...
C
/******************************************************************************/ /** @file slstore.c @author Kris Wallperington @brief Unit tests for Skiplist data store */ /******************************************************************************/ #include "sltests.h" /** @brief Helper function that create...
C
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { int i, b[100], a[100]; for(i=1; i<=100; i=i+1) { b[i]=i; } a[0]=0; for(i=1; i<=100; i=i+1) { a[i]=b[i]+a[i-1]; } printf("%d\n" ,a[29]); printf("%d\n" ,a[30]); printf("%d\n" ,a[49]); printf("%d\n" ,a[50]); printf("%d\n...
C
//B+ݽṹ #ifndef __BTREE_H_ #define __BTREE_H_ #include "vector.h" #pragma pack() #define BTREE_KEY_NUM 10 #define BTREE_KEY_FULL 2 #define BTREE_KEY_EXIST 0 #define BTREE_KEY_SUC 1 #define BTREE_FAIL -1 #define BTREE_OK 0 #define BT_KEY unsigned long typedef enum { BT_LVL_LEAF = 1, BT_LV...
C
#include <stdio.h> #include <stdlib.h> int main() { /* DICHIARAZIONE */ int A; int B; /* start */ /* IN A, B */ scanf("%i %i", &A, &B); /* condizione A > B */ if( A>B ) { /* blocco di istruzioni ramo Vero */ /* OUT A */ printf("%i", A); } ...
C
#include <stdio.h> #include <string.h> int isPalin(char *inp); int isMirror(char *inp); int compare(char a, char b); int main() { char inp[10000]; register int p,m; while(scanf(" %[^\n]",inp)!=EOF) { p=isPalin(inp); m=isMirror(inp); if(p && m) printf("%s -- is a mir...
C
#include <stdio.h> /* Escrever um algoritmo que gere e escreva os números múltiplos de 11 entre 100 e 200. */ int main (void){ int i = 0; while (i*11 <= 200){ if (11*i >= 100 && 11*i <=200){ printf("%i\n", 11*i); } else if (11*i > 200){ break; } ...
C
/* Name: Jyotishka Bhattacharjee Scholar ID: 2012025 */ #include <stdio.h> int main() { char number[1000]; printf("Enter the value\n"); scanf("%s", number); int i = 0; int condition1 = 0, condition2 = 0; while (number[i] != '\0') { if (number[i] == '.') { condit...
C
#include<stdio.h> #include<conf.h> #include<kernel.h> #include<proc.h> static unsigned long *esp; void printprocstks(int prior) { kprintf("\n#4 printprocstk------------------------\n"); struct pentry *proc; int i; kprintf("pname\tpid\tpriority\tstack base\tstack size\tstack limit\tstack pointer\n"); for(i = 0; ...
C
#include "header.h" /*---------------------------------------------------------funcs for input data base (per line)-----------------------------------*/ /*database_get_pointer_to_*/ input_data* get_data_base() { static input_data data; return &data; } int data_set_line(FILE* file) { input_data...
C
#ifndef DESCOMPACTADOR_H_ #define DESCOMPACTADOR_H_ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include "../include/tree.h" #include "../include/list.h" #include "../include/bitmap.h" #include "../include/huffman.h" #endif /* DESCOMPACTADOR_H_ */ /** * @brief Realiza ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* init_selection_state.c :+: :+: :+: ...
C
#include <stdbool.h> #include <stdio.h> int main(int argc, char const* argv[]) { char A[] = "madam"; int size = sizeof(A) / sizeof(char); bool isPalin; for(int i = 0; i < size; ++i) { if(A[i] == A[size - i]) { isPalin = true; } } if(isPalin) { printf("Palindrome \n"); } else { printf("Not palin...
C
//******************************************************************************************************* // xfersong.c // // DESCRIPTION // // AUTHORS // Jace Hensley (jehensle@asu.edu) // Computer Systems Engineering // Arizona State University //**************************************************************...
C
#include "lifegame.h" void life(char namein[] , char nameout[] , int hei , int wit , int n , int f , char core[]) { int i,j; int image_counter=1; char buf[256]; mat_t mat=mat_alloc(hei,wit); mat_t mat_tmp=mat_alloc(hei , wit); population_t pop=pop_alloc(); population_t pop_dead=pop_alloc(); population_t pop...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* operation_r.c :+: :+: :+: ...