language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* 健康情况练习 */ #include <stdio.h> int main() { int gender = 0, height = 0, weight = 0; printf("请输入性别,身高和体重:"); scanf("%d%d%d", &gender, &height, &weight); if (gender) { if (weight < height - 105) { printf("健康的男人\n"); } else { printf("不健康的男人\n"); } } else { if (w...
C
// Haftalık gelir hesaplama #include<stdio.h> #include<locale.h> // setlocale() //#include<conio.h> // ekran bekletme int main(){ //setlocale(LC_ALL, "Turkish"); // Türkçe karakter desteği sağlanıyor float haftalik, yillik; printf(" Yıllık geliriniz nedir? "); // kullanıcıya mesaj scanf("%f",&y...
C
/*Se o cliente comprar mais de 8 Kg em frutas ou o valor total da compra ultrapassar R$ 25,00, receberá ainda um desconto de 10% sobre este total. Escreva um algoritmo para ler a quantidade (em Kg) de morangos e a quantidade (em Kg) de maças adquiridas e escreva o valor a ser pago pelo cliente....
C
#include <stdio.h> #include <math.h> #define OK 0 #define INP_ERR 1 #define NOT_EXIST 2 #define TRUE 1 #define FALSE 0 #define PRECISION 0.00001 #define RIGHT 5 #define ACUTE 6 #define OBTUSE 7 float triangle(float x1, float y1, float x2, float y2, float x3, float y3) { float a, b, c, h = 0, k = 0, l = 0, t_fir = ...
C
#include<stdio.h> int main() { char s[100]="idsafkl"; char *p=s; //scanf("%s",s); for(p=s;*p!=0;p++) p--; for(;p>=s;p--) putchar(*p); putchar(10); return 0; }
C
int main() { int n; struct ren { char id[10]; int age; } p[100]; struct ren t; int i,j; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%s %d",p[i].id,&p[i].age); } for(i=0;i<n-1;i++) { for(j=0;j<n-1-i;j++) { if(p[j].age<p[j+1].age && p[j+1].age>=60) { t=p[j]; p[j]=...
C
// // msg_buffers.h // chachat // #ifndef __Chachat__msg_buffers__ #define __Chachat__msg_buffers__ // This should be called once as the program starts void init_msg_buffers(); // This will remove all the buffers and free the memory void clear_all_msg_buffers(); // Creates a new message buffer // A client connect...
C
// import java.io.*; // import java.lang.*; // import java.util.*; // #!/usr/bin/python -O #include <stdio.h> #include <stdlib.h> #include <string.h> #include<stdbool.h> #include<limits.h> // #include<iostream> // #include<algorithm> // #include<string> // #include<vector> //using namespace std; /* # Author : @R...
C
#include <assert.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include "sort.h" int* createArray(int len); void validate(int* a, int* c, int l); void testOne(); void testTwo(); void testThree(); void testSeven(); void testEight(); int main(void) { testOne(); testTwo(); testThree(); t...
C
#include <stdio.h> #include <time.h> #define MAX_SIZE 1601 #define ITERATIONS 26 #define SWAP(x,y,t) ((t)=(x),(x)=(y),(y)=(t)) int main(int argc, char const *argv[]) { int i,j,position; int list[MAX_SIZE]; int sizelist[]={0,10,20,30,40,50,60,70,80,90,100,200,300,400,500,600,700,800 ,900,1000,1100,1200,1300,1400,1...
C
#include <stdio.h> #include <unistd.h> void main(){ int pid1 = fork(); int pid2 = fork(); if (pid1==0 && pid2==0) return; else if (pid1==0){ printf("I'm launching ps -ef\n"); execl("/bin/ps","ps","-ef",NULL); } else if (pid2==0){ printf("I'm launching free -h\n"); execl("/usr/bin/free","free","-h",NULL)...
C
/************************************** * Zeyun Yu (zeyun@cs.utexas.edu) * * Department of Computer Science * * University of Texas at Austin * **************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <malloc.h> #include <memory.h> ...
C
// http://elinux.org/Interfacing_with_I2C_Devices #include <stdio.h> #include <stdlib.h> #include "I2C.h" #include "JoystickDevice.h" #define I2C_GAMEPAD_ADDRESS 0x18 #define UPDATE_FREQ 5000 // ms (200Hz) typedef struct { uint16_t buttons; // button status } I2CJoystickStatus; int readI2CJoystick(int file, I2CJ...
C
#include <stdint.h> #include <stdlib.h> #include <mosquitto.h> #include "config.h" #include "mqttsub.h" #include <stdio.h> struct conn_config { char* host; uint16_t port; uint16_t keepalive; }; struct mqtt_client_pub { struct mosquitto* mosq; char* topic; uint32_t mid; uint8_t qos; bool retain; struct conn_c...
C
#include <stdio.h> #include <stdbool.h> #include <errno.h> #include <signal.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> /** * This function creates a listening socket that we can try to connect to * in order to g...
C
int ft_iterative_power(int nb, int power) { int count; int res; res = 1; count = 0; if (power < 0 || (nb == 0 && power > 0)) return (0); if (power == 0) return (1); while (count < power) { res *= nb; count++; } return (res); }
C
/* intconv.c -- some mismatched integer conversions */ #include <stdio.h> #define PAGES 336 #define WORDS 65618 void intconv(void) { short num = PAGES; short mnum = -PAGES; printf("num as short and unsigned short: %hd %hu\n", num, num); printf("-num as short and unsigned short: %hd %hu\n", mnum, m...
C
#include<stdio.h> void main(){ char ch; printf("Enter an alphabet :"); scanf("%c",&ch); if(ch=='a' ||ch == 'A' || ch =='e' || ch =='E' ||ch =='i' || ch =='I' || ch =='o' || ch =='O' ||ch =='u' || ch=='U'){ printf("'%c',is a Vowel",ch); } else{ printf("This is not Vowel"); } }
C
/** ****************************************************************************** * @file main.c * @author zelkhachin ****************************************************************************** */ #include <string.h> #include "stm32f4xx_hal.h" #include "main.h" void GPIO_Init(void); void Error_handle...
C
#include "holberton.h" /** * _isalpha - Check if the character is uppercase *@c: character to look at * * Return: Always 1 if uppercase * iof not always 0 */ int _isalpha(int c) { if (c >= 'A' && c <= 'z') return (1); else return (0); }
C
#include <stdlib.h> #include "binary_trees.h" #include <stdio.h> int binary_tree_heighta(const binary_tree_t *tree); int binary_tree_sizea(const binary_tree_t *tree); /** * binary_tree_is_perfect - returns 1 if the tree is full or 0 if not * @tree: root of tree * Return: returns the balance */ int binary_tree_is_pe...
C
#include <stdio.h> int main (void) { int number, n, divider; printf ("Type in integer \n"); scanf ("%i", &number); do { n = number; divider = 1; while (n > 10) { n /= 10; divider *= 10; } switch (n) { case 1: printf ("one "); break; case 2: printf ("two "); b...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> void traverseLeaves( struct node* node ) { printKeysInNode( getMinNode( node ) ); } // traverseLeaves struct node* getMinNode( struct node* node ) { int i = 0; while ( !node->isLeafNode && node->numChildren > 0 ) { node = node->children[0]; // travers...
C
#include<stdio.h> int main() { printf("<!DOCTYPE html>\n"); printf("<meta charaset=\"UTF-8\">\n"); printf("<title>99</title>\n"); printf("<hl>99</hl>\n"); printf("<table>\n"); printf("<tr>\n"); printf("<th>\n"); printf("<tr>"); for (int y = 0; y<10; ++y){ for (int x = 0; x<10; ++x){ if (x == 0 && y == 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
#include "record.h" #include "utils.h" #include "constants.h" #include "render.h" #include "colors.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <Windows.h> #include <conio.h> #define MAX_COUNT 256 #define HEADER_X_POS (SCREEN_WIDTH / 2 - 19) #define HEADER_Y_POS 2 #define BODY_HORIZONTAL_P...
C
#include <stdio.h> #include <stdlib.h> void main(void){ int line; printf("EnterThe Number of Lines :"); scanf("%d", &line); for (int i = 1; i <= line;i++){ for (int j = 1;j<=i; j++){ printf("*"); } printf("\n"); } }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "vote.h" void vote_prog_1(char *host) { CLIENT *clnt; char * *result_4; char *listcandidates_1_arg; #ifndef DEBUG clnt = clnt_create (host, VOTE_PROG, VOTE_VERS, "udp"); if (clnt == NULL) { clnt_pcreateerror (host); exit (1); } #endif /* D...
C
#include "time.h" unsigned long long timespec_to_nanoseconds(const struct timespec *spec) { return spec->tv_sec * 1e9 + spec->tv_nsec; } unsigned long long timespec_to_duration(const struct timespec *start, const struct timespec *stop) { return timespec_to_nanoseconds(stop) - timespec_to_nanoseconds(start); } un...
C
#include<stdio.h> int* sort(int *a,int n) { int i,j,index,small; small = a[0]; for(i=0;i<n;i++) { index = i; for(j=i+1;j<n;j++) if(a[j]<a[index]) index = j; if(i!=index) { small = a[i]; a[i] = a[index]; a[index] = small; } } return a; }...
C
/*------------------------------- Author - Rohit Kumar Bindal Roll Number - 2017Btechcse306 ------------------------------*/ //Program to sort an Array into Ascending Order. //----------------------------------------------------------------------------// #include<stdio.h> void display(int a[],int size){ for(int ...
C
/* CreateHilosWindows.c */ /* $Id: CreateHilosWindows.c,v 1.1.1.1 2003/06/19 19:00:15 fcardona Exp $ */ #include <Windows.h> #include <stdio.h> #include <stdlib.h> DWORD WINAPI funcion_hilo(LPVOID lpParameter) { int valor = (int) lpParameter; DWORD dwResultado = 0; printf(""); fpri...
C
#include <stdio.h> #include <string.h> #define TOT 200 int rechercher(char* phrase, char* mot){ int i; int k; int existe; char mot_extrait[TOT]; /// on extrait le mot for (i=0;i<=strlen(phrase);i++){ // printf("\t%d,%c",i,*(phrase+i)); k= 0; existe=0; while(*(phrase+i)!=32 && *(phrase+i)!='\0'){ /...
C
// ref: http://www.c-tipsref.com/tips/string/strrchr.html#sample #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) { char s[] = "I don't want to march as much as possible."; char *ret; int c; puts("文字を入力してください。"); c = getchar(); if ((ret = strrchr(s, c)) != NULL) { ...
C
/* * Aim: A C Program to generate sparse matrix. * Author: Rohith * Date: 31-08-2017 */ #include <stdio.h> void main() { int mat[10][10]; int m, n, i, j, count = 0; printf("Enter the order of the matrix (m n): "); scanf("%d%d", &m, &n); printf("Enter the matrix:\n"); for (i = 0; ...
C
#include <stdio.h> #include <signal.h> #include <unistd.h> #include <stdlib.h> #include <errno.h> void catch_sigalrm(int signo) { } unsigned int mysleep(unsigned int seconds) { struct sigaction act,oldact; sigset_t newmask,oldmask,suspmask; act.sa_handler = catch_sigalrm; sigemptyset(&act.sa_mask); act.sa_flags...
C
#include<stdio.h> #include<string.h> int main() { char SZstring[20],ch; printf("\n\nEnter the String;\t"); gets(SZstring); printf("\n\n Enter the character to set:\t"); scanf("%c",&ch); strset(SZstring,ch); printf("\n\nNow String Is:\t"); puts(SZstring); return 0; }
C
#include "stochastic_gradient_descent.h" #include "sparse_matrix_utils.h" sgd_trainer_t *sgd_trainer_new(size_t m, size_t n, bool fit_intercept, regularization_type_t reg_type, double lambda, double gamma_0) { sgd_trainer_t *sgd = calloc(1, sizeof(sgd_trainer_t)); if (sgd == NULL) return NULL; double_matr...
C
#include <stdio.h> int binary_search(int array[], int value, int size) { int found = 0; int high = size, low = 0, mid; mid = (high + low) / 2; printf("\n\nLooking for %d\n", value); while ((! found) && (high >= low)) { printf("Low %d Mid %d High %d\n", low, mid, high); ...
C
#include <stdlib.h> #include <stdio.h> #include "binary_trees.h" /** * basic_tree - Build a basic binary tree * * Return: A pointer to the created tree */ binary_tree_t *basic_tree(void) { binary_tree_t *root; root = binary_tree_node(NULL, 98); root->left = binary_tree_node(root, 12); root->right ...
C
#include <stdio.h> #include <string.h> #include <stdbool.h> #include <stdlib.h> #include "libips.h" #include "common.h" int main(int argc, char **argv) { if(argc != 3 && argc != 4) { printf("USAGE: <DATA FILE> <PATCH FILE>\n"); return -1; } char *out_filename = "patched"; if(argc == 4)...
C
#include <stdio.h> #include <stdlib.h> #include <omp.h> void producer_consumer(int *buffer, int size, int *vec, int n); void seq_producer_consumer(int *buffer, int size, int *vec, int n); int num_t; int main(int argc, char* argv[]){ int n, b_len, i; int* vec, *buff; scanf("%d %d %d",&num_t,&n,&b_len); vec = (int...
C
#include<stdio.h> //print linked list recursively in order and reverse order #include<malloc.h> #include<stdlib.h> struct Node { int data; struct Node* next; }; struct Node* insert(struct Node* head,int data) { struct Node* temp=(struct Node*)malloc(sizeof(struct Node)); tem...
C
/** * lpwan_utils.c * * \date * \author jtuki@foxmail.com * \author */ #include "lpwan_utils.h" #include "lpwan_config.h" /** * \return Positive value if seq1>seq2, else return negative value. * the returned value's absolute value is the delta. */ os_int16 calc_bcn_seq_delta(os_int8 _seq1, os_int8 _...
C
//USART Program //The ATMEGA32 will recieve a serial transmission and send it //Frequency - 8MHZ Operating at 9600BPS #include <avr/io.h> void USART_Init(unsigned int baud); //Initlizae Baud void USART_Transmit(unsigned char data); //Transmission unsigned char USART_Receive(void); //Receive int main(){ unsigned char d...
C
// exam_q5.c // // This program was written by z5165158 // on 18/08/2021 #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_LINE_SIZE 1024 int check_if_suffix(char *suffix,char *ptr){ //printf("suffx:%s ptr:%s",suffix,ptr); /*while(suffix[0] != '\n' || suffix[0] != '\0'){ if(suff...
C
#include <stdio.h> #include <math.h> int main() { float a, b, c, media; char d; printf("Insira 3 notas: "); scanf("%f %f %f", &a, &b, &c); printf(" (a) Média aritmética: (n1 + n2 + n3)/3"); printf("\n (b) Média geométrica: (n1 ∗ n2 ∗ 3)^1/3"); printf("\n (c) Média ponderada: ((1 ∗ n1) + (2 ∗...
C
/* main.c - main function for reverse polish calculator get commnad; identify command and calculate; log: 2015-6-18 2016-9-1 test EOF pushed back of getch 9-2 test buffered getchar */ #include <stdio.h> #include <string.h> #include <stdlib.h> /* for atof() */ #include "calc.h" #define MAXOP 100 #defi...
C
#include "image.h" #include <iostream> #include "source.h" Image::Image(void) { height = 0; width = 0; maxVal = 0; pixelData = new aPixel[width*height]; } Image::Image(int h, int w, int mV, aPixel *pD) { height = h; width = w; maxVal = mV; pixelData = pD; } Image::~Image() { } void Image::display() { std...
C
/* ** EPITECH PROJECT, 2017 ** tests_my_strlen.c ** File description: ** Unit tests for my_strlen */ #include <criterion/criterion.h> #include "my.h" Test(my_strlen, basic) { cr_assert_eq(my_strlen("Saucisse"), 8); cr_assert_eq(my_strlen("a"), 1); cr_assert_eq(my_strlen(""), 0); cr_assert_eq(my_strlen("Hey commen...
C
// CONFIG #pragma config FOSC = XT // Oscillator Selection bits (XT oscillator) #pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled) #pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled) #pragma config BOREN = OFF // Brown-out Reset Enable bit (BOR disabled) #pr...
C
#include "holberton.h" /** * _isalpha - identifies when c is alphabetic character *@c: - Declaración de variable *Return: Always 0 (Success) */ int _isalpha(int c) { if (c >= 65 && c <= 122) { return (1); } else { return (0); _putchar('\n'); } }
C
/** * @file: usr_tasks.c * @brief: Two user/unprivileged tasks: task1 and task2 * @author: Yiqing Huang * @date: 2020/10/20 * NOTE: Each task is in an infinite loop. Processes never terminate. * IMPORTANT: This file will be replaced by another file in automated testing. */ #include "rtx.h" #include "uart_...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define ll long long #define rep(i,l,r)for(ll i=(l);i<(r);i++) //??????? //* //??????? typedef struct atai{ll a;}atai; atai xx(atai x,atai y){ atai r; r.a=x.a+y.a;//sum return r; } //??????? int segNUM; atai segN[1<<18],*seg; void segu...
C
#include <stdio.h> int main (void) /*一个简单的C程序例子*/ { int num; /*定义一个num的变量*/ num = 1; /*为变量num赋值 */ printf ("i am a simple "); /* 使用库函数printf() */ printf ("computer.\n"); printf ("my favorite number is %d because it is first.\n", num); return 0; }
C
#include <stdio.h> void par(); void impar(); int main(){ int num; printf("Escolha uma opcao:\n 1-Numeros pares entre 1 a 10\n 2-Numeros impares entre 1 a 10: "); scanf("%d", &num); if(num == 1) par(); else impar(); return 0; } void par(){ int i; printf("Numeros pares: "...
C
#include<stdio.h> int main(void){ int a, b; scanf("%d %d", &a, &b); if(a < b) printf("a < b\n"); if(a > b) printf("a > b\n"); if(a == b) printf("a == b\n"); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include "player.h" mob* mob_ctor(char name[15], int id, int attack, int defence, int lifePoint, position* pos) { mob* p = malloc(sizeof(mob)); p->name = name; p->id = id; p->attack = attack; p->defence = defence; p->lifePoint = lifePoint; p->pos = pos; return p; ...
C
#include <stdio.h> #include <stdlib.h> #define N 6 int main(int argc, char *argv[]) { int vett[N],i,temp,scambio; for(i=0;i<N;i++){ printf("inserire il valore per la posizone %d: ",i); scanf("%d",&vett[i]); } do { scambio=0; for(...
C
#include "WinTextEditor.h" #include "File.h" #include "ErrorHandler.h" BOOL CreateMainWindow(HINSTANCE hInstance, int cmdShow); BOOL InitMainWindowClass(HINSTANCE hInstance); LPCWSTR mainWIndowClassName = L"TextEditorMainWindow"; HANDLE gHFont = NULL; HWND hMainWindow = NULL; HWND hTextEditor = NULL; BOOL textChanged...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* map.c :+: :+: :+: ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* write_asm_header.c :+: :+: :+: ...
C
#include <glad/glad.h> #include <GLFW/glfw3.h> #include "utils/utils.h" #include <stdio.h> #include <stdlib.h> typedef GLuint Shader; typedef GLuint Program; typedef GLuint VAO; typedef GLuint VBO; typedef GLuint EBO; // TODO: switch to makefiles // TODO: release unused resources for ex.3 void FrameBufferSizeCallba...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <CUnit/Basic.h> #include "src/utils.h" #include "src/tables.h" #include "src/translate_utils.h" #include "src/translate.h" const char* TMP_FILE = "test_output.txt"; const int BUF_SIZE = 1024; /**************************************** ...
C
#include <assert.h> #include <la_boolean.h> #include <la_character.h> #include "lib.h" void showHelp() { printf ( "\n" ); printf ( "Usage %s [-f FILE] [-n NAME] [-t TYPE]\n", PRG_NAME ); printf ( "Creates source code to read the given properties file.\n" ); printf ( "\n" ); printf ( "Help Options:\n" ); printf (...
C
/* Written by Brian Raiter, January 2001. Placed in the public domain. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "gen.h" #include "prf.h" static fileinfo *file; static imageinfo *image; static uchar *imagebuf; /* * decoding functions */ static int bitsin(int...
C
Position Find( BinTree BST, ElementType X ) { if (!BST) return NULL; if (X > BST->Data) { return Find(BST->Right, X); } if (X < BST->Data) { return Find(BST->Left, X); } if (X == BST->Data) { return BST; } } Position FindMin( BinTree BST ) { if (!BST) return NULL...
C
/*-------------------------------------------------------------------- L1_1.CܣĻʾһ仰"Hello!" -------------------------------------------------------------------*/ #include <stdio.h> /* ͷļ */ int main() /* */ { printf("Hello,Dong!\n"); /* Ļ"Hello"Ƶһ*/ return 0...
C
#include <stdio.h> Custo_Carro(float custo){ custo+=(custo*0.28)+(custo*0.45); printf("Com os impostos o carro custara ao consumidor :%.2lf reais", custo); } int main(void){ float custo_Carro; printf("\nDigite valor do carro na fabrica:"); scanf("%f",&custo_Carro); Custo_Carro(custo...
C
#include "stdio.h" // sonuclar sayi olarak geliyorsa // 0, eof olarak okunacaktir. macHesapla( char * ); //mac hesaplarinin aldigi ilk indis //sonuclar kumesinin asil eleman sayisidir int main(void) { char sonuclar[] = {10, 2, 1, 0, 0, 2, 1, 1, 2, 1, 0}; printf( "%d",macHesapla( sonuclar ) ); return 0; } // eg...
C
#include <cairo/cairo.h> #include <sndfile.h> #define WIDTH 200 #define HEIGHT 150 #define BUFFER_LEN 2048 #define MAX_CHANNELS 6 void hex2float(int color, float *colorSpace); void set_color(cairo_t *cr, int color); int main (int argc, char *argv[]) { char *filename, *outname; if(argc != 3){ printf("Syntax: d...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "inc/ArrayList.h" #include "inc/utn.h" #include "inc/mensaje.h" #include "inc/usuario.h" /** \brief Espacio en memoria para un usuario. * * \param - * \param - * \return Puntero a User. * */ Post* new_Post() { Post* this; ...
C
/*///////////////////////////////////////////////////////////////////////////////////////////////////////////*/ /*///////////////////////////////////////IMPORTACION DE LIBRERIAS////////////////////////////////////////////*/ #include <stdio.h> #include <string.h> #include <stdlib.h> #define BUFFSIZE 256 /*//////////////...
C
#include <stdio.h> #include "mesinkata.h" const Kata filetes = {" teskata.txt",11}; const Kata satu = {" katasama",8}; const Kata beda = {" katabeda",8}; const Kata sama = {" katasama",8}; const Kata bilangan = {" 123456",6}; const Kata nonbilangan = {" 1as23a",6}; const Kata katanull ={" ",0}; int main(){ printf("n...
C
#include<stdio.h> #include<string.h> struct date1 { int day,month,year; }d1,d2; int check_date(struct date1 d); int main() { int x,y; printf("enter first date in format dd\mm\yy:"); scanf("%d %d %d",&d1.day,&d1.month,&d1.year); printf("\n date is %d/%d/%d",d1.day,d1.month,d1.year); ...
C
#ifndef OHTBL_H #define OHTBL_H #include <stdlib.h> typedef struct OHTbl_ { int nPositions; void *vacated; int(*hash1)(const void *key); int(*hash2)(const void *key); int(*match)(const void *key1, const void *key2); void(*destory)(void *data); int nSize; void **table; }OHTbl; int OhtblInit(OHTbl *htbl, int P...
C
/** * fifteen.c * * Implements Game of Fifteen (generalized to d x d). * * Usage: fifteen d * * whereby the board's dimensions are to be d x d, * where d must be in [DIM_MIN,DIM_MAX] * * Note that usleep is obsolete, but it offers more granularity than * sleep and is simpler to use than nanosleep; `man uslee...
C
// Copyright Burcea Marian-Gabriel 2018 #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #ifndef functions_h #define functions_h #define NMAX 1000 #define CHR 16 struct Glaciar{ int hill; int gloves; // campul player contine indicele jucatorului care se gaseste in celula in...
C
#include <stdio.h> #include <string.h> #include <math.h> void itoa(int n, char s[]); void reverse(char s[]); void main(){ int i,x=-2147483648; char s[100]; for (i=0;i<100;++i) s[i]=0; itoa(x,s); for (i=0; s[i]!='\0' ;++i) putchar(s[i]); } void itoa(int n, char s[]) { int i, sign; ...
C
#include <math.h> #include "MLVengine/object.h" #include <stdlib.h> typedef struct carac { int lifePoint; int maxLifePoint; int moveSet; Object* target; int moveTime; int fireSet; int fireTime; int attack; Vector init; } Carac; Carac* newCarac(int lifePoint, int maxLifePoint, int moveSet, int fireSet, int fi...
C
#include <stdio.h> #include <stdlib.h> int mixCardTray(void) { int i; int cardnum; int cardChoosen[N_CARD]; for (i = 0; i < N_CARD; i++) { // cardChoosen 迭 ߺ ī üũѴ. cardChoosen[i] = FALSE; } for(i=0; i< N_CARD; i++){ cardnum = rand() % N_CARD; if (cardChoosen[cardnum] == TRUE) { // TRUE ̹ i...
C
#include <stdio.h> #include <stdlib.h> struct Node { int key; struct Node* next; }; struct queue { struct Node *front, *rear; }; struct Node* newNode(int k) { struct Node* newnode = (struct Node*)malloc(sizeof(struct Node)); newnode->key = k; newnode->next = NULL; ...
C
#include "circular_buffer.h" struct circularBuffer CreateCircularBuffer(unsigned int sizeOfBuffer) { struct circularBuffer buffer = {sizeOfBuffer, 0, 0, 0, malloc(sizeof(struct machineState) * sizeOfBuffer)}; return buffer; } void writeToCircularBuffer(struct circularBuffer *buffer, struct machineState value)...
C
#include <sys/socket.h> #include <sys/types.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <arpa/inet.h> #include <stdarg.h> #include <errno.h> #include <fcntl.h> #include <sys/time.h> #include <sys/ioctl.h> #include <netdb.h> #define PORT 80 #define MAXL...
C
/* ** my_remove.c for 42sh in /home/menich_a/rendu/PSU_2013_minishell2/srcs ** ** Made by menich_a ** Login <menich_a@epitech.net> ** ** Started on Wed May 21 11:52:10 2014 menich_a ** Last update Sat May 31 14:12:45 2014 menich_a */ #include <unistd.h> #include <stdlib.h> #include "mysh.h" #include "my.h" int m...
C
#include <stdio.h> #include <string.h> #include <unistd.h> #include <mpi.h> #define MASTER 0 #define TAG 0 #define MSGSIZE 100 #define MAX 25 int main(int argc, char* argv[]) { //http://mpitutorial.com/tutorials/mpi-broadcast-and-collective-communication/ int my_rank, source, num_nodes; char my_host[MAX]...
C
#ifndef HEX_H_INCLUDED #define HEX_H_INCLUDED #include <stdlib.h> #include <stdio.h> #include <assert.h> typedef enum { L = 0, R = 1 } Side; typedef enum { W =0, N = 1, E = 2 } Direction; typedef struct { int q, r, s; } Hex; typedef struct { float x, y; } Point; typedef struct { int...
C
#include <stdio.h> #include <wallaby/wallaby.h> #define CLOSED 1000 //Claw closing #define OPEN 2047 //Claw opening #define CLAW 0 //Grabs Objects #define UP 1200 //Makes claw rise #define UP_MAX 2047 //Makes claw go rise al the way up #define DOWN 600 //Lowers claw #define ARM 2 //Holds the...
C
// #include<ulib.h> // int fn_2(int i); // int fn_1(int i); // int fn_2(int i) // { // if( i == 0) return 0; // printf("In fn2 i = %d\n", i); // return fn_1(i-1); // } // int fn_1(int i) // { // if(i ==0) return 0; // printf("In fn1 i = %d\n",i); // return fn_2(i-1); // } // int main(u64 arg1, u64 arg2, u64...
C
/* Changes by Leigh McCulloch * - Changed from using stdin, stdout to using char allocated memory passed * into cssmin. * Copyright (c) 2013 Leigh McCulloch. Same license as below. */ /* cssmin.c Copyright (c) 2010 (www.ryanday.org) w3c css spec: http://www.w3.org/TR/CSS2/syndata.html this parser makes no at...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* validfile.c :+: :+: :+: ...
C
#include<stdio.h> int main(){ int i,n; printf("Enter n:"); scanf("%d",&n); printf("Table of %d \n",n); for(i=1;i<=10;i++){ printf("%d*%d=%d\n",n,i,n*i); } } /* Enter n:11 Table of 11 11*1=11 11*2=22 11*3=33 11*4=44 11*5=55 11*6=66 11*7=77 11*8=88 11*9=99 11*10=110 */
C
#include "unp.h" #include "methods.h" int main() { srand(time(0)); int sockfd, n, size, i; struct sockaddr_in servAddr; char buffer[MAXLINE+1]; int key = 0; // Input server's address printf("Please, enter the IP number: \n"); char ipAddress[16]; // scanf("%s",ipAddress); strcpy(i...
C
/* rbt/rotate_right.c * Copyright (c) 2021, Dakotah Lambert */ #include "rbt.h" struct rbt_tree * rbt_rotate_right(struct rbt_tree * const this) { if (!this) {return this;} struct rbt_tree * child = this->left; if (!child) {return this;} this->left = child->right; child->right = this; return child; }
C
/* ** list_reverse.c for my_ls in /home/epitech/c/my_list ** ** Made by claude ramseyer ** Login <ramsey_c@epitech.net> ** ** Started on Mon Oct 31 10:00:00 2011 claude ramseyer ** Last update Mon Oct 31 10:00:01 2011 claude ramseyer */ #include "my_list.h" void list_reverse(t_list **list) { t_list *current; t...
C
/*Mengyang Chen 1412408*/ #include <stdio.h> #include <stdlib.h> #include <math.h> struct node { int digit; struct node *next; }; struct node * create_list(int num) { struct node *root = NULL; if (num==0){ struct node *cur = malloc(sizeof(struct node)); cur->digit = num; cur...
C
#include "stot_test.h" #include "stot/str_builder.h" #include "stot/transient_stack.h" #include <stdio.h> #include <stdlib.h> #include <string.h> void building() { #define B_APPEND(x) ts_str_builder_append(&builder, x, sizeof(x)-1) ts_str_builder builder; tstack* tstack = tstack_ctor(); ts_str_builder_init(&build...
C
#include <stdio.h> #include <stdlib.h> #include "listlinier.h" #include "./boolean.h" int main() { /* KAMUS */ List L; int N, Q, x; int i; infotype trash; addressList P; /* ALGORITMA */ CreateEmpty(&L); scanf("%d", &N); for (i = 0; i<N; i++){ InsVLast(&L, i+1); ...
C
/* * select.c * * Created on: Feb 16, 2016 * Author: wing */ #include<stdio.h> #include<stdlib.h> #include<math.h> int sort(int *num,int l,int r) { int i,j,x; for (i=l+1;i<=r;i++) { x=num[i]; j=i-1; while(j>=l&&num[j]>x) { num[j+1]=num[j]; j--; } num[j+1]=x; } return num[(l+r)/2]; } in...
C
// counting bit from lsb and start with 1 #include <stdio.h> void check(int n) { printf("%d\n",n); while(n%4==0) { if((n&1) || (n&1<<1)) break; n>>=2; } if(n==1) printf("Number is power of 4\n"); else printf("Number is not power of 4\n"); } int main(int argc, char const *argv[]) { int n; printf("...