language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/************************************************************************\ Copyright 2008 University Corporation for Atmospheric Research. All rights reserved. Use of this code is subject to UCAR's standard Terms of Use, which can be found at http://www.ucar.edu/legal/terms_of_use.shtml . By using this source code...
C
#include <stdio.h> #include <stdbool.h> #include "sombrero.h" #define LIMITE_ATRIBUTO_NORMAL 8 #define MAXIMA_CANTIDAD_SUPERATRIBUTOS 2 #define STRING_FUERZA "Fuerza" #define STRING_VALOR "Valor" #define STRING_INTELIGENCIA "Inteligencia" #define STRING_INGENIO "Ingenio" #define STRING_DEDICACION "Dedicacion" #defin...
C
#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/ioctl.h> #include <net/if.h> #include <netinet/in.h> #include <netinet/ip.h> #include <netinet/if_ether.h> #include <arpa/inet.h> #include <time.h> #include <signal.h> #include <sys/stat.h> #include <unistd.h> #include...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* utils.c :+: :+: :+: ...
C
#include <stdio.h> #include <time.h> #include <stdlib.h> #include <stdbool.h> int main(int argc, char** argv){ int numberToGuess = 0; int upperBound = -1; int lastGuess = 0; char hardModeDecide = 'a'; bool guessedAlready = 0; bool hardMode = 0; if(argc == 2){ if(strcmp(argv[1], "-help") == 0 || strcmp(argv[...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "matriz_Esparsa.h" int main(int argc, char *argv[]) { //Definindo as matrizes Matriz* matriz1; Matriz* matriz2; Matriz* matriz_Soma; // Definindo os paramentros de entrada dos arquivos char *nome_Arquivo1 = argv[1]; cha...
C
/* ** EPITECH PROJECT, 2021 ** Workshop_Linked_lists ** File description: ** my_list */ #ifndef MY_LIST_H_ #define MY_LIST_H_ struct node { char *data; struct node *next; }; typedef struct node node_t; typedef struct node list_t; int my_put_in_list(list_t **list, char *data); int my_append_to_list(list_t **...
C
/** * vigenere.c * * Lisa Carson * User types in a keyword * User types in text encrypted */ #include <stdio.h> #include <cs50.h> #include <string.h> #include <stdlib.h> #include <ctype.h> int main(int argc, string argv[]) { // checks that there is only one keyword if (argc != 2) { ...
C
#include <stdio.h> int main(void) { FILE *fp; double pi = 3.14159265358979323846; printf("変数piから取り出した円周率は%23.21fです。\n", pi); if((fp = fopen("PI.txt", "w")) == NULL){ printf("\aファイルをオープン出来ません。\n"); }else{ fprintf(fp, "%f", pi); fclose(fp); } if((fp = fopen("PI.txt"...
C
// Function to create a casesar cipher // // // This program was written by Jake Edwards (z5165158) // on 15/07/2021 #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #define LENGTH 256 int decode(int input,char *identity); int main(int argc, char *argv[]) { int pos; char string...
C
/* * ecg.c * * */ // Implements #include "ecg.h" #include "radio.h" #include "alarm.h" // Uses #include <sys/socket.h> #include <arpa/inet.h> #include <stdio.h> #include <string.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #define timeout 200 #define BUFLEN 4096 #define DATA 0 #define ACK 1 ...
C
/* * Author: Lawson Fulton * Student#: 20381453 * ID: ljfulton */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #define TARGET "/usr/local/bin/backup" #define DEFAULT_OFFSET 10 #define DEFAULT_BUFFER_SIZE 3072 #define NOP 0x90 /* * Aleph One s...
C
#include "monty.h" /** * push_opt - pushes an element to the stack * @head: head of stack * @ln: line number * Return: void */ void push_opt(stack_t **head, unsigned int ln) { int node, i = 0; if (aux.val) { if (aux.val[0] == '-') i++; for (; aux.val[i] != '\0'; i++) { if (isdigit(aux.val[i]) == 0) ...
C
//ME04_2.c //pointers #include<stdio.h> void swap(int *num1, int *num2){ //swap int swapper; swapper = *num1; *num1 = *num2; *num2 = swapper; } int main(void){ int a, b; printf("Enter num1: "); scanf("%d", &a); printf("Enter num2: "); scanf("%d", &b); swap(&a, &b); printf("Exchanged: A = %d, B = %d...
C
#include <conio.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <Windows.h> #define TAILLETAB 100 struct PoulsDonnees { int pouls; int temps; struct PoulsDonnees *next; struct PoulsDonnees *last; }; void libererDonneesPoul(struct PoulsDonnees **listePouls) { free(listePouls[0]); } // Cr...
C
#include <netdb.h> #include <sys/socket.h> #include <unistd.h> #include <stdio.h> #include <arpa/inet.h> #include <stdlib.h> int main(int argc, char** argv) { if (argc == 1) { printf("Usage: %s <url>\n", argv[0]); exit(1); } struct hostent* ip = gethostbyname(argv[1]); if (ip == NULL) { print...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "onegin.h" int main(void) { FILE *ifp, *ofp; char **lineptr = (char**)(calloc(MAXLINE,sizeof(char))); char s[MAXLINE]; int i, nl, n = 1; int max = MAXLINE; ifp = fopen(IFNAME, "r"); if (ifp == NULL) { fclose(ifp); ex_handler(); ...
C
#include "jcscheme.h" #include "tree.h" // Nil static const expr nil[] = { {.tag = T_NIL}, }; expr const * const Nil = nil; extern inline bool is_nil(expr const *exp); // Lists expr const* cons(expr const *car, expr const *cdr) { expr *list = emalloc(sizeof *list); *list = (expr) { .tag = T_PAIR, { (struct c...
C
#include <stdio.h> '''_______''' total = 0.0; '''_______''' count = 0; '''_______''' tax_percent = 6; '''_______''' add_with_tax(float f) { '''_______''' tax_rate = 1 + tax_percent / 100'''____'''; total = total + (f * tax_rate); count = count + 1; return total; } int main() { '''________''' val...
C
/* һλܰļҳҪĺһЩСɡǣÿֻܸһɡ ÿ iһθֵ g[i]úθڵıɵСߴ磻 ÿ jһߴ s[j] s[j] >= g[i]ǿԽ j i ӻõ㡣 ĿǾԽĺӣֵ ʾ1: : g = [1,2,3], s = [1,1] : 1 : ӺСɣ3ӵθֱֵǣ1,2,3 ȻСɣǵijߴ綼1ֻθֵ1ĺ㡣 Ӧ1 ʾ2: : g = [1,2], s = [1,2,3] : 2 : ӺСɣ2ӵθֱֵ1,2 ӵеıͳߴ綼к㡣 Ӧ2. ʾ 1 <= g.length <= 3 * 104 0 <= s.length <= 3 * 104 1 <= g[i], s[j] <= 231...
C
#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <stdbool.h> typedef uint8_t BYTE; const int BLOCK = 512; const int LETTERS = 7; bool isJpeg(BYTE* buf); void parseJpeg(FILE* rawFile); int main(int argc, char *argv[]) { if (argc != 2) { fprintf(stderr, "Usage: ./recover infile \n");...
C
/* ** EPITECH PROJECT, 2018 ** task02day05 ** File description: ** recursive fact */ #include <unistd.h> void my_putchar(char c); int my_compute_factorial_rec(int nb) { if (nb < 0 || nb >= 13) { return (0); } else if (nb == 0) { return (1); } else { return my_compute_factorial_rec...
C
#ifndef STRING_STORE_H #define STRING_STORE_H #include "config.h" #include <stddef.h> #define INVALID_INDEX 0xFFFFFFFF typedef struct string_store_t string_store_t; typedef struct string_store_writer_t string_store_writer_t; typedef struct string_store_reader_t string_store_reader_t; string_store_t *string_store_c...
C
//http://www.linuxjournal.com/article/6345?page=0,0 if(fcntl(fd, F_SETSIG, RT_SIGNAL_LEASE) == -1) { perror("kernel lease set signal"); return -1; } tmp_buf = mmap(file, len); write(socket, tmp_buf, len); /* l_type can be F_RDLCK F_WRLCK */ if(fcntl(fd, F_SETLEASE, l_type)){ perror("kernel lease set type...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> /* for unlink() */ #include <sys/stat.h> /* for stat() */ #include "glk.h" #include "cheapglk.h" /* This file implements filerefs as they work in a stdio system: a fileref contains a pathname, a text/binary flag, and a file type. */...
C
#include <reg52.h> #include "rs232.h" #include <stdarg.h> #include <stdio.h> void comm_init(); void send1Byte (unsigned char value); unsigned char read1Byte (); RS232 rs232 = { comm_init, send1Byte, read1Byte }; void comm_init() { //ĬϴͨѶDz //ʼͨ //ôڹʽΪʽ1,8λ첽շ,ʿɱ SM0=0; //SCON SM1=1; TMOD=0x20;//öʱ1Ϊʽ2(8λġ) ...
C
#if !defined(CARRAYS_C) /* Use: - Some data you want to use in arrays. struct SomeData { .... }; MAKE_ARRAY(SomeDataArray, SomeData) - Usage SomeDataArray array; ARRAY_INIT(array, 100) ARRAY_PUSH(array, some_data) SomeData* temp = ARRAY_POP(array) // It's po...
C
// Data set size #define N 100 #define STEP 1000 #include <stdio.h> int main() { // input initialization int i,j,k,t; int check; int m; float A[2*N]; float A_ref[2*N]; srand(1); FILE *f = fopen("iter.dat", "w"); if (!f) { printf("Error opening file!\n"); exit(1); } for(t...
C
/* test16colors.c - A.A.Shabarshin (Apr-May 2015) */ #include <stdio.h> #include <math.h> #define RGB(r,g,b) (r|(g<<8)|(b<<16)) unsigned long actual[16] = { #if 0 RGB( 4, 4, 12), RGB( 1, 19, 159), RGB( 70, 2, 172), RGB( 1, 86, 255), RGB(102, 15, 15), RGB(122, 133, 137), RGB(249, 49, 131), RGB(21...
C
/* SysTick driver. Written for a specific project. Not intended for general use. */ #include "systick.h" void SysTick_Handler(void){ // The systick fires each millisecond. Increemnt the global ms_value // variable every ms. ms_value++; } void SysTick_init(void){ // Disable systick and interrupts while making cha...
C
#include<stdio.h> int main() { int c; while(1){ c=getchar(); if(c==EOF) break; if(c=='\n') printf(","); else printf("%c",c); } return 0; }
C
/* * PowerMgr.c * * Created on: May 29, 2021 * Author: rzesz */ #include "PowerMgr.h" #include "main.h" void Switch_PowerMode(volatile PowerMode *flag) { if (FULL_OPERATIONAL == *flag) { *flag = STOP_MODE; HAL_SuspendTick(); HAL_GPIO_WritePin(LED_GPIO_Port, LED_P...
C
#include <stdlib.h> /* malloc, free */ #include <assert.h> /* assert */ #include "bst.h" /* bst_node_t, bst_t, bst_iter_t, bst_is_before_func_t */ struct bst_node { bst_node_t *parent; bst_node_t *child_before, *child_after; void *data; }; struct bst { bst_node_t *root; bst_is_befo...
C
#include <stdio.h> int main(int argc, char *argv[]) { puts("Hello world."); puts("This is my second line."); puts("This is my third line."); puts("This is my, awe screw it..."); puts("Um...hello again, I guess..."); return 0; }
C
/* * File: main.c * Author: Monica Ignat * * Created on April 3rd, 2017 */ #include <stdio.h> #include <stdlib.h> #include <xc.h> #include <sys/attribs.h> #include <stdbool.h> #include <string.h> #include "config.h" #include "uart.h" #include "lcd.h" #include "uartjb.h" #pragma config JTAGEN = OFF #pragm...
C
#include "jl_cv.h" void jl_cv_getoutput(jl_cv_t* jl_cv); void jl_cv_disp_gray_(jl_cv_t* jl_cv); void jl_cv_draw_circle(jl_cv_t* jl_cv, jl_rect_t circle) { jl_cv_getoutput(jl_cv); cvCircle(jl_cv->image_rgb, cvPoint(cvRound(circle.x), cvRound(circle.y)), cvRound(circle.w), CV_RGB(0x00,0xFF,0x00), 1, 8, 0); jl_cv...
C
#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <fcntl.h> #include <string.h> #include <sys/types.h> #include <sys/wait.h> #include <sys/ioctl.h> #include <pthread.h> void setoff(int fd,long long size){ ioctl(fd,0x6677889C,size); } void core_read(int fd,char *buf){ ioctl(fd,0x6677889b,buf); } void...
C
#include <stdio.h> #define MAXCOL 60 #define MAXROW 20 int rows=MAXROW; int cols=0; char screen[MAXROW][MAXCOL]; void setup(){ int r,c; for(r=0;r<MAXROW;r++) for(c=0;c<MAXCOL;c++) screen[r][c]=' '; } void printb(){ int r,c; for(r=rows;r<MAXROW;r++) { for(c=0;c<=cols;c++) printf("%c",screen[r][c]); printf("...
C
#include <stdio.h> int main() { int var = 10; printf("%d\n",var); return 0; }
C
// Copyright 2020 Copyright Equipo 2 /* Minimal printf() facility for MCUs * Warren W. Gay VE3WWG, Sun Feb 12 2017 * * This work is placed into the public domain. No warranty, or guarantee * is expressed or implied. When uou use this source code, you do so * with full responsibility. */ #ifndef MINIPRINTF_H ...
C
#include<stdio.h> #include<math.h> int main() { int i; for (i = 1; i <= 100; i++) { while(i%2==0) { printf("%d\n",i); i++; } } return 0; }
C
#include "filter.h" // Filters the collisions according to the time that it took place void filterCollisions(collision_t** collisionArray, bool* hasCollided, int* numCollisions) { // Quicksort all collision candidates with the comparator function qsort(collisionArray, *numCollisions, sizeof(collision_t...
C
#include <assert.h> #include <stdlib.h> #include <stdbool.h> #include <linux/audit.h> #include <linux/filter.h> #include <linux/seccomp.h> #include <seccomp.h> /* libseccomp */ #include "types.h" #include "matching_unit.h" #include "queue.h" token_waiting_table_type* token_waiting_table; key_type token_to_key(tok...
C
#include <stdio.h> #include <stdlib.h> #include <sys/ipc.h> #include <sys/shm.h> #include "utils.h" #include <unistd.h> #define KEY 369 #define PERM 0666 int* z; int shm_id; //****************************************************************************** //INIT SHARED MEMORY //************************************...
C
#include "apue.h" #include<pthread.h> #include<unistd.h> struct foo { int a, b, c, d; }; void pr_foo(struct foo *f, const char *msg) { printf("%s a = %d, b = %d, c = %d, d = %d\n", msg, f->a, f->b, f->c, f->d); } void* thr_fn1(void *arg) { struct foo f = {1, 2, 3, 4}; pr_foo(&f, "thread: "); p...
C
/* vim: set sw=2 expandtab tw=80: */ #include <stdio.h> #include "hello.h" int main(void) { if(hello_is_present()){ printf("Hello driver present \r\n"); } else{ printf("Hello driver not present \r\n"); } return 0; }
C
#pragma once #include <stdint.h> #include <stdio.h> #include <ctype.h> typedef uint32_t Price; typedef uint32_t Quantity; enum class Side : uint8_t { bid = 1, ask = 0, }; inline void toString(char* buf, size_t bufLen, Side s) { snprintf(buf, bufLen, "%s", s == Side::bid ? "bid" : "ask"); } union Symbol...
C
#include <stdio.h> #include <string.h> #include <float.h> #include <math.h> #include <errno.h> #include <munit/munit.h> #include <value.h> MunitResult test_value_cast(const MunitParameter Parameters[], void *Fixture) { VALUE sCopy, sValue; errno = 0; munit_assert_int(value_cast(NULL, TYPE_NONE), ==, -1...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_place_piece_left_right.c :+: :+: :+: ...
C
/* Copyright (c) 2017 Stanford University * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR(S) DI...
C
#include<stdio.h> #include<conio.h> int main() { int t,i,count; long long int a,b; scanf("%d",&t); for(i=0;i<t;i++) { count=0; scanf("%lld %lld",&a,&b); if(a==b) { printf("%d\n",count);} else { while((a&(a-1))!=0) { if(a%2==0) { count++; a=a/2; } else { count...
C
// BWOTSHEWCHB #include <stdio.h> #include <math.h> int main() { int x1 , y1 , x2 , y2 , x3 , y3 ; double midX , midY ; scanf("%d%d%d%d%d%d" , &x1 , &y1 , &x2 , &y2 , &x3 , &y3) ; midX = (x1 + x3) / 2.0 , midY = (y1 + y3) / 2.0 ; double dx1 = fabs(midX - x1) , dx2 = fabs(midX - x2) , dy1 = fabs(midY - y1) , dy2...
C
#include <stdio.h> #include <stdlib.h> #include "rand55.h" long Seed=161803398L; Lnk_List_Ptr Ran, n1, n2; #ifdef INLINE inline #endif double rand55() { n1 = n1->next; n2 = n2->next; n1->Y += n2->Y; return (double)n1->Y * Norm_Factor ; } void rand_init(long idum) { int i, j; long tmp, ...
C
#include<stdio.h> #pragma warning(disable:4996) int main() { int a, b; char c[3]; char d[3]; scanf("%s %s", c, d); a = (c[0]-'0') + (c[1]-'0') * 10 + (c[2]-'0') * 100; b = (d[0]-'0') + (d[1]-'0') * 10 +( d[2]-'0') * 100; if (a > b) { printf("%d\n", a); } else if (b > a) { printf("%d\n", b); } return 0; }
C
#include "page.h" #include "asm.h" #include "memory.h" #include "task.h" #include "string.h" #include "lib/log.h" #include "fs/file.h" #include "mem/frame.h" static void on_page_not_exist(vm_t linear, pt_t pt, int npte); void on_page_fault(IrqFrame *irq) { vm_t linear = (vm_t)PAGE_FLOOR(get_cr2()); KLOG(DEBUG...
C
#include <stdio.h> #define NUM 3 struct person { char name[20]; char phone[10]; }; //Ҫӷֺŵ void main() { struct person man[NUM]; //ṹ int i; for (i=0 ; i<=NUM ; i++) { printf("please input name:\n"); gets(man[i].name); //ṹԪػȡ printf("please input phone:\n"); gets(man[i].phone); } printf("\tname\t\t...
C
// For base code, see http://stackoverflow.com/questions/18591758/sdl2-tilemap-too-slow /* Conventions: Externally visible variables and functions are prefix by the filename in which they are implemented. For example, window_init() is defined in window.c. Other than the prfix for globally visible identifiers...
C
#include <stdio.h> #include <stdlib.h> int main() { long squaresum = 0, sumtosquare = 0; for (int i=1; i<=100; i++) { squaresum += i*i; sumtosquare += i; } printf("Final Result: %ld\n", sumtosquare*sumtosquare - squaresum); return 0; }
C
#include <stdio.h> int main(void){ int i, nums[5], total = 0; printf("Input the first number: "); scanf("%d", &nums[0]); printf("Input the second number: "); scanf("%d", &nums[1]); printf("Input the thirdnumber: "); scanf("%d", &nums[2]); printf("Input the fourth number:...
C
/* * This file contains teh expression calculator function eval. */ #include <stdio.h> #include "calc.h" /** * Given an operator, this function will perform the * operation, using the top two numbers on the operatnd stack. **/ void eval() { printf("Entered eval\n"); }
C
#include<stdio.h> int esPerfecto(int n); int main() { int i, resultado; printf("\n*****NUMEROS PERFECTOS***** \n"); for (i=1;i<=100;i++) { resultado = esPerfecto(i); if (resultado == 1) printf(" %d Es un numero perfecto \n",i); } return 0; } int esPerfecto(...
C
#include "holberton.h" /** * print_triangle - make a triangule. * * @size: parameter. */ void print_triangle(int size) { int numl, esp, nume; if (size <= 0) { _putchar('\n'); } else { numl = 1; while (numl <= size) { esp = 1; while (esp <= (size - numl)) { _putchar(' '); esp++; ...
C
#ifndef clock_h #define clock_h #include "timer.h" static long timer0_count = 0; void on_timer0() { ++timer0_count; } void clock_begin() { timer0.init(); timer0.tcnt_val = 0; timer0.slot = on_timer0; timer0.reset(); } #define clock clock_ms long clock_ms() { long passed = long(timer0.tcnt) * (1024 * (1. / (...
C
#include<stdio.h> main() { int num,temp,sum=0; printf("enter the num:"); scanf("%d",&num); temp=num; while(num) { sum=sum+((num%10)*(num%10)*(num%10)); num=num/10; } if(sum==temp) printf("amsrong no\n"); else printf("wrong\n"); }
C
#include <stdio.h> #include <stdlib.h> void strings(FILE *f) { int length = 1024; char buff[4], str[length], current = 0; buff[3] = '\0'; str[length - 1] = '\0'; while (fgets(str, length, f) != NULL) { int i; for (i = 0; str[i] != '\0'; ++i) { char c = str[i]; if ((c < 32 && c != '\t') ||...
C
// Name - Mananpreet Singh Chhatwal // Entry Number - 2020CSZ0008 #include <stdio.h> // Question // (2) Write a C function to count and print the number of 1-bits in its integer argument. Again your program should // ask the user to enter an integer number. Your program should run correctly regardless of the machine...
C
#include <stdio.h> #include <stdlib.h> int main() { int a, b, c, min, ukp, usteda; printf("Uneti cene\n"); scanf("%d %d %d", &a, &b, &c); min=a; if (b<min) { min=b; } if (c<min) { min=c; } ukp=a+b+c-min+1; printf("Ukupno %d\n Usteda %d\n", ukp, min-1); return 0; }
C
//EXEC_CNT is a global variable counting how many times an x position has been selected //PX1 and PX2 are pointers to global variables that store the x positions recorded //Globals are initialized in controlbar #include "fitgaussian.c" #include "myglobals.h" using namespace std; void exec4() { //if(*PEXEC_CNT == 0...
C
#include <stdio.h> #include <stdlib.h> #include "structure.h" int box_blanc(ligne m_ligne, liste ind_ligne, int longueur_ligne, liste *L_modif) //renvoie 1 quand fini { int i=0;//compteur de cases sur la ligne int k=0;//compteur de cases noires sur la ligne int s=0;//somme des indices=nombre total ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* anti_aliasing.c :+: :+: :+: ...
C
#include <stdio.h> #include <malloc.h> #include <pthread.h> struct descritor { int vet[100]; int size; int i, e; pthread_mutex_t m; }; void* soma( void* dta ) { int *aux, i; struct descritor *d = (struct descritor*) dta; printf("Soma\n"); aux = (int*) malloc(sizeof(int)); *aux = 0; for( i = d->i ...
C
#include <string.h> #include <stdlib.h> #include <stdio.h> #include <stdint.h> #include <mosquitto.h> #include <mosquitto_plugin.h> #include "sqlite_auth_plugin.h" #include "sqlite_mosquitto.h" #include "utils.h" #include "json.h" database_t *database; user_t *user; manage_user_t *manage_user; char *manage_use...
C
/* ** EPITECH PROJECT, 2018 ** particle ** File description: ** alpha */ #include "lib_graph.h" void set_sprite_alpha(particle_t *item, int alpha) { sfColor color; if (item && alpha >= 0) { color = sfSprite_getColor(item->sprite); if (color.a <= 0) return; color.a = (sfUint8)alpha; sfSprite_setColor(it...
C
/* * Attribute support code for Mini-XML, a small XML file parsing library. * * https://www.msweet.org/mxml * * Copyright © 2003-2021 by Michael R Sweet. * * Licensed under Apache License v2.0. See the file "LICENSE" for more * information. */ /* * Include necessary headers... */ #include "config.h" #incl...
C
/* * client UDP * need xinited with ubuntu linux * RP 11/10/98 */ #include <sys/socket.h> #include <netinet/in.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <netdb.h> //#define PORT 33333 //serveur_udp #define PORT 13 //daytime //#define PORT 19 //chargen //#define PORT 7 //echo #defin...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <sys/time.h> #include <sys/types.h> #define BUFFER_SIZE 100 int main(int argc, char **argv) { int fd; off_t fsize; int records; int timecost; int buf[BUFFER_SIZE]; int repeat; struct timeval start_time; ...
C
/* * Copyright 04/17/07 Sun Microsystems, Inc. All Rights Reserved * @(#)prime_omp.c 1.2 07/04/17 SMI */ #include <stdio.h> #include <math.h> #include <omp.h> #define THREADS 4 #define N 10000 int primes[N]; int pflag[N]; int is_prime(int v) { int i; int bound = floor(sqrt(v)) + 1; for (i = ...
C
/** * * Hodaya Koslowsky * Comments are in the header files * */ #ifndef OS_EX2_JOBLIST_H #define OS_EX2_JOBLIST_H #include <unistd.h> typedef enum { bg, fg } JobState; typedef struct { pid_t pid; int jobId; char **args; // including the name int numArgs; JobState state; } Job; typedef struct No...
C
/*PROG25 - Program to find factorial of a number using while*/ /*Authors: Asmit De, Shinjini Basu Date: 14.08.2008*/ #include <stdio.h> #include <conio.h> float Factorial(int n) { float fact=1; while(n>=1) { fact=fact*n; n--; } return fact; } void main() { int num; flo...
C
/*Auteur: VAN Cyril *Création: 25-02-2020 *Modifications: 25-02-2020 | 02-03-2020 | 03-03-2020*/ #include "UnionFind.h" coordonnees_t trouver_compresse(laby_t * laby, int x, int y){ int x_case, y_case; coordonnees_t pere_case; x_case = x + 1; y_case = y + 1; pere_case = laby->cases[x_case][y_case].pere; if (...
C
#include <stdio.h> #include <math.h> #include <string.h> #include <stdlib.h> #include <mpi.h> #include <pthread.h> #include <time.h> // Used in MPI_CART_SHIFT to find neighbour process: #define SHIFT_ROW 0 #define SHIFT_COL 1 // Displacement by 1: #define DISP 1 // Maximum Iterations: #define MAX_ITER 100 // Sensor T...
C
/* ** EPITECH PROJECT, 2018 ** Test_criterion ** File description: ** Test de save_map */ #include <criterion/criterion.h> #include <lib.h> #include "map.h" #include "file.h" Test(test_save_map, Test_entry_NULL, .timeout = 0.5, .exit_code = 0) { cr_assert_eq(save_map("./test_save_map1", NULL, 0.01), -1); } Test(tes...
C
// Little Black Jack Game made by Hung Nguyen for fun (3-4 hours) #include <time.h> #include "blackjack.h" int main(void) { char name[20]; srand(time(0)); getName(name); while (1) { welcomeUser(name); blackJack(name); if (playAgain() == 0) break...
C
#include<stdio.h> #include<string.h> int main() { int l,one,in_num,N,mod; while(scanf("%d",&in_num)!=EOF) { N=mod=one=1; while(mod!=0) { if(N<in_num) { N=(N*10+1); one++; } else { ...
C
/* e_interrupt_test.c Copyright (C) 2012 Adapteva, Inc. Contributed by Wenlin Song <wsong@wpi.edu> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option)...
C
#include <stdio.h> void rotate_left(unsigned int *number, int bits) { printf("%d\n", ((*number) << bits) | (*number) >> (32 - bits)); } void rotate_right(unsigned int *number, int bits) { printf("%d\n", ((*number) >> bits | (*number) << (32 - bits))); } int main() { unsigned int number = 0x80000000; int bits = 1...
C
#include <stdio.h> #include <stdlib.h> typedef struct punto_{ float x; float y; float z; }punto; typedef struct Triangulo_{ punto p1; punto p2; punto p3; }Triangulo; int triangulos[3]; float calcularPerimetro; float calcularArea; FILE leerDatos; int numLineasArchivos; int mayorArea; int mayorPerimetro; int...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <dirent.h> #include <sys/stat.h> #include <sys/types.h> #include <pwd.h> #include <linux/kdev_t.h> #include <time.h> void getstat(char *fpath,char *stat); int getCmdline(char *fpath,int pid,char *buf); void getTty(char *fpath,char ...
C
#include<stdio.h> void main() { int n,a=1,c,i; printf("enter the num:"); scanf("%d",&n); c=n/2; for(i=1;i<=c+1;i++) { if(a<=n) a=a*2; else break; } printf("%d nearest greater power of 2 is = %d",n,a); }
C
/* A CIL generated test with no successors is generated for this program, however that statement is unreachable */ #include <stdio.h> int foo() { int number; switch(number) { case 1: return 1; case 2: return -5; default: return 0; } } int main() { int err; err = foo(); printf("%d...
C
#include <stdio.h> #include <stdlib.h> void insertion(int[],int); int main() { int len; int i; int vectorPrueba[11]={2,5,8,3,9,4,5,10,56,12,7}; //len = sizeof(vectorPrueba)/sizeof(vectorPrueba[0]); // MEDIR LARGO DE ARRAY //printf("%d tamanio\n",len); insertion(vectorPrueba,11); for(i=0;i<...
C
#include<stdio.h> #include<string.h> #include<ctype.h> #define max 5 typedef struct { char idno[13]; char name[50]; char gender; char resident; float cgpa; char emailaddr[33]; } student; void populate_records(student arr[]) { int i; for(i=0;i<max;i++) { scanf("%[^,]s",arr[i].idno); getchar(); scanf("%[...
C
#include "holberton.h" #include <stdlib.h> /** * _strdup - creates a copy of a given string * @str: string to copy * * Return: a pointer to a newly allocated space in memory which contains * a copy of the given string or NULL if it fails */ char *_strdup(char *str) { unsigned int i, size = 0; char *cpy; if ...
C
#include <stdio.h> int num_arr[1001];// . int main_11866_0() { int n, k;//n , k ° 似Ǫ Ǻ scanf("%d %d", &n, &k); //ʱ for (int i = 0; i < n; ++i) { num_arr[i] = i + 1; } int total_count = 0;//ü īƮ int index = 0;//ʱ ε int count = 0;//k ɶ īƮ int new_index = 0;// ε. printf("<"); while (total_co...
C
#include<stdio.h> #include<stdlib.h> struct node{ int info; struct node *link;}; struct node *start=NULL; struct node* createnode(){ struct node *n; n=(struct node *)malloc(sizeof(struct node)); return(n);} void insertnode(){ struct node *temp1,*temp2; temp1=createnode(); printf("\nEnter informat...
C
/* * Cesar Marrote Manzano RA: 18051755 * Fabricio Silva Cardoso RA: 18023481 * Pedro Ignácio Trevisan RA: 18016568 */ #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <stdio.h> #include <netdb.h> #include <stdlib.h> #include <string.h> #include <arpa/inet.h> ...
C
#include <stdlib.h> #include "util/CommandWrapper.H" CommandWrapper::CommandWrapper() { } CommandWrapper::CommandWrapper(const string& cmd) { p_cmd = cmd; } CommandWrapper::CommandWrapper(const CommandWrapper& rhs) { p_cmd = rhs.p_cmd; } string CommandWrapper::getCommand() { return p_cmd; } void CommandWr...
C
// Ron Ocampo // Dinggao Pan // 11/10/2017 // HW2 SW PWM w/o ptp #include <time.h> #include <stdio.h> #include <signal.h> #include <stdlib.h> #include <stdint.h> #include <string.h> #include <unistd.h> #define PULSELEN 1000000 #define TONANO 1000000000 #define CONFIGPIN "\ #/bin/bash \n\ config-pin overlay cape-uni...
C
#include<stdio.h> #include<string.h> #include<stdlib.h> #include<ctype.h> int top=-1; int MAXSIZE = 50; char stack[50]; int isFull() { if (top == MAXSIZE-1) return 1 ; else return 0 ; } void push (char item) { if ( ! isFull() ) { top=top+1; stack[top]=item; } } in...
C
#include <stdio.h> int main() { int a[50],n,m,tot; int begin,end,i,j,k; printf("Enter the total size of element to be entered:\n "); scanf("%d",&n); printf("Enter the elements:\n"); for(k=0;k<n;k++) { scanf("%d",&a[k]); } for(tot=1;tot<=n;tot++) { m=n-tot; for(begin=0;begin<=m;begin++) { ...