language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include "TCanvas.h"
#include "TROOT.h"
#include "TGraphErrors.h"
#include "TF1.h"
#include "TH1F.h"
#include "TLegend.h"
#include "TFile.h"
#include "TArrow.h"
#include "TLatex.h"
#include "TMath.h"
#include "TMultiGraph.h"
#include <iostream>
#include <math.h>
#include <vector>
using namespace std;
Double_t ... |
C | #include <stdio.h>
#include <stdlib.h>
void diziYaz(int dizi[], int satir)
{
for (int i = 0; i < satir; i++)
printf("%d ", dizi[i]);
}
void diziYaz2B(int dizi[][4], int satir, int sutun)
{
for (int i = 0; i < satir; i++) {
for (int j = 0; j < sutun; j++)
printf("%d ", dizi[i][j]);
printf("\n");
... |
C | #include <stdio.h>
#define LIMIT 8 //max number of items, one byte
int hexToInt(char []);
float power(float, int);
void main(){
char sentence[LIMIT];
int c, i;
i = 0;
while((c = getchar())!= EOF && c != '\n' && i < LIMIT){
if((i == 0) && c == '0')
sentence[i++] = c;
else if((i == 1) && (c == 'x' || c == ... |
C | #include <stdlib.h>
#include<stdio.h>
#include <pthread.h>
#include "life.h"
#include "util.h"
#include<assert.h>
/**************************************************************
* This file contains the parallel implementation of the game
* of life.
*
* Authors: Divya Dadlani
* Geetika Saksena
* (Team Basi... |
C | #include<stdio.h>
int main()
{
int a,b;
a=10,b=12;
printf("before swap a=%d b=%d\n",a,b);
b=b^a;
a=b^a;
b=b^a;
printf("after swap a=%d b=%d",a,b);
return 0;
}
|
C | /*
* Aula.c
*
* Created on: 26 mar. 2020
* Author: Xabier
*/
#include "Aula.h"
#include "Asignatura.h"
void reserva (Aula *aula, int dia, int hora, Asignatura asig){
if(aula->ocupadapor[dia][hora].creditos == 0){
aula->ocupadapor[dia][hora] = asig;
}else{
printf("Ocupada.");... |
C | //Huffman Codes
#include<stdio.h>
#include<stdlib.h>
int n;
struct node
{
struct node *lchild;
char data;
int freq;
struct node *rchild;
};
void min_heapify(struct node a[],int i)
{
int l,r,smallest;
struct node temp;
l=2*i+1;
r=2*i+2;
if((a[l].freq<a[i].freq)&&(l<n))
{
smallest=l;
}
else
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "linkedlist.h"
LinkedList* createLinkedList()
{
LinkedList *pReturn = NULL;
int i = 0;
pReturn = (LinkedList *)malloc(sizeof(LinkedList));
if (pReturn != NULL)
{
memset(pReturn, 0, sizeof(LinkedList));
}
else
{... |
C | /**
******************************************************************************
* @file main.c
* @author Anton Kabanov
* @version V1.0
* @date 22-March-2019
* @brief Default main function.
******************************************************************************
*/
#include "stm32f10x.h"
... |
C | #pragma once
#include <arduino.h>
#include "Buffer.h"
#include "Definitions.h"
#include "Functions.h"
#include "PhysicalLayer.h"
#include "Packet.h"
#include <LiquidCrystal.h>
// INITIALIZES THE IO-PINS CORRECTLY
// IN: NONE
// OUT: NONE
void initialize_pins(void);
// CONVERTS CHARACTERS IN HEX TO INTEGERS
// IN: CH... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
enum Suit {
Clubs=1, Diamonds=1<<1, Hearts=1<<2, Spades=1<<3, Suit_End=1<<4
};
typedef enum Suit Suit;
// Sorry for the Two=0
enum Pips {
Two=0, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King, Ace, NumberOfPips
};
typedef enum Pips Pips;
... |
C | /**
* @file stsprite.h
*
* STFM Sprite kernel for GCC
* @author (c) 2008/2009/2018/2019 by Simon Sunnyboy / Paradize
* @copyright http://paradize.atari.org/
*
* Special thanks and acknowledgements:
* -- ggn / Paradize (for writing the Blitter sprite routine for HOG mode
* and for finding t... |
C | /*
** EPITECH PROJECT, 2017
** liblist
** File description:
** Created by antoine_dh,
*/
#include "list.h"
int list_delete_matching_nodes(list_t **begin, list_match_t match,
list_del_t del, ...)
{
va_list ap;
va_list cpy;
list_t *tmp = *begin;
int num = 0;
va_start(ap, del);
while (tmp !=... |
C | #include <stdio.h>
#include <stdlib.h>
void rotate(char matrix[10][10]) {
int size = 10;
// 1st: flip horizontally
int ptrLeft, ptrRight;
char tmp;
for (int i = 0; i < size; i++) {
ptrLeft = 0;
ptrRight = size - 1;
// swap
while (ptrLeft < ptrRight) {
tmp = matrix[i][ptrLeft];
mat... |
C | /* File Color.h
* Defines a structure for holding RGBA color information that can be accessed
* in 3 different formats.
*
*
*/
#ifndef COLOR_H
#define COLOR_H
#include "stdtypes.h"
// in memory: r g b a
typedef union Color
{
// Allows direct access to individual components.
struct{
U8 r;
... |
C | /**
* Author: Will Cook
* wcook2@huskers.unl.edu
* Date: 2020/08/19
*
* A simple hello world program in C
*
*/
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char **argv) {
printf("Will Cook\n");
printf("Computer Science\n");
return 0;
}
|
C | #include <stdio.h>
#define N 100
void loop_fusion05( int a[N], int b[N]) {
int i,j;
/* The first loop can't be fused */
for( i=0; i<N; i++ ) {
a[i] = i;
}
for( j=0; j<N; j++ ) {
b[j] += a[j+1];
}
printf("Is j initialized ? %d\n",j);
}
|
C | #include <stdio.h>
int main()
{
char *p, str[80];
printf("Enter a string: ");
p = gets(str);
if(p) printf("%s %s", p,str);
return 0;
}
|
C | #include<stdio.h>
int main(void)
{
int count=1;
char i,j,k,l;
printf("The result of ballot is:\n");
for(i='W';i<='Z';i++)
{
for(j='W';j<='Z';j++)
{
if(i!=j)
{
for(k='W';k<='Z';k++)
{
if(i!=k&&j!=k)
{
for(l='W';l<='Z';l++)
{
if(l!=i&&l!=j&&l!=k)
{
if(i!=... |
C | /* ptrptr5.c */
#include <stdio.h>
#include <stdlib.h>
int main(void) {
char *text[500];
char str1[] = "Text1";
char str2[] = "Text2";
char str3[] = "Text3";
text[0] = str1;
text[1] = str2;
text[2] = str3;
printf("%s %s %s\n", text[0], text[1], text[2]);
return EXIT_SUCCESS;
}
|
C | /* SCCS Id: @(#)cvtsnd.c 3.1 93/1/28 */
/* Copyright (c) 1993 by Gregg Wonderly */
/* NetHack may be freely redistributed. See license for details. */
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <exec/types.h>
void process_snd( char *, char * );
char *basename( char * );
... |
C | // stb_connected_components - v0.95 - public domain connected components on grids
// http://github.com/nothings/stb
//
// Finds connected components on 2D grids for testing reachability between
// two points, with fast updates when changing reachability (e.g. on one machi... |
C | #include <stdio.h>
int main( ) {
long long int nC, n, k, i, j, aux;
j = 0;
scanf( "%lli", &nC );
while ( nC-- ) {
scanf( "%lli %lli", &n, &k );
for ( i = 0; i < n; i++ ) {
aux = i * k;
while ( aux > n ) {
aux = ( (k * (aux-n) - 1)/(k-1) );
}
printf( "Case %l... |
C | #include <stdio.h>
void print_intarray(int integers[], int nelems)
{
int i;
for (i = 0; i < nelems; ++i) {
printf("%i ", integers[i]);
}
printf("\n");
}
int main(void)
{
int x;
int x_1[1];
const int arraymax = 10;
int myarray1[arraymax]; // Explicit definition/sizing of array... |
C | #include<stdio.h>
#include <unistd.h>
void printstatus ();
int
main ()
{
int count = 0;
printf ("Will load in 10 Sec \nLoading ");
for (count; count < 10; ++count)
{
printf (". ");
fflush (stdout);
sleep (1);
}
printf ("\nDone\n");
printstatus ();
return 0;
}
void
printstatus ()... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<arpa/inet.h>
#include<netinet/in.h>
#include<unistd.h>
typedef struct frame
{
int seq_no;
int ack;
char data[1024];
}Frame;
int main(int argc,char *argv[])
{
char buffer[1024];
int oldsocket;
oldsock... |
C |
#include <stdio.h>
int main()
{
float tenValue = 2 * 3 + 4;
float twelveValue = 2 * 2.5 + 2 * 3.5 ;
printf("The value of ten is: %f\n", tenValue);
printf("The value of twelve is: %f\n", twelveValue);
return 0;
}
|
C | #include <stdio.h>
int main(int argc, const char* argv[]) {
int input = 1;
printBi(input);
//USER INPUT
int userIn = 1;
while (userIn >= 0) {
printf("\nPlease input an integer value: ,to end enter a value x<0\n");
scanf("%d", &userIn);
printBi(userIn);
}
//END USER INPUT
return 0;
}
int printBi(int number... |
C | /*
* scheduler_like.c
*
* Created: 01/04/2019 06:04:13 AM
* Author: Hussam Elsayed Kh
*/
#include "scheduler_like.h"
static unsigned char password[]="295050";
volatile unsigned char pass[6];
void
proj_init(void)
{
adc_init();
LCD_Init();
keypad_init();
SET_BIT(DDRA,4); //set pin 4 as o/p f... |
C | #include <stdio.h>
#include <string.h>
#include <unistd.h>
int argument_valid(int argc, char *argv[], char *ip, char *port)
{
int opt = 0;
if(ip == NULL)
{
return 2;
}
while((opt = getopt(argc, argv, "i:p")) != -1)
{
switch (opt)
{
case 'i':
strncpy(ip, argv[... |
C | #include "sort.h"
/**
* quick_sort - sorts an array of integers in ascending order using
* the quick sort algorithm
* @array: Array to sort
* @size: Size of the array
*/
void quick_sort(int *array, size_t size)
{
if (!array || size < 2)
return;
lomuto_sort(array, size, 0, size - 1);
}
/**
* lom... |
C | #include "holberton.h"
/**
* puts_half - print every 2 char
* @str: string
* Return: Always 0.
*/
void puts_half(char *str)
{
int i;
int count;
int start;
for (i = 0; str[i] != '\0'; i++)
count++;
start = (count + 1) / 2;
for (i = start; i <= count - 1; i++)
_putchar (str[i]);
_putchar ('\n');
}
|
C | #include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "packarch.h"
#define LARGOCAR 8
typedef struct lz77{
size_t match;
size_t tammem;
size_t taminsp;
char* memoria;
char* inspeccion;
} lz77;
size_t debinarise (size_t num) {
return (n... |
C | #ifndef __PILA_H__
#define __PILA_H__
#if !defined(NULL)
#define NULL 0
#endif
#if !defined(FALSE)
#define FALSE 0
#endif
#if !defined(TRUE)
#define TRUE 1
#endif
/*#include "cmemdbg.h"*/
typedef struct TNodoPila
{
void* Elem;
struct TNodoPila *Siguiente;
} TNodoPila;
typedef struct
{
TNodoPila... |
C | #include <assert.h>
#include <stdlib.h>
#ifdef NDEBUG
#error This test program must work with macro "ASSERT" enabled!
#endif
#include "list.h"
int testobj_refcnt = 0;
typedef struct testobj_t
{
int value;
} testobj_t;
testobj_t* testobj_create(int value)
{
++testobj_refcnt;
testobj_t *obj = malloc... |
C | /** Módulo estándar de Input y Output */
#include <stdio.h>
/** Módulo estándar de números enteros */
#include <stdint.h>
/** Módulo estándar de valores booleanos */
#include <stdbool.h>
// Archivo de listas ligadas
#include "linked_list.c"
char** str_split(char* a_str, const char a_delim)
{
char** result = 0;
... |
C | #include <unistd.h>
main()
{
truncate("file1.txt", 10);
truncate("file2.txt", 10);
}
/* file1.txt -> short; file2.txt -> long file with lots of letters
$ cat file1.txt
$ cat file2.txt
$ ls -lG file*.txt
$ ./truncate
$ ls -lG file*.txt
$ cat file1.txt
$ cat file2.txt
*/ |
C | #include <stdio.h>
#include <stdlib.h>
void bye(void)
{
printf("1-- prepping\n");
exit(-9);
print("1-- That was all, folks\n");
}
void bye2(void)
{
printf("2-- prepping\n");
//exit(-9);
printf("2-- That was all, folks\n");
}
int
main(void)
{
long a;
int i;
printf("Sett... |
C | /*
** EPITECH PROJECT, 2018
** DANTE
** File description:
** algorithm file
*/
#include "solver.h"
cell_t *init_cell(int x, int y, int reachable)
{
cell_t *this = malloc(sizeof(*this));
if (this == NULL)
return (NULL);
this->x = x;
this->y = y;
this->reachable = reachable;
this->parent = NULL;
this->g = 0;... |
C | #include<stdio.h>
#include<string.h>
#define MAX 10000
int validate(char []);
int modulerDivision(char[],unsigned long);
int main(){
char dividend[MAX] = "141232537654685523542";
unsigned long int divisor,remainder;
printf("Enter dividend: ");
if(validate(dividend))
return 0;
printf("... |
C | /**
* @file calculadora.h
* @author Rodrigo Theodoro Rocha
* @date 25 April 2016
* @brief Arquivo contendo as funções para implementar o funcionamento da
* calculadora.
*/
#ifndef __CALCULADORA_H__
#define __CALCULADORA_H__
#include <stdio.h>
#include <stdlib.h>
#include "../include/pilha.h"
/**
* Aplica uma ... |
C | #define thisprog "xe-timeconv2"
#define TITLE_STRING thisprog" 1.Feb.2021 [JRH]"
#define MAXLINELEN 1000
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
/* define and include required (in this order!) for time functions */
#define __USE_XOPEN // required specifically for strptime()
#includ... |
C | #ifndef SERIAL_H
#define SERIAL_H
#include <types.h>
// NOTE: The following may not be true for all machines!
enum serial_port {
SER_NULL = 0x000,
SER_COM1 = 0x3F8,
SER_COM2 = 0x2F8,
SER_COM3 = 0x3E8,
SER_COM4 = 0x2E8
};
/**
* Initialize a serial port
*
* @param port The base IO address of th... |
C | void calculate_speed(float dy, float dx, float* s) {
*s = sqrt(dy*dy+dx*dx);
}
|
C | #include <stdio.h>
#include <string.h>
#define N 10000 // 最多可表示0-30999
int hash[N];
/**
* 获取所在数组下标
*
*/
int getNum(int n)
{
return n / 32;
}
/**
* 获取所在下标的bit位置
*
*/
int getLoc(int n)
{
return n % 32;
}
int main(void)
{
int i, n, data, offset, bit, num;
while (scanf("%d", &n) != EOF) {
memset(hash, 0, ... |
C | #include <nefko.h>
#include <ghetto.h>
#include <nefko_priv.h>
#include <string.h>
#include <stdint.h>
/* Extendable test for whether or not this is an NEF file. Eventually,
* this should also cover identifying whether or not this is a sub-
* variant of NEF that is supported by libnefko.
*/
static NEF_STATUS nef_i... |
C | /** @file vqtest.c
* @brief A very simple test suite for variable queues.
*
* @author Ryan Pearl <rpearl>
*/
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include "variable_queue.h"
typedef struct node {
Q_NEW_LINK(node) link;
int data;
} node_t;
Q_NEW_HEAD(list_t, node);
#define LIST_LEN 5
... |
C | #include "shell.h"
/**
* main - executes shell
* @argc: array
* @argv: pointer to array pointer
*
* Return: void
*/
int main(int argc[], char **argv[])
{
char cmd[100], command[100], *parameters[20];
/* enviroment variables */
char *envp[] = {(char *) "PATH=/bin", 0};
while (1) /* repeat forever */
{
pid_t pi... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <ok/ok.h>
#include <fs/fs.h>
#include <json.h>
#define EQ(a, b) (0 == strcmp(a, b))
int
main (void) {
const char *name = "test set";
const char *src = "{\"name\": \"bradley\"}";
json_value_t *obj = NULL;
json_value_t *tm... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "imc.h"
#include "imcparser.h"
long ip;
SymReg * hash[HASH_SIZE];
Instruction ** instructions;
void relop_to_op(int relop, char * op) {
switch(relop) {
case RELOP_EQ: strcpy(op, "eq"); return;
case RELOP_NE: strcpy(op, "ne")... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <omp.h>
#include <sys/time.h>
#define MIN_VALUE -9999999
double *array;
double *retorno;
int MAX_THREADS;
int N;
int main(int argc, char *argv[]){
double maxglobal;
double start, end;
long i;
//struct timeval inicio, final;
... |
C | #include <stdio.h>
#include <stdbool.h>
void digits(void);
void beaufortScale(void);
int gradeConvert(void);
int main(void)
{
// digits();
// beaufortScale();
gradeConvert();
}
void digits(void)
{
int number;
printf("Enter a number: ");
scanf("%d", &number);
if (number / 100 >= 1)
... |
C | #include <stdio.h>
void toLowerCase(char s[])
{
for( int i = 0 ; s[i] != '\0' ; ++i)
{
if(s[i]>='A'&&s[i]<='Z')
s[i]+=32;
}
}
int main()
{
char a[100];
scanf("%[^\n]%*c" , a);
toLowerCase(a);
printf("%s" , a);
} |
C | #include <stdio.h>
#include <stdlib.h>
#define SIZE 50
int vn[SIZE];
int queue[SIZE];
int v, e, i;
int front = -1;
int rear = -1;
struct graph
{
int vertex;
struct graph *next;
};
struct graph *a[SIZE];
void enqueue(int element)
{
if (rear == SIZE - 1)
{
printf("Queue full\n");
... |
C | #ifndef LINE_SENSOR_H
#define LINE_SENSOR_H
#define NUM_SENSORS 8
#define TIMEOUT 300
byte position;
byte lineCnt = 0;
byte sensorSum[256];
byte lineNum[256];
byte lineReading;
int steerTable[256];
void setupLine(){
steerTable[0] = 100;
for(byte sensorValue=1; sensorValue!=0; senso... |
C | int removeDuplicates(int* nums, int numsSize) {
if(numsSize == 0) return 0;
int temp = 1;
for(int i = 1; i < numsSize; i++) {
if(nums[i] != nums[i-1]) nums[temp++] = nums[i];
}
return temp;
} |
C | #include "types.h"
#include "system.h"
#include "buttons_interrupt.h"
/* Declare one global variable to capture the output of the buttons (SW0-SW3),
* when they are pressed.
*/
volatile int edge_capture;
#ifdef PUSH_BUTTONS_NAME
/*---------------------------------------------------------------------------... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
enum seatClasses{business, economy, standard};
enum priorities{veteran, diplomat,none};
typedef struct Passengers
{
char* name;
int wantedClass;
int soldClass;
int priority;
int sold;
}Passenger;
typedef struct Flights
{
char* name;
... |
C | #include<stdio.h>
int main(void)
{
char var,var2;
scanf("%c %c", &var,&var2);
printf("%c %c\n", var2,var);
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include "libcsv/csv.h"
#include <unistd.h>
#include <string.h>
#define CHUNK_SIZE 128
#define CSV_MODE_SET 0
#define CSV_MODE_GET 1
#define MAX_HEADERS 50
#define DEBUG 0
/**
* Usage:
* csvr [-s <set value>] <row> <col name/offset> [file.csv]
*
*/
struct parse_info {
in... |
C | #include <stdio.h>
#include <pthread.h>
int N = 1000000;
float worker_output;
float master_output;
int sign(int n)
{
if(n % 2 == 0)
return 1;
else
return -1;
}
void *worker(void *arg)
{
int i;
for(i = N / 2; i < N; i++)
worker_output += (float)sign(i) / (2*i + 1);
printf("worker_output = %.10f\n", work... |
C | //-----------------
// ??????
// Version 2.0
// ???
//-----------------
int main()
{
int i=0,j=0,blank=0,words=0,temp=0; //i,j??, blank?????????,words?????
char str[101];
cin.get(str,101,'\n'); //????
while(str[i]!='\0')
{
if(str[i]==' ')
{
if(str[i-1]!=' ')
word... |
C | #include "LPC17xx.h"
#include "math_utils.h"
uint32_t math_calc_diff(uint32_t value1, uint32_t value2) {
if (value1 == value2) {
return 0;
}
if (value1 > value2) {
return (value1 - value2);
}
else {
// check for overflow
return (UINT32_MAX - value2 + value1);
}
}
|
C |
#ifndef STACK_H
#define STACK_H
#include "objects.h"
FUNC Stack sk_new( MemoryLifetime ml ) ALWAYS_NEW;
FUNC int sk_depth ( Stack sk );
FUNC void sk_push ( Stack sk, Object ob );
FUNC Object sk_item ( Stack sk, int depth );
FUNC void sk_popN ( Stack sk, int count );
FUNC void sk_dupN ( Stack targe... |
C | #include "auto_header.h"
#include <fcntl.h>
#include <stdio.h>
static t_prot *find_prototypes(char *folder, char *name)
{
int fd;
char *path;
char *line;
t_prot *list;
t_prot *temporary;
list = (void *)0;
path = get_full_path(folder, name);
if (!(fd = ... |
C | #include "holberton.h"
#include <stdlib.h>
/**
* _calloc - Allocate memory for an array
* @nmemb: Element of array
* @size: Size of array in bytes
* Return: array
*/
void *_calloc(unsigned int nmemb, unsigned int size)
{
unsigned int count;
char *array;
if (nmemb == 0 || size == 0)
return ('\0');
ar... |
C | /* ECP: FILEname=fig4_1.c */
#include <stdio.h>
/* Return True Iff N Is Prime */
int
IsPrime( unsigned long int N )
{
unsigned long int Divisor;
if( N % 2 )
for( Divisor = 3; N % Divisor; Divisor += 2 )
if( Divisor * Divisor > N )
return 1;
... |
C | /*
*
* factory_manager.c
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <stddef.h>
#include <semaphore.h>
#include <sys/stat.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <string.h>
//Footprints
void tostring(char str[], int num);
int mai... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
// Bloque declarativo de variable
float f,C ;
//bloque de instrucciones
printf ("Ingresar los grados Fahrenheit:\n");
scanf ("%f",&f);
C = (f-32)/1.8 ;
printf ("Los Grados Celsius es: %f\n", C);
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <conio.h>
int main()
{
int i;
float a, b, c, x, y, d, s;
printf("This program will solve the quadratic equation in the form ax^2+bx+c.\n");
printf("\nEnter a value for a: ");
scanf("%f", &a);
printf("Enter a value for b: ");
scanf("%f", &b... |
C | #include<stdio.h>
struct tree
{
int data;
struct tree *right;
struct tree *left;
};
typedef struct tree tree;
tree *maketree(tree *root,int num)
{
if(root==NULL)
{
root=(tree*)malloc(sizeof(tree));
root->data=num;
root->right=root->left=NULL;
}
else if(num==root->d... |
C | /*
*Andrew Sullivan
*Montana State University
*Newton-Rapson method for solving PDE BVP in 2D as coupled system
*Procedure:
*Notes:
*precision - double
*/
#include "BVP_header.h"
int main(int argc, char *argv[])
{
int i,j,k,l, status;
//External Input
const int p = atoi(argv[1]); //Number of ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define N_CARDSET 1
#define N_CARD 52
#define N_DOLLAR 50//ó 50 ʱȭ Ǹ鼭 ٲϴ!
#define N_MAX_CARDNUM 13
#define N_MAX_USER 5
#define N_MAX_CARDHOLD 10
#define N_MAX_GO 17
#define N_MAX_BET 5
#define N_MIN_ENDCARD 30//迭 ũ⸦ ڷ ȣ
void printCard(... |
C | #include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<math.h>
#include<string.h>
/*
void bubblesort(int a[],int n)
{
for(int round=1;round<n;round++)
for(int i=0;i<n-round;i++)
{
if(a[i]>a[i+1])
{
int temp;
temp=a[i];
... |
C |
#include <stdio.h>
#include <stdlib.h>
#define WMAX 55
#define HMAX 55
#define W_BY_H_MAX 27
int W,H;
int *good[HMAX+1][WMAX+1];
int mine[HMAX][WMAX];
int neighbours[HMAX][WMAX];
int clicked[HMAX][WMAX];
int blankcount;
int blankfound;
int boardnum;
#define DBG_BRD 0
int min(int a, int b) { return a<b ? a : b... |
C | #include<stdio>
int main () {
int a;
int b;
printf("/saisie du premier nombre ");
scanf("%d,&a);
do{
printf("/nsaisie du second nombre:");
scanf("%d,&b);
} while (b==0);
printf("/n%d+%d=%d",a,b, a+b);
printf("/n%d-%d=%d",a,b,a-b);
printf("/n%d/%d=%f/n",a,b,(float)a/b);
return(0);
}
/////////////////////////////////////... |
C | #include "evaluator.h"
void printIds(ids* ids_){
int i;
for(i=0; i<ids_->size; i++){
printf("%s ", ids_->arg_[i]);
}
printf("\n");
}
void printValeurs(valeurs* valeurs_){
int i;
for(i=0; i<valeurs_->size; i++){
printf("%d ", valeurs_->v[i]);
}
printf("\n");
}
ids* args_to_ids(arg arg_){
arg p = arg_;
i... |
C | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#include "tokenizer.h"
// Prints all strings in the given svec.
void
print_tokens(svec* tokens)
{
for (int ii = 0; ii < tokens->size; ++ii) {
printf("%s\n", svec_get(tokens, ii));
}
}
// Returns true if the input is a speci... |
C | #include <stdio.h>
#include <stdint.h>
// Use the Computer struct, give values to the fields and print them out in the main!
// Use the Notebook struct, give values to the fields and print them out in the main!
struct Computer
{
float cpu_speed_GHz;
int ram_size_GB;
int bits;
};
typedef struct
{
floa... |
C | //利用数组计算斐波那契数列的前10个数,按每行5个的顺序打出
#include <stdio.h>
int main()
{
int i;
int fib[10]={1,1};
for (i = 2; i < 10; i++)
{
fib[i]=fib[i-2]+fib[i-1];
}
for (i = 0; i < 10; i++)
{
printf("%4d",fib[i]);
if ((i+1)%5 == 0)
{
printf("\n");
}
}
return 0;
} |
C | #include <stdio.h>
void Temperatures(double);
int main(void)
{
double fa;
printf("Please input the Temperature:");
while(scanf("%lf", &fa) == 1)
{
Temperatures(fa);
printf("Please input the Temperature(not number to quit):");
}
printf("End\n");
return ... |
C | #include <stdio.h>
main()
{
int n,i,key,m;
printf("Enter array size : ");
scanf("%d",&n);
int a[n];
printf("Enter %d elements : \n");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
printf("Enter which index : ");
scanf("%d",&m);
for(i=m;i<n;i++){
a[i]=a[i+1];
}
for(i=0;i... |
C |
void input(int arr[],int noElements){
int i;
for(i=0;i<noElements;i++){
scanf("%d",&arr[i]);
}
}
void output(int arr[],int noElements){
int i;
for(i=0;i<noElements;i++){
printf("%d ",arr[i]);
}
}
|
C | #include <stdio.h>
#include <sys/wait.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/msg.h>
#include <string.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include "header.h"
static int queue1;
static int queue2;
//inizializzazione code di servizio
void initservicequeues(){
queue1=msgget(IPC_PRIVATE,IPC_C... |
C | #include <stdio.h>
void area(int a,int b){
int area;
area=a*b;
printf("area=%d",area);
}
int main()
{
void area(int a ,int b );
int m,n;
printf("enter first side ");
scanf("%d",&m);
printf("enter second side");
scanf("%d",&n);
area(m,n);
}
|
C | #include <stdio.h>
int main()
{
int arr[100];
int n, i;
printf("Enter number of input:\n");
scanf("%d", &n);
printf("Enter elements in array:\n");
for(i=0; i<n; i++)
{
scanf("%d", &arr[i]);
}
printf("Array in reverse order:\n");
for(i=n-1; i>=0; i--)
{
printf(... |
C | #include <stdio.h>
#include <stdlib.h>
#include "queue.h"
#include "utils.h"
int qput(queue_t *qu, int x, int y) {
val_t v = {x, y};
qputv(qu, v);
}
int qputv(queue_t *qu, val_t v) {
node_t *node;
int pos = 1;
node_t *next = (node_t *) malloc(sizeof(node_t));
next->val = v;
mut_loc... |
C | #ifndef __STDINT_H
#define __STDINT_H
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef signed short int16_t;
typedef unsigned short uint16_t;
typedef signed long int int32_t;
typedef unsigned long int uint32_t;
typedef signed long long int int64_t;
typedef unsigned long long int ... |
C | /* ************************************************************************
* Filename: 18_test.c
* Description:
* Version: 1.0
* Created: 2017年09月13日 17时06分21秒
* Revision: none
* Compiler: gcc
* Author: YOUR NAME (),
* Company:
* *******************... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "common.h"
#include "solids.h"
/* PRIMITIVAS: */
#include "sphere.h"
#include "plane.h"
#include "poly.h"
#include "tile.h"
#include "cyl.h"
#define MAXCUTS 50
int pointInIntersection(point, void*);
int pointInUnion(point, void*);
... |
C | #include "syntax_tree.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/** newSynTreeNode_noname():
* create a syntax tree node without a name.
*
* @return a syntax tree node
*/
struct tree_node *newSynTreeNode_noname(void) {
struct tree_node *tmp = malloc(sizeof(struct tree_node));
tmp->child_... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ray1.c :+: :+: :+: ... |
C | #include "common.h"
double q3_sqrt(double num)
{
uint64_t i;
double x, y;
const double f = 1.5;
x = num * 0.5;
y = num;
i = *(uint64_t *) & y;
i = 0x5fe6ec85e7de30da - (i >> i);
y = *(double *)&i;
y = y * (f - (x * y * y));
y = y * (f - (x * y * y));
return num * y;
}
double fast_fabs(double num)
{
uint6... |
C | #include <stdio.h>
int main()
{
int width = 5;
int height = 8;
int area;
area = width * height;
printf("Area of %d x %d rectangle is %d",width,height,area);
return 0;
}
|
C | #include "function_term.h"
#include "utils.h"
#include "error.h"
#include "xfunction_termcap.h"
int my_outc(int c)
{
my_putchar(c);
return (0);
}
void my_bytecopy(const void *src, void *dest, int size)
{
const char *src2;
char *dest2;
int i;
src2 = src;
dest2 = dest;
i = size;
if (src2 < d... |
C | #include <stdio.h>
#define MAX(a, b) (a > b) ? a : b
int main(){
int x, y, max;
printf("input two numbers: ");
scanf("%d %d", &x, &y);
max = MAX(x, y);
printf("max = %d\n", max);
return 0;
}
|
C | #include<stdio.h>
#include<stdlib.h>
#define maxsize 12
#define true 1
#define false 0
typedef struct ArcNode
{
struct ArcNode* nextarc;
int adjvex;
// int weight;
}ArcNode;
typedef struct VNode
{
ArcNode* firstarc;
int data;
}VNode;
typedef struct AGraph
{
VNode adjlist[maxsize];
int n,e;
}A... |
C | #include<stdio.h>
#include<stdlib.h>
void input(int l[50],int h[50],int n);
#function to get the input values for the program
void print(int matrix[50][50],int n);
#function to print the matrix elements
void init(int matrix[50][50],int n);
#function to initialise the matrix
int check(int matrix[50][50],int i,int j,... |
C | #include "../inc/query_record.h"
#include "../inc/query_hashtable.h"
#include <stdio.h>
#include <string.h>
#include <openssl/md5.h>
int init_space_record(void *s, unsigned long size, space_t *space, unsigned int arg)
{
record_t *p = (record_t *)(s+sizeof(space_t));
space->first_record = p;
char *q = (char *)((cha... |
C | #include <stdio.h>
void main(){
/* Here, you must write the source code */
char name [80];
int age;
float weight;
printf("Please, entry your name: ");
scanf("%s", name);
printf("Please, entry your age: ");
scanf("%d", &age);
printf("Please, entry your weight in kilograms: ");
scanf("%f", &weight);
printf("... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.