language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include "random_task_generator.h"
#include <time.h>
#include <stdlib.h>
#include <stdio.h>
void print_pta_json(periodic_task_attr p[], unsigned int size)
{
unsigned int i;
printf("{\n");
printf("\t\"tasks\" : {\n");
for (i=0; i<size; ++i) {
printf("\t\t\"thread%d\" : {\n", i);
printf("\t\t\t... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include "backend.h"
int max(int a, int b) {
if (a < b)
return b;
return a;
}
void *calcMax(void *pt) {
int i, j, qt_threads;
int k, m;
data *dados;
dados = (data*)pt;
qt_threads = dados->qt_threads;
for (i = 0; i < dados->m; i++) {
// if --> ... |
C | /**
* \file entity.c
* \brief The elementary things (moves, direction, collision, ...)
* \author EZ-Type group: Thomas DELPY, Aymeric FAVARD, David CECCARELLI, Florent SALOU
* \version Final
* \date January 2018
**/
#ifndef ENTITY_H
#define ENTITY_H
#include "entity.h"
#endif
#include <stdio.h>
#include "../GfxL... |
C | #include "pathFinder.h"
static void mx_add_pair(int *matrix, char **islands, char *line);
int *mx_get_matrix(char **islands, char *text_of_file) {
int count_islands = mx_arr_size(islands);
int len = sizeof(int *) * count_islands + sizeof(int) * count_islands * count_islands;
int *matrix = malloc(len);
... |
C | /****************************************************************************************
* GraphTest.c
* Testing file using Graph ADT
* Pierson Bian
* CSE101 Spring 2020
* PA3
*****************************************************************************************/
#include <stdio.h>
#include <stdlib.h>
... |
C | #include<stdio.h>
const int Length=10000;
int main(){
char str[Length];
int a[Length];
for(int i=0;i<Length;i++){
a[i]=0;
str[i]='0';
}
fgets(str,Length,stdin);
for(int i=0,j=0;str[i]!='\0';i++){
if(str[i]==' '||str[i+1]=='\0'){
j++;
}else{
a[j]=a[j]*10+(str[i]-'0');
}
}
... |
C | #include "libmx.h"
char *mx_strndup(const char *s1, size_t n) {
char *duplic = NULL;
size_t length = mx_strlen(s1);
if(n < length)
length = n;
duplic = mx_strnew(length);
mx_strncpy(duplic, s1, length);
return duplic;
}
|
C | #include "mygl.h"
Color ColorWhite = {.red = 255, .green = 255, .blue = 255, .alpha = 255};
Color ColorRed = {.red = 255, .green = 0, .blue = 0, .alpha = 255};
Color ColorGreen = {.red = 0, .green = 255, .blue = 0, .alpha = 255};
Color ColorBlue = {.red = 0, .green = 0, .blue = 255, .alpha = 255};
Color ColorRandom = ... |
C | #include<stdio.h>
int main()
{
//here i'am going to declare three variables
int angle1,angle2,angle3;
printf("Enter the known two angles:\n");
scanf("%d,%d", &angle1,&angle2);
//and we know that sum of three angle is 180
angle3 = 180- angle1- angle2;
printf("Third angle is %d\n", angle... |
C | #include <stdio.h>
#include <stdlib.h>
/* HOLA.C es un programa C.
Imprime un mensaje en la pantalla del ordenador */
int main(void)
{
printf("Bienvenidos a Laboratorio de programacion.\n");
system("pause");
return 0;
}
// COMENTARIOS: Todas estas lineas son tambien comentarios.
//
// Todo programa ... |
C | /*
* @Author: mhc
* @Date: 2018-07-06 00:13:28
* @Last Modified by: mhc
* @Last Modified time: 2018-07-09 11:32:44
*/
#include <stdio.h>
int main()
{
int a[] = {3, 2, 4, 1}, i, j, s, isSorted, num, len, m = 0;
len = sizeof(a) / sizeof(a[0]);
for (j = 0; j < len - 1; j++)
{
printf("%d\n"... |
C | /*
* Show numbers from 1 to 100, 5 for each tread
*/
#include <stdio.h>
#include <omp.h>
#define N 99
int main(argc,argv)
int argc;
char *argv[];
{
int tid,i;
int a[N];
omp_set_num_threads(4);
#pragma omp parallel shared(a) private(i)
{
#pragma omp for
for(i = 0 ; i <= N ; i++)
a[i]=i;
#pragma omp f... |
C | #ifndef HEADER_GUARD__H
#define HEADER_GUARD__H
#include <stdio.h>
//the information of the node
typedef struct _Node{
long int node_id;
double latitude;
double longitude;
}Node_details;
//side table
typedef struct _Link{
long int linkid;
Node_details nodelater; //ñӵһϢ
double distance;
struct _Link* n... |
C | /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
* (C) 2010 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#include "mpitest.h"
/* tests send/recv of a message > 2GB. count=270M, type=long long
run with ... |
C | #define _GNU_SOURCE
#include <xcb/xcb.h>
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include "UniversalTypes.h"
#include "InjectedLibrary.h"
typedef xcb_generic_event_t* (*xcb_poll_for_event_t)(xcb_connection_t* c);
int xcbApplicationIsReady = 0;
xcb_generic_event_t* preInitLoop(xcb_poll_for_event_t f, ... |
C | //
// main.c
// FizzBuzzLight-year
//
// Created by Andrea Belcore on 23/03/21.
//
// Regular fizzbuzz with an extra word.
#include <stdio.h>
#define FIZZ 3
#define BUZZ 5
#define LIGHTYEAR 9460730472580800
int main(void)
{
unsigned long long i;
for(i=1; i<=LIGHTYEAR*5; ++i)
{
if (i % FIZZ == ... |
C | /***********************************************************************
Filename : disk-benchmark.c
Description :
A tool to test and benchmark storage (SAN, SCSI, NAS, Local, SSDs)
Build :
# gcc disk-benchmark.c -o disk-benchmark -l pthread -O3 -Wall
Author:
Michael Mountrakis mike.mountrakis... |
C | /*
NAME: Saad Mushtaq
COMP 3430 Operating System
Assignment 1 Q1
*/
// reminder - compile with -lpthread
#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <stdlib.h>
#define ROWS 4
#define COLS 5
#define COLS_IN_RESULTANT_MATRIX 2
// *******************Data Structure***************************
t... |
C | /*
** EPITECH PROJECT, 2018
** 42sh
** File description:
** cursor
*/
#include "my.h"
#include "shell.h"
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
static bool match_sequence(void *ctx, void *elem, size_t idx)
{
(void)(idx);
return lstr_equals(ctx, elem);
}
static bool prefix_sequence(void *... |
C | /* Alumno: Irving Efren Garcia Ramos */
/* E-mail: irvin.16@outlook.es */
/* Fecha de Creación: 14/05/2018 */
/* Fecha de actualización: */
/* Descripción: Programa que imprima
un menu */
#include <stdio.h>
#include <ctype.h>
enum _MENU{Ingresar=1,Mostrar,Actualizar,El... |
C | #include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
#include <string.h>
int main(int argc, char *argv[]) {
char *dirn = malloc(100);
if(argc <= 1) {
printf("Enter directory to search for: ");
fgets(dirn, 100, stdin);
dirn[strlen(dir... |
C | /*programme : Location.c
auteur: Mathis FRIZOT Bernardo PEREIRA AUGUSTO
date : 16/09/2016
finalité: Gestion des différentes prestations d'un complexe hôtelier
*/
#include<stdio.h>
#include"location.h"
/* Nom : Location de la salle
Finalité : Affiche le montant de la prestation
Variables :
catS caractère lu au clavier... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int vetor[10] = {5, 3, 7, 9, 1, 2,6,4,8,10};
int suporte;
for (int cont = 0; cont < 10; ++cont){
for (int cont2 = x+1; cont2 < x; ++cont2){
if (vetor[cont] > vetor[cont2]){
suporte = vetor[cont];
vetor[con... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
int main(void)
{
char buffer[128];
if(gethostname(buffer, 128) == -1)
{
printf("error: %s\n", strerror(errno));
}
else
{
pr... |
C | int hxstat(const char *pathname, int gid, int mode)
{
if(mode==32)
{
HOOK(o_xstat, C__XSTAT);
struct stat s_fstat;
memset(&s_fstat, 0, sizeof(stat));
o_xstat(_STAT_VER, pathname, &s_fstat);
if(s_fstat.st_gid==gid) return 1;
}else if(mode==64){
HOOK(o_xstat64, ... |
C | #include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdlib.h>
#include <unistd.h>
#include <arpa/inet.h>
int main(int argc, char const *argv[]){
int sock, client_socket;
char buffer[1024];
char response[18384];
struct sockaddr_in server_add... |
C | #include <stdio.h>
#include <math.h>
int main()
{
double pi = acos(-1);
// printf("pi = %.25lf\n",pi);
printf("pi online = 3.14159265358979323846264338327950288419\n");
printf("pi in c = %.20lf",M_PI);
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include "parity.h"
#include "resource_detector.h"
int calculateParity(__uint8_t toEncode)
{
int ones = 0;
for(int i = 0; i < toEncode; i++)
{
if(toEncode >7)
{
ones++;
toEncode = toEncode -8;
}
if(toEncode >3)
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
#include <SDL/SDL_mixer.h>
#include <SDL/SDL_ttf.h>
#include "bounding.h"
/*(0-pas de collision 1 collision)*/
int Collision_Bounding_Box (SDL_Rect rec1 ,SDL_Rect position_obstacle,int d)
{
int colli =1 ;
struct rect_collision... |
C | #ifndef _HASHTABLE_H
#define _HASHTABLE_H
#include <stdbool.h>
typedef struct {
unsigned int key;
void *value;
void *next;
} hashtable_entry_t;
typedef struct {
unsigned int (*hash)(const void *);
hashtable_entry_t **buckets;
size_t bucket_count;
} hashtable_t;
hashtable_t *create_hashtable(size_t buckets, un... |
C | #ifndef STACK_H
#define STACK_H
#include "list.h"
typedef struct {
List* list;
} Stack;
void stack_new(Stack* s, int elementSize, freeFunction freeFn);
void stack_destroy(Stack* s);
void stack_push(Stack* s, void* element);
void stack_pop(Stack* s, void* element);
void stack_peek(Stack* s, void* element);
int stack_... |
C | #include <stdio.h>
#include <stdlib.h>
/* funciones: bloque de codigo modularizado que se usa con una funcion prefijada.
ventajas del uso de funciones: Mantenimiento mas rapido. Mas facil de debugear.
divisin de las tareas. reutilizacin de codigo.
Problema: sumar dos numeros y mostrar resultado.
... |
C | #include<stdio.h>
#include<math.h>
int main()
{
long long int n,i,sum,a,w,p,q;
scanf("%lld",&p);
for(q=0;q<p;q++)
{
sum=1;
scanf("%lld",&n);
if(n==1)
{
printf("0\n");
printf("No\n");
continue;
}
else
{
w=sqrt(n);
for(i=2;i<=w;i++)
{ if(n%i==0)
{
a=n/i;
su... |
C | //Author: Manoja Putta
//** Email: manoja@uab.edu
//** Date: Febraury 3, 2021
//Course Section : CS 632
//Homework # :
//Instructions to compile the program : (for example: gcc -std=c99 O3 game gameoflife.c)
//Instructions to run the program : (for example: ./game 1000 1000)
#include<stdio.h>
#include <stdlib.h>
#i... |
C |
#include <stddef.h>
#include "FE-CLib-master/include/gbafe.h"
extern u8* SupplyUsabilityTable[];
extern u8 SupplyUsabilityPhantomIDLink;
extern struct Unit* gActiveUnit;
// Returns a boolean for whether the current chapter should make units drop items or send them to the supply.
// Autohook to 0x0803161C.
u8 HasConv... |
C | #include "core.h"
#include "corridor.h"
#include "debug.h"
#include "dungeon.h"
#include "room.h"
static int initBorder()
{
int r, c;
// initialize immutable borders
for (r=0;r<DUNG_H;r++)
{
tmap[r][0] = ROCK;
tmap[r][DUNG_W-1] = ROCK;
hmap[r][0] = IMMUTABLE;
hmap[r][DUNG_W-1] = IMMUTABLE;
}
for (c=... |
C | /*
Write a function that receives 5 integers and returns the sum,
average, and standard deviation of these numbers.
call this function from main() and print the results in main().
Apporach:
A subfunction sumAvgStd is used to find the sum,average
and standard deviation of 5 numbers
*/
#includ... |
C | #include <stdio.h>
int main()
{
long double ld;
printf("sizeof long double = %ld\n", sizeof(ld));
printf("sizeof char = %ld\n", sizeof(char));
printf("sizeof long = %ld\n", sizeof(long));
printf("sizeof double = %ld\n", sizeof(double));
printf("sizeof float = %ld\n", sizeof(float));
printf("sizeof char * = %ld\... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
typedef unsigned int uint;
/*
三角形面积
给你三个点,表示一个三角形的三个顶点,现你的任务是求出该三角形的面积
输入 每行是一组测试数据,
有6个整数x1,y1,x2,y2,x3,y3分别表示三个点的横纵坐标。
(坐标值都在0到10000之间)输入0 0 0 0 0 0表示输入结束。
测试数据不超过10000组
输出 输出这三个点所代表的三角形的面积,
结果精确到小数点后1位(即使是整数也要输出一位小数位)
*/
/*
Note:
... |
C | #include <stdio.h>
#
#define MaxSize 10000
typedef struct
{
int r[MaxSize+1];
int length;
/* data */
}Sqlist;
void swap(Sqlist *L, int i, int j)
{
int temp = L->r[i];
L->r[i]=L->r[j];
L->r[j]=temp;
}
void print(Sqlist L)
{
int i;
for(i=1; i<L.length; i++)
printf("%d,", L.r[i]... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <limits.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/wait.h>
#define ROW_LENGTH 1024
typedef struct{
long type;
char row[ROW_LENGTH];
char exit;
} msg;
void reader(int* pipefd, char* path){
char buffer[ROW_LEN... |
C | //*****************************************************
//** **
//** By: Christian Seepold, **
//** Thema: Potenzberechnung mit Laufzeiten **
//** Version 1.0 **
//** Datum: 05.11.2018 ... |
C | /// @brief 'time' manipulation helper functions
#include "time.h"
#include <stdio.h>
#include <string.h>
void split_time(struct tm* tm, time_sec_t time_sec, bool local)
{
// 'time_t' contains seconds since '1970.01.01 00:00:00'
time_t time = time_sec;
if (!((local) ? localtime_r : gmtime_r)(&time, tm))
{
... |
C | /* Función sobre el movimiento gráfico en el tablero de las piezas. Se pone parte de la función tablero.c como ejemplo de cómo funcionará la función Movimiento_grafico_pieza*/
/* Iniciando piezas */
tablero[0][0] = 't';
tablero[0][1] = 'c';
tablero[0][2] = 'a';
tablero[0][3] = 'd';
tablero[0][4] = 'r';
tab... |
C | #include "common.h"
void main()
{
/*test for Q1*/
chessPosArray*** test = validKnightMoves();
printf("%d\n", test[0][0]->size);
printf("%c ", test[0][0]->positions[0][0]);
printf("%c", test[0][0]->positions[0][1]);
printf("\n");
printf("%c ", test[0][0]->positions[1][0]);
printf("%c", test[0][0]->positions[1][... |
C | /*
* main.c
*
* Created on: 22 нояб. 2013 г.
* Author: ALTAIR
*/
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
int compare(const void *a, const void *b) {
return rand()%100 - 50;
}
int main() {
srand(time(0));
int n;
scanf("%d", &n);
int i;
int *data = (int*) calloc(n, sizeof(int));
for(... |
C | /**
* \file IODriver.h
* \brief A file enabling the IO functionality for the buttons on the IO card.
*/
#include "DEFINITIONS.h"
/**
* \brief A function initializing the IO functionality.
* Setting the correct ports as inputs for the buttons on the joystick and the
* touch buttons on the card.
*/
IO_init();
/*... |
C | /*
Write a recursive program which accept number from user and return its
reverse number.
Input : 523
Output : 325
*/
#include<stdio.h>
int ReverseNumber(int iNo)
{
static int iDigit=0;
static int iRev = 0;
if(iNo < 0)
{
iNo = -iNo;
}
if(iNo != 0)
{
iDigit = iNo % 10;
iRev = (iR... |
C | /*******************************************************************************
Written by Anat Wax
March 16-19, 2020
Reviewer: Yoni Naor
*******************************************************************************/
#include <stdlib.h> /* malloc(), free() */
#include <assert.h> /* a... |
C |
#ifndef __UTILS_H__
#define __UTILS_H__
/*- INCLUDES -----------------------------------------------*/
#include "types.h"
#include <math.h>
/******************************************************************************
* FUNCTION-LIKE MACROS *
****************... |
C | #include <stdio.h>
#include "../src/util/Numeric.h"
#include "Test.h"
void test_is_integer();
void test_is_digit();
void test_from_str();
void test_to_str();
int main()
{
test_is_integer();
test_is_digit();
test_from_str();
test_to_str();
}
void test_is_integer()
{
const int n = 20;
init_test_suite(n, "Int... |
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 | /* bfs.h -
* Header file for implementation of Breadth First Search (BFS) on a
* graph.
*/
/* Introduction:
Breadth-first search is a search algorithm used in graphs, where given a
starting node, all the neighboring nodes are explored before other nodes are
explored.
*/
#include <stdlib.h>
#include <stdio.h>
#i... |
C | //**************************************
// FILE : wx_utf8_tel.c
// AUTHOR(S): Pulkit Goyal & Sapan Diwakar
// PART OF : Convertor
// CREATED : 15th June, 2009
//
// MODIFIED LAST : 15th June, 2009
//***************************************
/*
* This converter converts telugu text from wx to utf. The main functi... |
C | #include "test3.h"
/*A partir d'un fichier*/
int verification_lien(char *link, char *type){
int verif = 0;
regex_t lien;
char buffer[100];
if (*type == 'A' || *type == 'a'){
regcomp(&lien, "[A-Za-z]*.film$", REG_EXTENDED|REG_NOSUB);
verif = regexec(&lien, link, 0,0,0);
regfre... |
C | #include <stdio.h>
/*
Ʈ . û.
( ̸, Ʈ )
FILE * fp = fopen("data.txt", "wt");
: " data.txt stream ϵ, wt stream ϶!"
wt: Write ( Ʈ) , Text (text )
wt , ü ˾Ƽ , ̸ data .
Ӱ ٰ ϸ !!
FILE * fp = fopen("data.txt", "rt");
: " data.txt stream ϵ, rt stream ϶!"
rt: Read (б Ʈ) , Text (Text )
*/
// .
int mai... |
C | /**
* @file PID.h
* @author İsmail Enes Bilgin (bilginenesismail.gmail.com)
* @brief
* @version 0.1
* @date 2021-05-27
*
* @copyright Copyright (c) 2021
*
*/
#ifndef __PID_H_
#define __PID_H_
#include "stdint.h"
typedef enum{
PID_OK = 0U,
PID_ERROR = 1U,
}PID_Status_t;
typedef enum{
P... |
C | #include <stdlib.h>
#include <stdio.h>
#include <sys/queue.h>
/* struct slist_head declaration */
SLIST_HEAD(slist_head, char_node);
struct char_node {
SLIST_ENTRY(char_node) node;
char data;
};
#define CHAR_NODE_FMT "%c(%d)"
int main(void)
{
struct char_node node_a = { .data = 'a' };
struct char_node node_b =... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.h :+: :+: :+: ... |
C | #include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <stdbool.h>
void printFlag(const char *name, bool on)
{
if (on) {
printf("* %s - ON\n", name);
} else {
printf("* %s - OFF\n", name);
}
}
int main(int argc, char ** argv)
{
int fd;
int result;
int accessFlags;
... |
C | #ifndef _HASH_H_
#define _HASH_H_
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "list.h"
#include "tlv.h"
#define HASH_SEED 0XFEEDBEEFU
typedef struct _hash_bucket_t {
uint32_t num;
list_table_t list;
} hash_bucket_t;
typedef struct _hash_table_t {
char *na... |
C | /* Copyright 2019 IBM Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writi... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* atoi_base_main.c :+: :+: :+: ... |
C | /**
* Nombre: Jesús Parejo Aliaga
* Curso: 2º Ingeniería de Software Cs
* DNI: 51183891J
*_________________________________________________________________________________
* UNIX Shell Project
*
* Sistemas Operativos
* Grados I. Informatica, Computadores & Software
* Dept. Arquitectura de Computadore... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* read_file.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<stdlib.h>
int a[10], pos, elem;
int n = 0;
void create();
void display();
void insert();
void del();
void search();
void main()
{
int choice;
while(1)
{
printf("\n\n~~~~MENU~~~~");
printf("\n=>1. Create an array of N inte... |
C | #include <stdio.h>
#include <stdlib.h>
#include "matrix.h"
void printMatrixRow(int *, int);
void insertionSort(int array[], int length);
int main(void) {
int **matrix, matrixRows, matrixColumns, *sumOfMatrixColumns;
// Enter matrix rows
scanf("%d", &matrixRows);
// Enter matrix columns
scanf("%d", &matrixColumn... |
C | /*
* Mitchell Tasman
* December 1987
* Modified by Marvin Solomon, October 1989.
* Program totroll.c
*
* Testing program to test the "troll" (q.v.)
* Sends messages via the troll to a another process
* The other process is supposed to be fromtroll.c,
* which just prints what it gets.
*/
#ifndef lint
static c... |
C | #include <stdio.h>
/* Types used in the lexer */
typedef enum {
TOKEN_VAL,
TOKEN_OP,
TOKEN_EOF
} TOKEN;
typedef enum {
OPERATION_ADD,
OPERATION_SUB,
} OPERATION;
typedef struct {
TOKEN type;
union {
int value;
OPERATION operation;
} dat;
} token;
/* Types used in the RPN evaluator */
typed... |
C | #include <stdio.h>
int main ()
{
char a = getchar () ;
printf(" u entered") ;
putchar (a) ;
return 0 ;
}
|
C | #include "CatProdutos.h"
#include "CatClientes.h"
#include "Facturacao.h"
#include "Filial.h"
#define NUMFILIAIS 3 //numero de filiais deste programa
#define BUFFER 20 //definicao de um buffer para ler produtos e clientes
#define BUFFERVENDAS 50 //definicao de um buffer para ler as linhas de vendas
#define... |
C | #include <stdio.h>
int main() {
int i=1, sum=0;
for(i;;i++) {
sum = sum+i;
if(i>100) {
printf("그럴리가 ㅋ\n");
break;
}
printf("무한루프입니다.");
printf(" x%d\n", i, sum);
}
return 0;
}
|
C | #include "pixel.h"
#include <SDL/SDL.h>
//these methods were heartlessly stolen from Lazy Foo Productions
Uint32 get_pixel32( SDL_Surface *surface, int x, int y )
{
//Convert the pixels to 32 bit
Uint32 *pixels = (Uint32 *)surface->pixels;
//Get the requested pixel
return pixels[ ( y * surface->... |
C | //
// BinarySearchDemo.c
// SortingAlgorithmDemo
//
// Created by apple on 2020/9/8.
// Copyright © 2020 APPLE. All rights reserved.
//
#include "BinarySearchDemo.h"
//顺序查找
int SequenceSearch(int a[], int value, int n)
{
int i;
for(i=0; i<n; i++)
if(a[i]==value)
return i;
return -... |
C | #define DEFAULT_STEP 5 // Step size for printing points.
/**
* for printing our matrix.
*/
#define prettyprint(x) do {fprintf(stdout, "%7.5g ", (x));} while(0)
/**
* Prints a given n x m matrix.
*/
void printmat(size_t n, size_t m, double A[][m])
{
size_t i, j;
for (i = 0; i < n; i++)
{
for (j... |
C | //1017 计算价格
/*问题描述
香蕉3元/斤,橘子2元/斤,葡萄8元/斤。买a斤香蕉、b斤橘子、c斤葡萄,问需要多少钱?
输入格式
输入包括三行,每行一个0至200的整数,分别表示a,b,c。
输出格式
输出所需要的钱数。
样例输入
1
2
3
样例输出
31
*/
/*
香蕉3元/斤
橘子2元/斤
葡萄8元/斤
买a斤香蕉、b斤橘子、c斤葡萄,问需要多少钱
*/
// score:100
#include "stdio.h"
int main(int argc, char const *argv[])
{
int f1 = 3, f2 = 2, f3 = 8;
int a, b, ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(){
int romolo = fork();
int remo;
if(romolo > 0){
printf("Ciao sono Marte, il mio pid e' %d\n\n", getpid());
remo = fork();
}
if(romolo == 0){
printf("Sono romolo il mio pid e': %d\nIl pid di mio padre e': %d\n\n", getpid(), getppid());
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* controller.c :+: :+: :+: ... |
C | #include <stdio.h>
int main() {
int a[20][20] = { 0 };
int num = 0, x = 0, y = 0;
int i, k, j;
int size, now = 1;
printf("ũ⸦ Էּ : ");
scanf("%d", &size);
for (j = 0; j < size / 2; j++) {
for (k = 0; k < size - 2 * num; k++) {
a[x][y++] = now++;
}
... |
C | #include <stdio.h>
#include <ctype.h>
#include <string.h>
void hexdump(FILE *file){// hexdump function
FILE *f=file;
int c;
long i=0;
int j=0;
int k=0;
char hex[16];
int array[16];
while ((c=fgetc(f))!=EOF) {// read a char from file until file ends
if(i%16==0){
printf... |
C | #include <ctype.h>
#include <dirent.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include "secretCoder.h"
#ifndef UTIL
#define UTIL "util.h"
#include UTIL
#endif
#ifndef QUEUE
#define QUEUE "queue.h"
#include QUEUE
#endif
#define DICTIONARY_PATH "/usr/share... |
C | #include<stdio.h>
int main(){
int num;
printf("Enter number : ");
scanf("%d", &num);
printf("Number is : %d", num);
if(num % 5 == 0){
printf(" Ed");
}
if(num % 3 == 0){
printf(" Pogi");
}
}
|
C | void mySort(int d[], unsigned int n)
{
int i = 0;
int j = 0;
int temp = 0;
/*Selection sorting algorithm*/
for (i = 0; i<n; i++)
{
for (j = i; j < n; j++)
{
if (d[i]>=d[j])
{
temp = d[i];
d[i] = d[j];
d[j] = temp;
}
}
}
return;
}
|
C | /* ACM 406 Prime Cuts
* mythnc
* 2011/10/20 15:50:21
* run time: 0.064
*/
#include <stdio.h>
#define MAXARY 200
#define N 1000
#define NOT_P 0
#define PRIME 1
int prime(int *);
int maxnumber(int *, int, int);
void output(int *, int, int);
int main(void)
{
int n, c, pnumber, ptotal;
int ary[MAXA... |
C | /*
** EPITECH PROJECT, 2018
** NAVY
** File description:
** main function
*/
#include "include/my.h"
struct variable_signal sig;
int player_two(int ac, char **av)
{
struct variable_boat bt;
struct variable_map mp;
char *str1;
char *str_tmp = "";
int i = 0;
if (ac == 3) {
check_good_fi... |
C | #include <stdio.h>
#include <signal.h>
#include <string.h>
#include "../../utils/utils.h"
extern char *arg;
void handler(int signo)
{
printf("interrupted by SIGNO %d\narg=%s", signo, arg);
if(!strcmp("dfl", arg))
if(signal(SIGINT, SIG_DFL)==SIG_ERR)
error("unable to set handler to default");
if(!strcmp("ign",... |
C | /*!
* @file Timer.c
*
* @author Marco Agnoli
* @copyright 2016 <Marco Agnoli>
*/
#include <Timer/Timer.h>
// Statische Definitionen --------------------------------
// Anzahl Überlaufe
static volatile u8 __nOverflows = 0;
// Gibt an ob Stoppuhr abgelaufen ist
static volatile u8 __bHasExpired = 1;
// Statische ... |
C | #include <stdlib.h>
#include "CoreRelUDP.c"
int main(void)
{
int sockfd = SocketPreparationAndBindUsingPort(5000);
struct sockaddr_in other;
SocketAddressFill(&other, "127.0.0.1", 8000);
int ch = 0;
int cnt = 0;
char message[4096];
while (1)
{
ch = 0;
ch = getchar();
if (ch == '\n' || cnt == 4096)
{
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* stk_builder.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <mpi.h>
#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
void adjacencyMatrixGen(int mat[], int n)
{
int i, j, tmp;
for (i = 0; i < n; i++) {
mat[i * n + i] = 0;
for (j = 0; j < i; j++) {
tmp = ((i + j) % 10 + 1);
mat... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strsplit.c :+: :+: :+: ... |
C | /**
* utility.c
*
* Principles of Programming Languages
* assignment 1
*
* AKHIL SHARMA, CO15306, CSE
*/
#include "utility.h"
/*find the sum of two numbers*/
int add(int a, int b){
return (a + b);
}
/*find the difference in two numbers*/
int subtract(int a, int b){
return (a - b);
}
/*find the product of t... |
C | #include <stdio.h>
/* копирование ввода на вывод с заменой символа табуляции на \t, символа забоя на \b и каждой обратной наклонной черты на \\ */
// Алгоритм
// Считываем символ
// Если равен символу табуляции, выводим \t
// Если равен символу забоя, выводим \b
// Если это \, выводим \\
// В остальных случаях в... |
C | // LR Parser
#define malloc malloc
#include <stdlib.h>
#include "lr_parser.h"
// memory tracker
#ifdef _MEM_TRACKING
int gTotalMemoryUsage = 0;
int gMallocCalls = 0;
int gFreeCalls = 0;
#ifdef malloc
#undef malloc
#endif
#ifdef free
#undef free
#endif
#ifdef ADDRESS_TRACKING
typedef struct MEM... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mylib.h"
#include "flexarray.h"
struct flexarrayrec {
int capacity;
int itemcount;
char **items;
};
static void quicksort(char **a, int len) {
int i = 0, j = 0, pivot = 0;
char *temp;
if (len < 2) {
re... |
C | #include<stdio.h>
#include<stdlib.h>
struct node {
int data;
struct node *left;
struct node *right;
};
void insert(struct node**root, int data)
{
struct node *temp = (struct node*)malloc(sizeof(struct node*));
temp->data=data;
temp->left=NULL;
temp->right=NULL;
struct node *ptr=NULL;
if(*root==NULL)
*root=... |
C | /* ṩ˳ʵֵ
˳㷨*/
#include<stdio.h>
#define TRUE 1
#define FALSE 0
#define MAXNUM 100
typedef int KeyType ;
typedef struct {
KeyType key; /* ֵԪصĹؼֶ */
/*DataType value; /* ֵԪصֶ */
} DicElement;
typedef struct {
int n; /* n<=MA... |
C | #include "config.h"
#include "cunit/cyrunit.h"
#include <sys/stat.h>
#include "xmalloc.h"
#include "prot.h"
#include "imap/global.h"
#include "xunlink.h"
#define PROLOG \
char *_fname = xstrdup("/tmp/cyrus-protXXXXXX"); \
int _fd = mkstemp(_fname)
#define BEGIN \
{ \
int r = ftruncate(_fd, 0); \
... |
C | #include <stdio.h>
/*
Ler um nmero e imprimir se este nmero ou no par.
*/
main(){
int num;
printf("Insira um nmero: \n");
scanf("%d",&num);
if(num%2==0){
printf("O nmero par");
}else{
printf("O numero mpar");
}
}
|
C | //
// Created by Administrator on 2016/4/1.
#include <stdio.h>
int main()
{
struct stu{
char *name;//4*2 = 8
short age;//4*2 =8
short height;//4*2 = 8
char *address;//4*6 24
} *p,students[2] = {
{"jack",100,190,"beijing"},
{"tom",500,200,"american"}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.