language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include "head.h" int main () { read(); // read from file char ribbon[256]; scanf("%255[^\n]s", &ribbon); // input pita // CHECK THE RIBBON STARTKATA(ribbon); // start char penumpang1[32]; // untuk kata pertama strcpy(penumpang1, GETCKATA()); INCKATA(ribbon); // cek kata selanjut nya // kalau k...
C
/* fakeLinkage - Fake some linkage data. */ #include "common.h" #include "linefile.h" #include "hash.h" #include "options.h" #include "jksql.h" #include "hdb.h" static char const rcsid[] = "$Id: fakeLinkage.c,v 1.1 2006/09/13 03:01:48 kent Exp $"; void usage() /* Explain usage and exit. */ { errAbort( "fakeLinkage ...
C
#include "c_stack.h" #include "c_deque.h" c_stack* c_stack_create(dump_func dump, release_func release, size_t elem_size) { return c_deque_create(dump, release, elem_size); } c_stack* c_stack_clone(const c_stack *src) { return c_deque_clone(src); } void c_stack_destroy(c_stack *s) { c_deque_destroy(s); } void* c...
C
// Demonstration of a technique for inheritance in C. Internally, // this is sort of how languages like C++ and Java provide inheritance // and function overriding. // There are more sophisticated ways to do this, better for larger // projects, but this is not a bad approach for a first look at object // orientation ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ball.c :+: :+: :+: ...
C
/* Public domain */ /* * C-string related routines. */ #ifdef AG_UNICODE /* * Return the length of a UCS-4 string in characters (not including NUL). */ #ifdef AG_INLINE_HEADER static __inline__ AG_Size _Pure_Attribute AG_LengthUCS4(const AG_Char *_Nonnull ucs) #else AG_Size ag_length_ucs4(const AG_Char *ucs) #end...
C
#include "coder.h" void caesarclipherMut(char* string, int c) { while (*string) { if (*string >= 'c' && *string <= 'y') { if (*string + c < 'y') { *string += c; } else if (*string + c > 'y') { *string = 'c' + (*string + c) % ('y' - 'c' + 1...
C
/* program, ktory pre zadane n vytvori obrazok z hviezdiciek -> piramida * ** *** **** ... */ #include <stdio.h> #include <stdlib.h> int main() { char* endp; char str[100]; printf("zadajte pocet riadkov: "); fgets(str, 100, stdin); int n = strtol(str, &endp, 10); if (*(endp+1) != 0) { ...
C
// // main.c // 05_字符串解码_leetcode_394 // // Created by SK_Wang on 2020/4/18. // Copyright © 2020 SK_Wang. All rights reserved. // #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> /* 394. 字符串解码 链接:https://leetcode-cn.com/problems/decode-string 给定一个经过编码的字符串,返回它解码后的字符串。 编码规则为: k[enc...
C
#include "heap.h" Heap* create_heap(){ //creates the heap Heap *h = malloc(sizeof(Heap)); if (h == NULL) exit(-1); //creates the head of the heap h->head = malloc(sizeof(Heap_Level)); if (h->head == NULL) exit(-1); h->head->level = 1; h->head->data_array = calloc(1, sizeof(int)); ...
C
/** * @file server.c * @author TEAM PINE * @brief: defines functionality for the server, * which interacts with other modules for functionality * to offer an interactive game. * @version 0.1 * @date 2021-06-01 * * @copyright Copyright (c) 2021 * */ /* standard libraries */ #include <stdio.h> #include <std...
C
#include<stdio.h> int main() { int i=12,*ip=&i; double d =2.3,*dp=&d; char ch='a',*cp=&ch; printf("Value of ip= %p \n",ip); printf("Value of dp= %p \n",dp); printf("Value of cp= %p \n\n",cp); printf("Value of ip+1= %p \n",ip+1); printf("Value of dp+1= %p \n",dp+1); printf("Value of cp+1= %p \n\n",cp+1); printf("Value o...
C
/* ** EPITECH PROJECT, 2019 ** Makefile ** File description: ** Makefile */ #include "warlock.h" /* \fn char **clean_double_alloc(int y, int x) \brief allocate array of string in desirated size. \param y : the number of string \param x : the lenght of each string \return a new array of string(char **). */ char **cle...
C
#include<stdio.h> #include<conio.h> void main() { int n,k,a; printf("enter the 1st no"); scanf("%d",&n); printf("enter the 2nd no"); scanf("%d",&k); a=n+k; if(a%2==0) { printf("even"); } else { printf("odd"); } }
C
#ifndef _es_math_utils_h_ #define _es_math_utils_h_ ES_DECL_EXPORTED_REFLECTED_SERVICES_BEGIN( EsMath, ESMATH_CLASS ) /// Reflected math constants /// /// PI ES_DECL_REFLECTED_CLASS_METHOD0(double, pi); /// 2*PI ES_DECL_REFLECTED_CLASS_METHOD0(double, _2pi); /// PI/2 ES_DECL_REFLECTE...
C
// SPDX-License-Identifier: LGPL-2.1-or-later /* * Copyright (C) 2008-2020 Cyril Hrubis <metan@ucw.cz> */ /* * Evfilter dump: * * Writes nice decomposition of event to the FILE. * * parameters: * * prefix = string * prefix that is printed in every print * * file = path * path to file to print to, there ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <sys/types.h> #include <unistd.h> #include <errno.h> #define SERV_PORT 4507 #define LISTENQ 12 #define INVALID_USERINFO 'n' #define VALID_USERINFO 'y' #define USERNAME 0 #define PA...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <ctype.h> #include <unistd.h> #include <signal.h> #include <sys/types.h> #include <sys/socket.h> #include <errno.h> #include "util_socket.h" #define MAX_STR_LEN 1024 /* prototypes */ static void sigIntHandler(int sig); static void connection_handle...
C
#include <stdio.h> int pow2(int n); int main(int argc, char const *argv[]) { int n = 9; for (int i = 0; i <= n; ++i) { printf("%d ", pow2(i)); } puts("\n"); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "pipeStructs.c" #define MAXPENDING 5 void DieWithError( char *errorMessage ); void comm(void* threadArgs) { int n, nbytes; char buffer[256]; bzero(buffer,256); struct sock_pipe *foo; foo = (struct sock_pipe *) threadArgs; ...
C
#include <stdlib.h> #include <stdio.h> #include <math.h> #include <cv.h> #include <highgui.h> int main(int argc, char *argv[]) { IplImage* img = 0; int height,width,step,channels; uchar *data; int i,j,k; if(argc<2){ printf("Usage: main <image-file-name>\n\7"); exit(0); } // load an image img=cvLoadImage(...
C
/* Fred Mapper is considering purchasing some land in Louisiana to build his house on. In the process of investigating the land, he learned that the state of Louisiana is actually shrinking by 50 square miles each year, due to erosion caused by the Mississippi River. Since Fred is hoping to live in this house the rest ...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> static void loadSize (char * filename, int * n, int * m){ FILE * fp = fopen(filename, "rb"); int num[2] = {0,0}; fread(num, sizeof(int), 2, fp); int cols = num[0]; int rows = num[1]; *n = cols; *m = rows; fclose(fp); } static void loadFile (char * fi...
C
#include <stdio.h> #include <stdlib.h> #include "env_set.h" #include "utils.h" /* * This function creates a new node for the list with the string * formatted as "key=value". */ t_env *new_env(const char *str) { int i; t_env *ret; ret = (t_env *)malloc(sizeof(t_env)); if (!ret) return (0); i = 0; ret->next = ...
C
#include <stdio.h> int main(){ int n; int voti [5][5]; for(int i=0; i<5; i++){ for(int j=0; j<5; j++){ scanf("%d ", &n); voti[i][j]=n; } } float esame1, esame2, esame3, esame4, esame5; float studente1, studente2, studente3, studente4, studente5; for(int k=0; k<5; k++){ esame1= esame1+ voti[k][0]...
C
#include <stdlib.h> #include <stdio.h> int main(int argc, char** argv){ if((argc-1) %2 != 0){ printf("Should enter even number of argument\n"); } float vector = 0; int i; for(i = 1; i<=argc/2; i++){ float v1 = atof(argv[i]); float v2 = atof(argv[argc/2+ i]); vector = vector + (v1*v2); } printf("Producto p...
C
#include <stdio.h> int main() { int n, b, i, m,counter = 0; printf("Enter the number upto which do you want to print prime numbers \n"); scanf_s("%d", &m); for (b = 2;b <= m;b++){ i = 2; while (b % i != 0){ i++; } if (i == b) { counter++; } } printf("The number of ...
C
#include <iostream> #include <errno.h> #include <wiringPiSPI.h> #include <unistd.h> using namespace std; // channel is the wiringPi name for the chip select (or chip enable) pin. // Set this to 0 or 1, depending on how it's connected. static const int CHANNEL = 1; int main() { int fd, result; unsigned char buf...
C
#include <stdio.h> #include <string.h> #define MAXN 100 char* replaceAll(int* source, int* subStr, int repStr){ int subL= strlen(subStr); int repL= strlen(repStr); char temp[100]; char* ptr= strstr(source, subStr); int i; while (ptr!=NULL){ strcpy(ptr, ptr+subL); if(repL>0){ strcpy(temp, ptr)...
C
#include <stdio.h> /* * 「配列」のポインタを確認してみる */ int main() { int i[10]; int* pi = i; char c[10]; char* pc = c; // ポインタ位置の確認 printf("&i[0]:\t%08x\n", &i[0]); printf("i:\t%08x\n", i); printf("&i[1]:\t%08x\n", &i[1]); printf("++pi:\t%08x\n", ++pi); printf("&i[2]:\t%08x\n", &i[2]);...
C
#include <stdlib.h> #include <stdio.h> #include <check.h> #include "../src/arrayheap.h" heap heap_test; int int_compare(void *num1, void *num2) { return *((int *) num1) - *((int *) num2); } void setup (void) { heap_test = arrayheap_methods.create(&int_compare); } void teardown(void) { arrayheap_methods.free(h...
C
#include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <termios.h> #include <time.h> #include <pthread.h> #include <signal.h> #include <string.h> #include "graphic.h" #include "control.h" #include "timer.h" #include "tetris.h" static void sigint(int); static void quit(void); static void draw(void); stati...
C
/** 获取网卡down/up/running 状态 */ #include <net/if.h> /* for ifconf */ #include <linux/sockios.h> /* for net status mask */ #include <netinet/in.h> /* for sockaddr_in */ #include <sys/socket.h> #include <sys/types.h> #include <sys/ioctl.h> #include <stdio.h> #define MAX_INTERFACE (4) void port_status(unsigned int fl...
C
#import <stdio.h> #import <cs50.h> /*The following promts the user for a credit card number and determines if a entered value is a valid AMEX, VISA or MASTERCARD credit card number. If the entered card number is valid the card type will print. If the number entered is not a valid credit card number "INVALID" will...
C
/* * OPERATING SYSTEMS DESING - 16/17 * * @file test.c * @brief Implementation of the client test routines. * @date 01/03/2017 */ #include <stdio.h> #include <string.h> #include "include/filesystem.h" #include <stdlib.h> #include <fcntl.h> // Color definitions for asserts #define ANSI_COLOR_RESET "\x1b[0m"...
C
#include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <math.h> extern int pop(); extern void push(int); extern void addHeap(int thing2add); extern int heapSize(); extern int heapDelete(); extern int isEmpty(); extern void preOrder(int x); int main(int argc, char * argv[]) { in...
C
#include <stdio.h> #include <stdlib.h> char* lerTexto(char* shell, int tamanho); int lerInteiro(char* shell); void* liberarPonteiro(void* ponteiro); int lerInteiro(char* shell) { int inteiro; printf("%s",shell); scanf("%d", &inteiro); return inteiro; } char* lerTexto(char* shell, int tamanho) { ...
C
#include "List.h" #include<stdlib.h> #include<stdio.h> int Factorial(int n) { if(n==1) { return 1; } return n*Factorial(n-1); } List *Permutations(int n) { if(n==1) { List arrary[1]={NULL}; Position p=(Position)malloc(sizeof(struct Node)); p->Element=1; ...
C
// // Created by zhang on 2017/1/7. // //C 库函数 size_t strftime(char *str, size_t maxsize, const char *format, const struct tm *timeptr) //根据 format 中定义的格式化规则,格式化结构 timeptr 表示的时间,并把它存储在 str 中。 //str -- 这是指向目标数组的指针,用来复制产生的 C 字符串。 //maxsize -- 这是被复制到 str 的最大字符数。 //format -- 这是 C 字符串,包含了普通字符和特殊格式说明符的任何组合。 // 这些格式说明符由函数替换...
C
#include <stdio.h> #include <stdlib.h> typedef int Item; typedef struct Node* Link; struct Node{ Item item; Link next; }; int main(int argc, char** argv){ int a = 77; const size_t INT_SIZE = sizeof(int); int* ptr_a = (int*) malloc(3*INT_SIZE); int* new_ptr_a = ptr_a; ptr_a[0] = a; ...
C
/* 结构体练习 */ #include <stdio.h> typedef struct { int x, y; } pt; typedef struct { pt pt1, pt2; } rect; int main(){ pt pt1 = {1, 2}; rect r = {{3, 7}, {8, 13}}; printf("(%d, %d)\n", pt1.x, pt1.y); printf("(%d, %d) (%d, %d)\n", r.pt1.x, r.pt1.y, r.pt2.x, r.pt2.y); return 0; }
C
#include "pid.h" //ƶ static uint8_t no=0; //޷ int constrain(int source ,int min ,int max) { if(source > max) return max; else if(source < min) return min; else return source; } //ʼPIDƶ void PidInit(pHPID_CTR obj,int expect,float Kp,float Ki,float Kd) { obj->no = no++; //ݳʼ˳ɿϵͳ obj->...
C
#include "Strand2dFCBlockSolver.h" void Strand2dFCBlockSolver::edgeExtract() { // form local edges in the standard element nElemEdge = meshOrder; elemEdge.allocate(nElemEdge,2); if (meshOrder == 1){ elemEdge(0,0) = 0; elemEdge(0,1) = 1; } else if (meshOrder == 2){ elemEdge(0,0) = 0; elemEd...
C
#include <stdio.h> // 헤더 파일 선언 int main() { // main 함수의 시작 printf("Hello"); // 문자열의 출력 return 0; // 0의 반환 } // 함수의 끝
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char* argv[]) { int numbrix[100][100]; int height = 1, width = 1; int i, j; int n, m; int heit = 0; int wid = 1; //real width char z; FILE* file = fopen(argv[1], "r"); if (file == 0) { pr...
C
#include "SeqList.h" #include <Windows.h> int main(){ SeqList sl; SeqListInit(&sl, 2); printf("˳"); SeqListPushBack(&sl, 1); SeqListPushBack(&sl, 2); SeqListPushBack(&sl, 3); SeqListPrint(&sl); printf("ͷ0"); SeqListPushFront(&sl, 0); SeqListPrint(&sl); printf("ͷɾ"); SeqListPopFront(&sl); SeqListPrint(...
C
// To draw a simple shaded scene consisting of a tea pot on a table. // Define suitably the position and properties of the light source // along with the properties of the surfaces of the solid object used in the scene. #include <stdio.h> #include <GL/glut.h> void wall() { glPushMatrix(); glScalef(2, 0.05, 2); ...
C
#include "types.h" #include "user.h" #include "stat.h" #include "fcntl.h" #include "ipc.h" int itr = 0; // Key value iterator char * strcat(char *a,char *b) { char *t = malloc(200); int i = 0,k = 0; while(a) t[i++] = a[k++]; k = 0; while(a) t[i++] = b[k++]; t[i] = '\0'; return t; } char * ktof(int ...
C
/** * \file generator.c * * \brief Génère des fichiers de taille et de contenu aléatoire. * */ #include <stdio.h> #include <stdlib.h> #include <time.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> int main(int argc, char ** argv) { if(argc != 2) { fprintf(s...
C
#include <stdlib.h> #include <stdio.h> #include <math.h> #include <conio.h> int main(int argc, char const *argv[]) { system("cls"); argv=argv; argc=argc; float inteiro; float fracao; float partes; printf (" Digite o valor do inteiro:"); scanf ("%f",&inteiro); printf (" Digite a quantidade de partes:"); ...
C
#include <stdio.h> #include <stdlib.h> char ch, filename[50]; int n; FILE *fp; void main (void) { printf("\nPlease specify the file you would like to count the characters of: "); scanf("%s", filename); if ( (fp = fopen(filename, "r")) == NULL) { fprintf(stderr, "\nError opening file specifed"); exit(1); ...
C
#include <stdio.h> #include "cursor.h" void PrintList_cur( const List L ) { Position P = Header_cur( L ); if( IsEmpty_cur( L ) ) printf( "Empty list\n" ); else { do { P = Advance_cur( P ); printf( "%d ", Retrieve_cur( P ) ); } while( !IsLast_cur...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* sh_perror2.c :+: :+: :+: ...
C
int i; int j; int gcd(int u, int v) { if (v==0) return u; else return gcd(v, u-u/v*v); /* u-u/v*v == u mod v */ } void main(void) { int x; int y; /*x = input(x); y = input(y);*/ output(gcd(x, y)); }
C
#include "header.h" #include "string.h" #define ColorsSize (sizeof colors/sizeof *colors) enum {MinIn = 5, MaxIn = 12}; enum Colors {BLACK, BROWN, RED, ORANGE, YELLOW, GREEN, BLUE, VIOLET, GREY, WHITE, GOLD, SILVER, UNKNOWN}; struct colorList { char *color_name; enum Colors id; }colors[] = {{"black", BLACK}, {"b...
C
# C #include <stdio.h> int main(){ int i,j; for(i=1;i<=6;i++){ for(j=0;j<=i-1;j++){ printf("%c",'A'+(i-1)); } printf("\n"); } return 0; }
C
int ft_memcmp(const void *s1, const void *s2, size_t n) { size_t i; unsigned char *s1b; unsigned char *s2b; s1b = (unsigned char *)s1; s2b = (unsigned char *)s2; i = 0; if (n == 0) return (0); while (i < n && s1b[i] == s2b[i]) i++; if (i == n) i--; return (s1b[i] - s2b[i]); }
C
/* Joseph Soukup Steven Mulvey */ #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include "537malloc.h" #include "537tree.h" #include <stdint.h> tree *maple = NULL; tree * constructTree() { tree * maple = malloc(sizeof(tree)); maple->root = NULL; return maple; } void *malloc537(siz...
C
#include <stdio.h> #include <math.h> int angle(int fram, int bak){ int vinkel; double kvot; double delta; double mellan = 20; //Avståndet mellan sensorerna delta = fram - bak; kvot = delta/mellan; vinkel = atan(kvot)*180/3.14; //int på vinkel om man vill ha heltal på graderna. ...
C
#ifndef __OP_TEST_H__ #define __OP_TEST_H__ #include "gtest/gtest.h" #include "../header/op.h" TEST(OpTest, OpEvaluateNonZero) { Op* test = new Op(8); EXPECT_EQ(test->evaluate(), 8); delete test; } TEST(OpTest, OpStringifyNonZero) { Op* test = new Op(24); EXPECT_EQ(test->stringify(), "24"); delete ...
C
/********************************************************************** * Nom ............ : methodes.c * Role ........... : * Auteur ......... : Marvin Lasserre *********************************************************************/ #include <stdio.h> #include <stdlib.h> #include <tgmath.h> #include "real_precis...
C
#include <stdio.h> #include <ctype.h> /*GAME CONFIGURATION*/ #define ROWS 6 #define COLUMNS 7 #define OPEN_CELL_ASCII 46 #define COLUMN_LETTER_START 65 #define OPEN_CELL '.' #define PLAYER_1_PIECE 'X' #define PLAYER_2_PIECE 'O' #define COLORED_PLAYER_1_PIECE 'N' #define COLORED_PLAYER_2_PIECE 'B' /*Game board cont...
C
#include <stdio.h> #include <signal.h> #include <unistd.h> struct sigaction newact; struct sigaction oldact; void sigint_handler(int signo); int main() { newact.sa_handler = sigint_handler; // 시그널 처리기 지정 sigfillset(&newact.sa_mask); // 모든 시그널을 차단하도록 mask // SIGINT의 처리 액션을 새로 지정, oldact에 기존 처리 액션을 저장 ...
C
#include <random> double* weights(int n); double randomDouble(double end); double* weights(int n){ double *weight = new double[n]; weight[0] = randomDouble(1); double limit = 1 - weight[0]; for (int i = 1; i < n - 1; ++i){ weight[i] = randomDouble(limit); limit -= weight[i]; } weight[n - 1] = limit; retur...
C
/** ============================================================ * File: main.c * Author: Mihai Cornel mhcrnl@gmail.com 0722270796 * System: Ubuntu 16.04 Code::Blocks 13.12 gcc version 5.4.0 * Fedora 23 Code::Blocks 16.01 gcc version 5.3.1 * =========================================...
C
/* Filename: functions.h Author: Parker Hague Course: Operating Systems - CS4323 Assignment: Assignment00 Due: Feb. 4th, 2021, 11:59 PM Submitted: Nov. 30th, 2020 This file is a header file that serves to make several functions and variables global for multi file use. Includes function prototypes, external variable de...
C
#ifndef __INTEGER_TREE_H__ #define __INTEGER_TREE_H__ #include "base.h" #include "integer_list.h" // Represents a single tree node. typedef struct BTNode { int value; struct BTNode* left; // self-reference struct BTNode* right; // self-reference } BTNode; // Creates a tree node. BTNode* new...
C
/* * ===================================================================================== * * Filename: cmd.h * * Description: * * Version: 1.0 * Created: 05/19/15 15:55:15 * Revision: none * Compiler: gcc * * Author: Chaos John (CJ), chaosjohn.yjh@gmail.c...
C
#include<stdio.h> #include<stdlib.h> #include<limits.h> #include "def.h" #include "search.h" #include "helper.h" #include "insert_del.h" #include "print.h" #include "helper_main.h" ll_carrier *T,*H; double buffer = 0; void main() { double buffer; H = T = NULL; init_end(&H,&T); insert_end(H,H,0); int choice_m...
C
#include<stdio.h> int main (void){ int c1, c2, hh, mm, x, y, s; double diff, ss; scanf("%d %d", &c1, &c2); diff = (c2 - c1) / 100.00; hh = diff / 3600; mm = (diff - hh * 3600) / 60; ss = diff - hh * 3600 - mm * 60.0; x = ss * 10; y = x % 10; if(y >= 5){ s = (x + 10) / 10; } printf("%d:%d:%d",...
C
#include <stdio.h> #include <limits.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <malloc.h> #include <errno.h> #include <ctype.h> #include <sys/stat.h> #include <libgen.h> #define countof(X) (sizeof(X) / sizeof(X[0])) #define TRUE 1 #define FALSE 0 int fexists(const char* path) { char ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* int_converter_helper_2.c :+: :+: :+: ...
C
/* * graph_builder.c */ #include "graph_builder.h" #include "linked_list.h" #include "vertex.h" #include "edge.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #define STATION 0 #define TIME 1 // This might be handy for you when sorting int comparator(const void* a, const void* b) { const vertex** ver...
C
/* * SPI.c * * Created on: 01.10.2020 * Author: Piotr */ #include "SPI.h" #if BME280_SPI void SPI_Conf(void); void SELECT (void); void DESELECT (void); #endif #if BME280_SPI /****************************************************************************/ /* Configuration of SPI protocol ...
C
/* LGPL (v2.1 or any later version) - see LICENSE file for details */ #include <ccan/timer/timer.h> #include <ccan/array_size/array_size.h> #include <ccan/ilog/ilog.h> #include <ccan/likely/likely.h> #include <stdlib.h> #include <stdio.h> #define PER_LEVEL (1ULL << TIMER_LEVEL_BITS) struct timer_level { struct list_...
C
/* ** EPITECH PROJECT, 2021 ** checker ** File description: ** check victory or defeat */ #include "../include/my.h" int check_victory(char **map) { for (int y = 0; map[y] != 0; y++) for (int x = 0; map[y][x] != '\0'; x++) if (map[y][x] == 'O') return (0); return (1); } in...
C
#include<stdio.h> #include<string.h> char str[100000][51]; int n; int isSmall(char *str1, char *str2){ int len1 = strlen(str1); int len2 = strlen(str2); if(str1[0] == '-' && str2[0] != '-') return 1; if(str1[0] != '-' && str2[0] == '-') return 0; if(str1[0] != '-' && str2[0] != '-'){ if(len1>len2) retu...
C
/* * 15 - Know your architecture */ #include <stdio.h> int main() { const char ids[6][15] = { "char", "int", "long", "l long", "float", "double" }; unsigned long sizes[] = { sizeof(char), sizeof(int), sizeof(long), sizeof(long long), sizeof(float), sizeof(double) }; printf("Size:\t\tbytes \tbits\n"); ...
C
#include <sys/types.h> #include <unistd.h> #include <stdlib.h> #include <stdio.h> #define pint pid_t #include <sys/wait.h> int main(){ pint t; t = fork(); int t1 = 0; if(t == -1){ printf("Error.\n"); exit(0); } else if(t == 0){ int p1 = getpid(); int p2 = getppid(); printf("Child: %d \n Parent: %d\n",p...
C
#include <stdio.h> int main(){ int count[42] = {0}; int i, input, r; for(i = 0; i < 10; i++){ scanf("%d", &input); r = input % 42; count[r] += 1; } int result = 0; for(i = 0; i < 42; i++){ if(count[i] > 0){ result += 1; } } printf("...
C
#include<stdio.h> int main() { float base, height; printf("Digite e confirme a altura e depois a base\n"); scanf("%f %f", &height, &base); printf("Sua área é de: %.2f\n", ((height*base)/2)); return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* handle_float.c :+: :+: :+: ...
C
#include<stdio.h> #include<conio.h> #include<malloc.h> struct node { int data; struct node* next; }; typedef struct node NODE; typedef struct node* PNODE; typedef struct node** PPNODE; void InsertFirst(PPNODE,int); void display(PNODE); void InsertLast(PPNODE,int); void DeleteFirst(PPNODE); void ...
C
#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <string.h> #include <sys/socket.h> #include <arpa/inet.h> #include <unistd.h> #include <pthread.h> #include <semaphore.h> #include <unistd.h> #include <time.h> #define NAME_SIZE 100 #define BUFFER_SIZE ...
C
/* row wise gaus algorithm * pattern for practical course * ------------------------- * autor: Markus Brenk * date: 2002-09-25 * =================================================== */ //#define NGLS 32768 #define NGLS 32800 #define NUM_LOOPS 4 #include <stdio.h> #include <math.h> #include "timer.h" /* print a...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include "header.h" /* Esta función se encarga de seleccionar dónde y de qué forma se debe leer el archivo de entrada para la carga de memoria y delega dichas tareas a otras funciones. Recibe como argumentos un archivo_t que indica el formato de entrada, una c...
C
/** * All functions you make for the assignment must be implemented in this file. * Do not submit your assignment with a main function in this file. * If you submit with a main function in this file, you will get a zero. */ #include "sfmm.h" #include <stdio.h> #include <stdlib.h> #include <string.h> /** * You shou...
C
#include<stdio.h> main(){ int n,i,count=0,k; printf("Enter the number"); scanf("%d",&n); for(i=0;i<32;i++){ k=((n>>i)&1); if(k==1){ break; } if(k==0){ count++; } } printf("The trailing zero are %d",count); }
C
#include "../incs/philo.h" static int init_semaphores_for_philos(t_info *info) { int idx; char sem_name[255]; idx = -1; while (++idx < info->num_of_philos) { memset(sem_name, 0, 255); gen_name_tag(sem_name, SEM_PHILO_EAT, idx); info->philos[idx].eat_mutex = ft_sem_open(sem_name, 1); sem_unlink(sem_name...
C
#include "scop.h" static int load_tga_image( t_tga *tga, FILE *stream) { size_t size; size_t size_read; tga->buffer = NULL; size = tga->width * tga->height * 4; if (!(tga->buffer = (uint8_t*)malloc(sizeof(uint8_t) * size + 1))) return (-1); if ((size_read = fread(tga->buffer, 1, size, stream)) != size) ...
C
#include "stdio.h" #include "stdlib.h" #include "locale.h" #include "conio.h" int main() { int N, M, N1, M1, i, j, k; setlocale(0, "RUS"); N = 10; int **A = (int**)malloc(N * sizeof(int*)); int **B = (int**)malloc(N * sizeof(int*)); int **C = (int**)malloc(N * sizeof(int*)); for (i = 0; i < N; i++) { A[i] = (...
C
#include "sailr.h" #include <CUnit/CUnit.h> #include <CUnit/Basic.h> void test_func_test1( void ); void test_func_add_tests(CU_pSuite testSuite) { CU_add_test(testSuite, "test funcs ", test_func_test1 ); } void test_func_test1( void ) { // Code const char* code = " " "space_pi = ' ' + str_subset(num_to_str(3.14)...
C
/* Recursive function for printing numbers in decreasing order*/ #include<stdio.h> int main() { int x; printf("Enter the number "); scanf("%d",&x); func(x); return 0; } void func(int n) { if(n > 0) { printf("%d \n",n); func(n-1); } }
C
#include "../../pagai_assert.h" int unknown1(); int unknown2(); int unknown3(); int unknown4(); /* * From CAV'12 by Sharma et al. */ void main() { int x=0; int y=0; int n = 0; while(unknown1()) { x++; y++; } while(x <= n - 1 || x >= n + 1) { x--; y--; } ...
C
#include<stdio.h> int main() { int a[100][100],i,j,r,c,count1=0,count2=0,f=0,k,rfi=0; int sparse1[100][3],sparse2[100][3],final[100][3],m=1,n=1; printf("Enter the number of rows : "); scanf("%d",&r); printf("\nEnter the number of columns : "); scanf("%d",&c); for(i=0;i<r;i++) { f...
C
#include<stdio.h> void tower(int, char, char, char); int c; int main() { system("clear"); int n; printf("\nLet:\nS be the starting Peg,on which n disks are placed initially."); printf("\nA be the Auxiliary Peg that will be utilized as intermediate peg."); printf("\nD be the Destination Peg on which n disks to be ...
C
#include <stdio.h> int main(void) { //ȭ . // nCUTOFF ! const int nCUTOFF = 70; int nInput = 0; printf(" Էϼ. : "); scanf("%d", &nInput); //'70'̶ Ȯ , 'հ ' // ǹ̸ ο ڵ带 ۼ ִ. if (nInput >= nCUTOFF) printf("հԴϴ.\n"); else printf("հԴϴ.\n"); return 0; }
C
#include <stdio.h> int max(int, int); int main() { int a, b; scanf("%d%d", &a, &b); printf("%d\n", max(a, b)); return 0; } int max (int a, int b) { if (a > b) return a; return b; }
C
#include <stdio.h> #include <stdlib.h> int** AllocMat(int Ligne, int Colonne){ int ** M = calloc(Ligne, sizeof(int*)); for(int i =0; i<Ligne; i++){ M[i] = (int*) calloc(Colonne, sizeof(int)); } return M; } void RandMat(int **tab, int Ligne, int Colonne, int a, int b){ for(int i =0; i<Ligne; i++){ ...
C
#include<stdio.h> #include<math.h> int main() { int num,rem,sum=0,temp; printf("Enter a number:"); scanf("%d",&num); temp=num; while(temp!=0) { rem=temp%10; temp/=10; sum+=(rem*rem*rem); } if(sum==num) printf("\n%d is armstrong number",num); else ...