language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <mpi.h> #include <stdio.h> #include <stdlib.h> #include <math.h> #include <time.h> #include <unistd.h> #define TAGINIT 0 #define LOOKUP 1 #define REPONSE_LOOKUP 2 #define DECONNEXION 3 #define REPONSE_DECONNEXION 4 #define RECONNEXION 5 #define REPONSE_RECONNEXION 6 #define IGNORER 7 #define NB_PAIR (nb_pro...
C
// // howdy.c // // // Created by David Lah on 20.07.19. // #include <stdio.h> #include "howdy.h" int main( int argc, char *argv[] ) { if (!argc) { printf("Missing input argument!\n"); printf("Usage: howdy \n"); return 1; } printf("Well howdy there %s! YeeHaw!!!\n", ar...
C
#include<stdio.h> #include<string.h> #define max 30 signed int stack[30]; void push(int); int pop(); int top=-1; int main() { char s[30]; gets(s); int i,sum=0,val; for(i=0;s[i]!='\0';i++) { if(s[i] >= '1' && s[i] <= '9') { push(s[i] - '0'); } else if(s[i] == 'D') { if(stack[top]...
C
#include <stdio.h> #include <stdlib.h> #include "index_first_zero.h" int index_first_zero(int sum_array[], int number_of_elements) { int first_zero = -1; for (int i = 0; i < number_of_elements; i++) if (sum_array[i] == 0) { first_zero = i; ...
C
#include <stdio.h> #include "deposit.h" int main() { int day, sum, sum1, sum2; printf ("vvedite day and sum\n"); if (!scanf ("%d", &day) || !scanf ("%d", &sum)) { printf("invalid input"); return 1; } if(!validValue(day, sum)) { printf("Invalid range\n"); return 1; } sum = getsum(day, sum); printf...
C
int dist(int a, int b) { int dis = (a-b >= 0) ? a-b : b-a; return dis; } #include <klee/klee.h> #include <assert.h> #include <stdio.h> #include <stdlib.h> int main () { int var0; klee_make_symbolic(&var0, sizeof(var0), "var0"); int myvar0 = 1; if((myvar0 == 1) && (var0 >= 0) && (var0 <= 24)) {myvar0= 1;} else {myvar0...
C
#include<stdio.h> #include<stdlib.h> struct node{ int data; struct node*left; struct node*right; }; struct node* createNode(int data) { struct node*temp=(struct node*)malloc(sizeof(struct node)); temp->data=data; temp->left = NULL; temp->right = NULL; return temp; } struct node* add(struct node*root, int dat...
C
//对pselect 给出一个尽管不正确然后简单的实现 #include "unp.h" int pselect(int nfds, fd_set *rset, fd_set *wset, fd_set *xset, const struct timespec *ts,const sigset_t *sigmask) { int n; struct timeval tv; sigset_t savemask; if(ts!=NULL) { tv.tv_sec= ts->tv_sec; tv.tv_usec= ts->tv_nsec/1000; /*nano...
C
struct TreeNode *last_node; struct Node { int val; struct Node *next; }; struct Node *init_list(int *arr, int sz) { struct Node *ret; struct Node **ptr; ptr = &ret; for (int i=0; i<sz; i++) { *ptr = malloc (sizeof(struct Node)); (*ptr)->val = arr[i]; (*ptr)->next = NULL...
C
// https://www.urionlinejudge.com.br/judge/en/problems/view/1150 #include <stdio.h> #include <math.h> int main(int argc, char *argv[]) { int x, z, n, sum; scanf("%d", &x); scanf("%d", &z); while (z <= x) scanf("%d", &z); n = (int)( ( 1 - 2*x + sqrt((2*x-1)*(2*x-1) + 8 * z) ) / 2 ); sum = (x + n - 1) * n /...
C
#include<stdio.h> int main(int argc, char *argv[]){ char a[1000001],b[1000001]; int i=0,j=0,m,n,lengthA=0,lengthB=0,equal=0; scanf("%s%s",a,b); for(i=0;a[i]!='\0';i++){ if(a[i]!='0') break; } for(j=0;b[j]!='\0';j++){ if(b[j]!='0') break; } m=i; while(a[i]!='\0'){ ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* fts_args_print.c :+: :+: :+: ...
C
#include<stdio.h> #include<ctype.h> #include<string.h> int main(){ char password[100]; printf("Enter the password: (Must contain at least one upper case, one lower case and one number)\n"); scanf("%s", password); printf("The password you entered is %s.\n", password); printf("The length of password ...
C
#ifndef _GRAMMARTREE_H_ #define _GRAMMARTREE_H_ #include <stdio.h> #include <stdlib.h> #include <string.h> //Grammar Tree struct Node{ int lineno; char* name; struct Node* child; struct Node* sibling; int node_type; //0: terminal 1:nonterminal 2:nonterminal=>empty string union{ char...
C
/* ============================================================================ Realizar un programa que solicite cinco nmeros e imprima por pantalla el promedio, el mximo y el mnimo. ============================================================================ */ #include <stdio.h> #include <stdlib.h> int main(voi...
C
#include <stdio.h> #include <stdlib.h> #include <sys/types.h> //#include <md5.h> #include <string.h> #include "B5toPhone.h" #include "phonetic.h" B5_hash_t HashTable[HASH_TABLE_SIZE]; /*================================================================================================= Purpose: Q MD5 p@Ӥr Hash Value ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* make_map_points.c :+: :+: :+: ...
C
#include <pthread.h> #include <stdio.h> #include <stdlib.h> #include "bank/event.h" #define N 100 typedef struct { event_t odd; event_t even; } events_t; void* print_even(void* arg) { events_t* events = arg; for (int i = 2; i < N + 1; i += 2) { printf("%d\n", i); event_send(&even...
C
#include <stdlib.h> #include <string.h> #include <math.h> #include <stdbool.h> #include "forfuncC.h" // Function to calculate Mesavage and Girard tree Volumes // from dbh and merchantable tree height, and Girard form class // by David R. Larsen, January 4, 2020 // Function to calculate a Mesavage board foot volume. f...
C
/* * CODE VECTOR * Author : Jonas S. * Date : 07/21/2021 ! DESCRIPTION */ #include <stdio.h> #include <stdlib.h> #include "vector.h" /* * DESCRIPTION : INIT VECTOR ? INPUTS : [vector] *v ? OUTPUT : [void] */ void vector_init(vector *v) { v->capacity = VECTOR_INIT_CAPACITY; v->length = 0; v->content ...
C
#ifndef _VECTORS_H_ #define _VECTORS_H_ /* The vector structure */ typedef struct{ double x, y, z; } vector; /* Function Prototypes */ /* Add two vectors and return the resulting vector */ vector vector_add(vector *v1, vector *v2); /* Subtract two vectors and return the resulting vector */ vector vector_sub(vect...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #define MAX_DUZ 21 int poredi(const void* a, const void* b); int main() { char** niz = NULL, *rec = NULL, *k; int n, i; rec = (char*) malloc(MAX_DUZ * sizeof (char)); printf("Uneti rec:\n"); scanf("%s", rec); printf("Uneti broj reci:...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* sprite_management.c :+: :+: :+: ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_extra_atoi_base.c :+: :+: :+: ...
C
/**************************************** uscita() Confermation screen to quit from the game Entering parameters: none Returned value: none *****************************************/ void uscita() { char esci; printf("\nAre you quitting? Are you sure? Press y to quit, n to go back to the game...
C
#include <math.h> #include <stdlib.h> void draw_circle(int x, int y, int r, int c) { int x0 = x, y0 = y; x = 0; y = r; int e = 3 - 2 * r; /* e(x, y) = 2x^2 + 2y^2 + 4x - 2y + 3 - 2r^2 */ while (x <= y) { putpixel(x0 + x, y0 + y, c); putpixel(x0 + y, y0 + x, c); putpixel(x0 + y, y0 - x, c); putpixel(x...
C
///////////////////////////////// ///////////////////////////////// // // Executor // ///////////////////////////////// ///////////////////////////////// #include <p18cxxx.h> #include <usart.h> #include <stdio.h> #include "system\typedefs.h" #include "system\usb\usb.h" #include "user\user.h" // inst...
C
#include "lists.h" /** * get_nodeint_at_index - returns the specified node by 7-main.c at an index * @head: pointer to first element of the list * @index: index of the node (starting at 0) * Return: pointer to index of desired node */ listint_t *get_nodeint_at_index(listint_t *head, unsigned int index) { unsigned...
C
#include <mpi.h> #include <stdio.h> #include <stdlib.h> #include <time.h> #include <math.h> #define master 0 int rank,size; #define N 1200 void create_matrices(int *A,int *B){ int x=N*N; for(int i=0;i<x;i++){ A[i]=rand()%10; //0 to 9 B[i]=rand()%10; //0 to 9 } } void pr...
C
/* Assignment name : only_a Expected files : only_a.c Allowed functions: write -------------------------------------------------------------------------------- Write a program that displays a 'a' character on the standard output.*/ #include <stdio.h> #include <unistd.h> int main() { write(1, "a", 1); ...
C
#include <stdio.h> #define is_odd(x) (x % 2) int get_collatz_length(unsigned long long); int main(void) { const int LIMIT = 1000000; int record = 0; int winner = 0; int i; for (i = 2; i < LIMIT; i++) { int length = get_collatz_length(i); if (length > record) { winner = i; record = length; } } p...
C
#include "get_next_line_bonus.h" #include <stdio.h> int main() { int fd; int i; char *line; fd = open("textfile.txt", O_RDONLY); if (fd < 0) return (-1); i = 0; line = get_next_line(fd); while (line != NULL) { printf("line %i : %s", i, line); i++; line = get_next_line(fd); } printf("line %i : %s"...
C
#include <stdio.h> #include <stdlib.h> struct lista { int num; struct lista *next; }; struct lista *ins_ord(struct lista *); void visualizza_lista(struct lista *); int main() { struct lista *punt_lista=NULL; int sel=-1; while(sel!=0) { printf("\n1- Inserisci elemento\n"); printf("\n2...
C
#include <stdio.h> #include <stdbool.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include<stdint.h> #include "ware.h" #include "list.h" #include "shelf.h" #include "tree.h" ware * createNewWare(char* name, char* description, int price, list_t* shelf_list){ ware*newWare =(struct ware_t*)malloc(sizeo...
C
#include <util/delay.h> #include <stdlib.h> #include <avr/io.h> #include <avr/pgmspace.h> #include <avr/interrupt.h> #include <buzzer/buzzer.h> #include "local_pin_config.h" #define ISC0_FALLING_EDGE 2 #define ISC0_RISING_EDGE 3 /** * * Jeu du fil de fer * * * @author: Nicolas GUILLAUME <nico...
C
#ifndef NODE_H_ #define NODE_H_ #include <stddef.h> #include <stdint.h> /* Opaque types. */ struct cleaning; struct kvhash; struct kvldskey; struct kvpair_const; struct pool_elem; struct reading; /** * Data type for a B+Tree node. */ struct node { /* Page number for CLEAN/SHADOW nodes; -1 for DIRTY nodes. */ uin...
C
#include <mysql.h> #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> MYSQL* conn; char* server = "localhost"; char* user = "root"; char* password = "raspberry"; char* database = "...
C
#include "TCPEchoServer.h" /* TCPФΥ󥯥롼ɥե */ #include <sys/time.h> /* timeval{}ɬ */ #include <fcntl.h> /* fcntl()ɬ */ int main(int argc, char *argv[]) { int *servSock; /* ФΥåȥǥץ */ int maxDescriptor; /* åȥǥץκ */ fd_set sockSet; /* select()...
C
#include<stdio.h> #include<limits.h> void str_dump(const char *s) { do{ int i; printf("%c %0*X", *s,(CHAR_BIT + 3) / 4, *s); for(i = CHAR_BIT - 1; i >= 0; i--) putchar(((*s >> i) & 1U) ? '1' : '0'); putchar('\n'); }while(*s++ != '\0'); } int main(void) { str_dump("STRING"); return 0; }
C
/* * bvhcopy.c * * Purpose: Extracts a part of a BVH motion file and copies it to a new one. * Controlled by commandline arguments explained in show_usage() * function. * * Created: Jaroslav Semancik, 16/12/2003 */ #include <stdio.h> #include <stdlib.h> #include <string.h...
C
#include <assert.h> #include <stdio.h> #include <math.h> #include <stdbool.h> #include <upo/server/store.h> #define EPSILON 0.00001 static void test_create_destroy(); static void test_insert_size(); static void test_average(); static void test_variance(); static bool fequal(double a, double b); int main() { prin...
C
#pragma once//директива препроцесора, щоб уникнути багаторазове ключання модулів #include "size.h" #include <time.h> void Measure1(int p, int m, int n, int mode); /* функція для вимірювання сумарного часу сортувань масиву А (методом вибору№1) , яка в якості параметрів приймає розмірності масиву, а повертає сумарний ч...
C
#include <stdio.h> #include<string.h> int main() { int a,b; char c[50],d[50]; printf("\n Enter the two strings......"); scanf("%s%s",&c,&d); a=strlen(c); b=strlen(d); if(a==b) printf("\n %s",c); else if(a<b) printf("\n %s",d); else printf("\n %s",c); return 0; }
C
// // Encipher.c // LFSR-Cryptosystem // // Created by Alex Azarov on 31/10/2017. // Copyright © 2017 Alex Azarov. All rights reserved. // #include <stdio.h> #include <string.h> #include <stdlib.h> void Encipher(const char *path) { FILE *f = fopen(path, "r"); fseek(f, 0, SEEK_END); int length = (int) ...
C
#include "fraccion.h" #include "testing.h" #include <stdlib.h> #include <string.h> void prueba_fraccion_crear(void) { fraccion_t* fraccion1 = fraccion_crear(5, 3); fraccion_t* fraccion2 = fraccion_crear(-7, 4); fraccion_t* fraccion3 = fraccion_crear(15, -7); fraccion_t* fraccion4 = fraccion_crear(-27, -11...
C
#include "lemin.h" /* ** this func checks that name of link exists */ void read_link(char *line, t_input *input) { char **split; t_room **room; size_t i; int id1; int id2; i = 0; if (input->start_id < 0 || input->end_id < 0) error(UNKNOWN); if (!(split = ft_strsplit(line, '-'))) error(MEMORY); ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* room.c :+: :+: :+: ...
C
/** Interrupt Service Routines */ #include "interrupts.h" char *exception_types[] = { "Division By Zero", "Debug", "Non Maskable Interrupt", "Breakpoint", "Into Detected Overflow", "Out of Bounds", "Invalid Opcode", "No Coprocessor", "Double Fault", "Coprocessor Segment Overru...
C
#include <stdio.h> #include <stdlib.h> //programa que calcula salario a partir do ganho/hora float calculoSalario(float ganhoH, int nhoras ){ float salario=0; salario = ganhoH*nhoras; return salario; } int main(int argc, char *argv[]) { float ganhoH = 0; int nhoras =0; printf("Digite seu ganho/hora: ")...
C
#include <time.h> #include <stdio.h> #include <stdlib.h> #include <omp.h> /* If the OMP_NUM_THREADS variable is set to 8 with */ /* export OMP_NUM_THREADS=8 */ /* Q1: How many "Hello world ..." lines are printed on the screen? */ /* Q2: What does omp...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_printf.c :+: :+: :+: ...
C
/** @author maxu @blog https://39.106.108.65 @Created by 2021-01-15-19:30 */ #include <stdio.h> /* int main() { int a = 2; int b = 3; printf("%d\n", a <= b); return 0; } */ /* void main() { int i, j, c; for (i = 1; i <= 9; i++) { for (j = 1; j <= 9; j++) { c = i * 10 + j; ...
C
/* * CSCI 363 - Computer Networks * Lab 4 - TCP w/ sending structs * Yifan Ge * 02/18/2013 * * File name: list-receiver.c * Description: * This program will be a daemon, waiting for request from client. * */ #include <stdio.h> #include <unistd.h> #include "wrappers.h" #include "tcplib.h" #include "list.h" ...
C
#ifndef GRAPH_H #define GRAPH_H #include "util.h" /* These data structures can represent both simple graphs and multigraphs */ typedef struct graph_matrix graph_matrix; struct graph_matrix { int n; int *matrix; /* Convention : the (i,j) coefficient of the matrix is matrix[i*n + j] */ }; ...
C
#include <stdio.h> int main(void) { float l,b,h,vol,area; printf("enter the length breadth and height of the cuboid"); scanf("%f%f%f",&l,&b,&h); area=l*b; vol=l*b*h; printf("the area of the cuboid is %f",area); printf("the volume of cuboid is %f",vol); return 0; }
C
#include<stdio.h> void main(){ int len; printf("Enter the length of an array:"); scanf("%d",&len); int arrNum[len]; printf("Enter elements in an array\n"); for(int i = 0;i<len;i++){ scanf("%d",&arrNum[i]); } printf("Elements in reverse order : "); for(int k = len-1;k>=0;k--){ printf("%d ",arrNum[k]...
C
// /home/bruno/ulbra/2019-1/ap2/matriz/matrizex06.c // Criado em:dom 07/abr/2019 hs 16:56 /* Propósito: Escreva um programa que leia uma matriz de 5 linhas e 3 colunas de números inteiros. Faça uma validação de entrada de dados para aceitar somente números impares. Ao final da leitura escreva a matriz resultante na te...
C
#ifndef __AVL_H__ #define __AVL_H__ #include <stddef.h> /*should return 0 for equality; < 0 for key_2 > key_1; > 0 for key_1 > key_2*/ typedef int (*cmp_func_t)(const void *key_1, const void *key_2); /* should return 0 for success, non 0 for failure */ typedef int (*action_func_t)(void *key, void *act_func_arg); ...
C
/********************************************************************************************** *** Filename: *** Linked_list.c *** Copyright (c) 2013 Wistron *** All rights reserved. *** *** Description: *** Creat a linked list, you can insert and delete nodes, print the list. *** Author/Creat Date: *** Tenix Xu, ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "quicksort.h" #include "MinUnit/minunit.h" static char * test_quicksort_all_decreasing() { int length = 8; int * A = malloc(length * sizeof(int)); int * A_ordered = malloc(length * sizeof(int)); A[0] = A_ordered[7] = 7; A[1] = A_...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_next_line.c :+: :+: :+: ...
C
#include <stdio.h> struct struct_a { double a; int b; char c; }; struct struct_b { int a; double b; char c; }; void main(){ struct struct_a i; struct struct_b y; printf("Size of %zd\n",sizeof(i)); printf("Size of %zd\n",sizeof(y)); }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* img.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <signal.h> void mostra(int s){ printf("\nACORDA!!! (sinal %d)\n",s); } int main(int argc, char const *argv[]) { int i; char str[40]; signal(SIGALRM,mostra); // trata o sinal printf("O meu PID e %d...\n",getpid()); do{ pr...
C
#include <stdio.h> #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> #define FIFOFILE "fifo" int main(int argc, char** argv) { int n, fd; char buf[BUFSIZ]; if((fd = open(FIFOFILE,O_WRONLY)) < 0) { perror("open()"); return -1; } while((n=read(0,buf,sizeof(buf)))>0) { write(fd,buf,n); mems...
C
#pragma once /* Define to 1 to get verbose debugging */ #define VERBOSE_DEBUG 0 /* Debug global which can be set via command line flag --debug */ extern bool debug; /* Debug macros that are enabled via the --debug flag */ #define DEBUG_PRINTF(...) do { if(debug) { printf(__VA_ARGS__); } } while(0) #define DE...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include "intal.h" #define SIZE 1000 // Library "intal" - Integer of arbitray length // intal is a nonnegative integer of arbitrary length (not more than 1000 decimal digits). // The integer is stored as a null terminated string of ASCII characters. // S...
C
/************************************************************************* > File Name: BubbleSort.c > Author: > Mail: > Created Time: 2015年12月16日 星期三 16时58分17秒 ************************************************************************/ #include<stdio.h> void BubbleSort(RecordList L){ int i,j,k; int t;...
C
#include <stdlib.h> #include <stdbool.h> #include <assert.h> #include <stdio.h> #include <time.h> int holdwater2pass(int *h, int l) { int m=0; int m_i=0; for(int i=0; i<l; ++i) if(h[i]>m) { m = h[i]; m_i = i; } int tot = 0; int msf = 0; // max so far for(int i=0; i<m_i; ++i) { if(h[i]<msf) tot +...
C
#include <stdio.h> #include <cstdio> #include <iostream> #include <cstdlib> #include <random> using namespace std; #define MaxLevel 5 typedef struct SkipListNode { int value; int key; int level; SkipListNode* forward[MaxLevel]; } SkipListNode; typedef struct SkipList { SkipListNode* head; int...
C
void main() { int x; printf("Digite um numero:\n"); scanf("%d", &x); if(x % 3==0 & x % 5==0) printf("Numero digitado %d e divisivel por 3 e por 5", x); else printf("Numero digitado %d nao e divisivel por 3 e por 5", x); }
C
/********************************************************************************* * * problem_ten.h * Author: Ahmed Nofal, Avelabs Embedded software R&D crew * ********************************************************************************/ /****************************[Problem Description]********************...
C
/* __VA_ARGS__ 是一个预定义宏,表示 ... 的实际内容 前面需要加## ,不是字符串连接的意思,而是为了兼容 ... 为空的情况 */ #include <stdio.h> #define Log(format, ...) \ printf(format "\n", ##__VA_ARGS__);\ fflush(stdout); // 更简单 #define Log2(...) \ printf(__VA_ARGS__);\ fflush(stdout); int main() { Log("hello, %s", "world"); Log...
C
#include <stdint.h> #include <stdlib.h> #include <assert.h> #include <stdio.h> #include "gamma.h" #include <stdbool.h> #include <string.h> int main() { /* scenario: test_random_actions uuid: 212662754 */ /* random actions, total chaos */ gamma_t* board = gamma_new(4, 5, 9, 5); assert( board != NULL ); assert( gamm...
C
//whouse1.c - Nicculis' (armor shop guy) estate in Newbietown #include <std.h> #include "../../newbie.h" inherit INH"townmove.c"; void create() { ::create(); set_property("indoors",1); set_property("light",2); set_property("no sticks",1); set_terrain(STONE_BUILDING); se...
C
#include <stdio.h> int main() { char a, b, c; printf( "Introduzca primer caracter: " ); scanf( "%c", &a ); printf( "Introduzca segundo caracter: " ); fflush( stdin ); scanf( "%c", &b ); printf( "Introduzca tercer caracter: " ); fflush( stdin ); scanf( "%c", &c ); printf( "Los valores son...
C
/* 1.处理学生信息 一个学生信息 编号 姓名 年龄 性别 成绩 2.程序默认有10个学生的信息 有1个长度为10的结构体数组存储数据 */ #include <stdio.h> #include <string.h> #include <stdlib.h> #define NUM 20 /** 性别枚举,表示学员的性别 */ typedef enum { GenderMale, GenderFemale }Gender; /** * 学生结构体,表示1个学生的信息 */ typedef struct{ int id; char *name; ...
C
/* +--------------------------------------------------------------+ | System Programming Project 1 | | ( SIC Shell ) | | | | File : 20161622.h (header file) ...
C
// // tool.c // countList // // Created by Yutian Duan on 2018/10/29. // Copyright © 2018年 Wanwin. All rights reserved. // #include "tool.h" #include <stdlib.h> //! 打印 链表 void printLink (Node *node) { printf("start----\n"); while (node != NULL) { printf("data==%d\n",node->data); node = node->next;...
C
#include "minishell.h" int main(void) { extern char **environ; t_cmd s; int status; s.running = 1; ft_putstr_n("\e[1;1H\e[2J"); while (s.running == 1) { status = doshell(s, environ); if (status == -1) ft_putstr("\033[31mError: Unknown command!\033[0m"); if (status == -2) s...
C
#include <stdio.h> #define FLAG "this would be the flag" struct layout { char name[16]; int should_get_flag; }; int main(int argc, char **argv) { struct layout l; l.should_get_flag = 0; printf("Hello, world!\n"); printf("What's your name? "); gets(l.name); printf("Hello, %s!\n", l.name); if (l.sh...
C
#include "Client_Socket.h" int open_inet_connection () { struct sockaddr_in address; int descriptor; address.sin_family = AF_INET; address.sin_port = htons(15556); inet_pton(AF_INET, "192.168.1.249", &address.sin_addr); descriptor = socket (AF_INET, SOCK_STREAM, 0); if (descriptor == -1) return -1; if (c...
C
// // main.c // prog01 // // Created by k19061kk on 2019/10/17. // Copyright © 2019 AIT. All rights reserved. // /*--------------------------------+ プログラミング及び演習II 第3回 問題1 char,intの変数を2つずつ定義し、それぞれ の変数のアドレスを表示せよ。  +--------------------------------*/ #include <stdio.h> int main(int argc, const char * argv[]) {...
C
#include "main.h" int main(int argc, char* argv[]){ FILE* pInputFile; FILE* pOutputFile; char* inFileName = argv[2]; char* outFileName = NULL; int tab_caractere[256]; struct noeud* arbre_huffman[256] = {}; struct noeud* alphabet[256] = {}; int8_t flag = -1; int16_t opt = 0; p...
C
#include <stdio.h> #include <stdlib.h> /*************************** Complex Number *************************/ typedef struct { double re; double im; } Complex; // To initialize: z = {0, 0}; // #define M_PI 3.14159265358979323846 Complex ComplexPolar(double r, double theta); void ComplexPrint(Complex z); C...
C
// Universidad Sergio Arboleda // Arquitectura de Computadores // Samuel Medina y Rober Burgos // Seccion 12: Ordenamiento Capas. // En el presente ejercicio se ordenaran los numeros ". #include <stdio.h> // funcion la cual utilizaremos como medio de ordenamiento en estes caso // por medio de capas como lo dice su...
C
/* ** openfile.c for openfile.c in /home/dams/delivery/perso/sudoku_resolver/ ** ** Made by Damien Laurent ** Login <damien.laurent@epitech.eu@epitech.eu> ** ** Started on Sat Mar 11 17:50:25 2017 Damien Laurent ** Last update Sat Mar 11 18:51:35 2017 Damien Laurent */ #include "solver.h" #include <sys/types.h> #in...
C
//this first line is a comment //it's in the code to explain what the code does //compiler will ignore all comments //this next line is a preprocessor statement //to use a library function we have to include //the header for the library we are using //in this case stdio (standard input output) #include <stdio.h> /*th...
C
/*************************************************\ * Seat assignment logic. * Author: Daniel Amador Salas. * Created: 26-08-2018. * Version: 1.0. \*************************************************/ //Libraries. #include <stdio.h> #include <stdlib.h> #include <string.h> #include "Main.h" // Global variables char ...
C
#include<stdio.h> #include<conio> void main() { int i,j; for(i=1;i<=3;i++) { for(j=1;j<=3;j++) { printf("%d%d\n",i,j); } } }
C
#include <stdio.h> #include <string.h> #define MAX 200 char str1[MAX] ; char str2[MAX] ; void sansEspace(char* str1, char* str2){ int i; int j = 0; int mot=0; // int que_esp; for (i=0;i<=strlen(str1);i++){ if ( mot == 1 && *(str1+i+1) != '\0'){ *(str2+j) = 32 ; j++; mot = 0; } while(*(st...
C
/* Program.c * 高専ロボコン2017 Bチームプログラム * ver. 1.00 */ #include "includes.h" /* Funcs Predefine */ void main(void); void setup(void); void motor_emit(char channnel, int power); void motor_reset(void); void PS2_read(void); /* Data_Proc(int*) * データ処理 */ void Data_Proc(signed int* stat); /* Set_pwr(int*, int*, int) * ...
C
#include<stdio.h> #include<stdlib.h> struct stackNode{ int data; struct stackNode* next; }; //struct stackNode* createNode(int x); void push(struct stackNode** top, int x); int pop(struct stackNode** top); void printStack(struct stackNode* top); int isEmpty(struct stackNode* top); int main(){ struct stackNode* St...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "util.h" #include "pirs_display.h" void pirs_print_table(pirs_dt_table * table) { char bits[36]; int *colsizes; int height; int i, j; printf("%s\n", table->name); if (!table->noheader) printf("\n"); printf(" ...
C
# include<REG52.H> # include "MCP2515.h" # include "MCP2515.c" sbit LED_g = P3^4; //LEDָʾ sbit LED_r = P3^5; bit flag = 0 ; //λ־ unsigned char TX_DATA[8]; //CANͻ unsigned char RX_DATA[8]; //CANջ /***************************************************************************** ** ƣdelayms(unsigned int num) ** ʱnu...
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
/** * @file report.c * @author your name Anasi Nikitha * @brief This is report function which is used to generate the required transactions * particular month and also gives the info of the date and time the user used this * checked his transactions. * @version 0.1 * @date 2021-08-24 * ...
C
/*模块功能: 管理员功能实现 *作者: 章俊杰 *版本: 1.0 */ #include "head.h" #include "struct.h" #include "declaration.h" /* 函数功能:管理员菜单函数 * 形参: *p,*lot_pub,*user,*pwd * 返回值: */ int AdminMenu(lot_t *p,lot_pub_t *lot_pub,char *user,char *pwd) { if(p == NULL) { return 0; }//end of if int input = 0; while(1) { ShowAd...
C
#include "funciones.h" float resultadoSuma (float A, float B) //funcion que realiza una suma { float suma; suma = A + B; return suma; } float resultadoResta (float A, float B) //funcion que realiza una resta { float resta; resta = A - B; return resta; } float resultadoDivision (float A, float B) //funcion ...
C
#include <stdio.h> #include "int128bit.h" struct int128bit fib(int n){ struct int128bit fi; if(n < 2){ setValues(&fi, 0, n); return fi; } struct int128bit f0; setValues(&f0, 0, 0); struct int128bit f1; setValues(&f1, 0, 1); setValues(&fi, 0, 0); for(int i = 2; i <= n...