language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n, i, sum = 0, count = 0;
for(i = 0;; i++)
{
if(n==sum)
break;
}
cout<<count<<endl;
}
|
C | // sorter.h
// Module to spawn a separate thread to sort random arrays
// (permutations) on a background thread. It provides access to
// contents of the current (potentially partially sorted) array,
// and to the count of the total number of arrays sorted.
#ifndef _SORTER_H_
#define _SORTER_H_
#include <pthread.h... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int isPerfectSquare(int num)
{
int i;
int res=0;
for (i = 1; i <= 100; i++)
{
if (i * i == num)
{
res = i;
return res;
}
}
return res;
}
int main(void)
{
int i, sum = 0, min = 10001;
int n, m;
scanf("%d %d", &n, &m);
for (i = n; i <= m; i++)
... |
C | #include <stdio.h> // perror のために必要
#include <unistd.h> // execve のために必要
char *args[] = { "date", NULL };
char *envs[] = { "LC_TIME=ja_JP.UTF-8", "TZ=Cuba", NULL};
char *execpath="/bin/date";
int main(int argc, char *argv[], char *envp[]) {
execve(execpath, args, envs); // /bin/dateを上記の環境変数で実行
p... |
C | #include<stdio.h>
#include<math.h>
void main()
{
float xA,xB,yA,yB,a;
printf("Nhap cac canh toa do A B:");
scanf("%f%f%f%f",&xA,&yA,&xB,&yB);
a=(sqrt((xB-xA)*(xB-xA)+(yB-yA)*(yB-yA)));
printf("Do dai AB:%0.2f",a);
}
|
C | #include<stdio.h>
#include<unistd.h>
void print_msg(char *);
int main()
{
print_msg("hello ");
print_msg("world\n");
return 0;
}
void print_msg(char *m)
{
int i;
for ( i = 0 ; i < 5; i++ )
{
printf("%s", m);
fflush(stdout);
sleep(1);
}
}
|
C | #include <GL/glew.h> // include GLEW and new version of GL on Windows
#include <GLFW/glfw3.h> // GLFW helper library
#include <stdio.h>
int main() {
// start GL context and O/S window using the GLFW helper library
if (!glfwInit()) {
fprintf(stderr, "ERROR: could not start GLFW3\n");
return 1;
}
GLFWw... |
C | /*
Задача 10. Направете два триъгълника с отместване.
*/
#include <stdio.h>
struct point{
int m_x;
int m_y;
};
int main(){
struct point a={3,4};
struct point b={7,10};
char rect[15][15];
int k = 0;
for(int i=0;i<15;i++){
printf("\n");
for(int j=0;j<... |
C | #include <stdio.h>
#include "lab2.h"
int main() {
// Array of 10 doubles
const unsigned int size = 10;
double array[size];
// Array for copying original array for reciprocals
double arrayCopy[size];
printf("Creating an array of %i doubles.\n", size);
arrayInput(array, size);
printf("\nPrinting ou... |
C | /*
* view.c
* The view module use OpenGL to show the present status of a game.
* It uses the VBO indexing to powering the render. Only one mesh is generated
* during the module initialisation and used to draw all circles in the display
* function.
*
* created by Lana Abi Rached and Vianney Rousset.
*
* version... |
C | #include "bytecode_program.h"
bool instructions_equal(Instruction a, Instruction b, void* constants){
if(a.type!=b.type){
return false;
}
switch(a.type){
case b_end:
case b_discard:
case b_enter_scope:
case b_leave_scope:
case b_null:
case b_return:
... |
C | #include "Instructions.h"
#include "Functions.h"
void check_instructions(char **char_array_A, char **char_array_B, char **char_array_C, char **char_array_D, int line, char *key[])
{
char ch = 'a';
int arr_size = 0, plus_size, i, j;
int reg[17];
int *arr = malloc(arr_size * sizeof(int));
int** pointer = &arr;
COO... |
C | /**
* @file test_longto.c
* @author Egorov N.V. <egorov@rti-mints.ru>
* @date Tue Aug 24 16:00:00 2010
*
* @brief Тестирование функций преоброзования строк
*
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <config.h>
#ifndef USE_VSPRINTF
#define asstring(x) #x
static inline... |
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 | #include <stdio.h>
int sprintf(char * str, const char * fmt, ...)
{
int ret;
va_list ap;
va_start (ap, fmt);
ret = vsprintf(str, fmt, ap);
va_end (ap);
*(unsigned char*)(str + ret) = '\0'; /* terminate the string */
return ret;
}
|
C | /*
*
* Producer-Consumer Lab
*
* Copyright (c) 2019 Peter A. Dinda
*
*/
#ifndef _RING_H
#define _RING_H
#include <stdint.h>
// For performance, this should be a multiple of the cache line size
#define CACHE_ALIGN_SIZE 64
#define CACHE_ALIGN __attribute__((aligned(CACHE_ALIGN_SIZE)))
// structure definition ... |
C | #include "vmem_parser.h"
#include <string.h>
void free_mem_rgn(struct mem_rgn* mr){
free(mr->p_name);
if(mr->n_remaining > 0)free(mr->remaining_addr);
}
/*
* if which_rgn's int* res param is not NULL, it is set
* to one of three possible values:
* STACK, HEAP, or other
* if (res > HEAP) or (res >= 2)... |
C | #include <stdio.h>
#include <stdlib.h>
int list[7]={38,27,43,3,9,82,10};
int partition(int list[], int left, int right) {
int pivot, temp;
int low, high;
low=left;
high=right+1;
pivot=list[left];
do {
do{
low++;
}while(low<=right && list[low]<pivot);
do{
... |
C | #include <stdio.h>
#include <stdlib.h>
#include "Datos.h"
#include "ArrayList.h"
int main()
{
ArrayList* lista = al_newArrayList();
ArrayList* auxList = al_newArrayList();
eProducto* producto;
eProducto* auxProducto;
FILE* datos = generarBinario("datos.dat");
FILE* temporal = genera... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* init.c :+: :+: :+: ... |
C | #include <sys/ptrace.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <sys/user.h>
const int long_size = sizeof(long);
void getdata(pid_t child, long addr,
char *str, int len)
{ char *laddr;
int i, j;
union u {
long val;
char chars[long_size];
... |
C | #include "gpio.h"
#include "types.h"
#include <stdarg.h>
enum gpio_cmd {
GPIO_INPUT,
GPIO_SET,
GPIO_CLEAR,
GPIO_TOGGLE,
};
u64 SUNXI_PIO_BASE_MAPPED;
u64 SUNXI_R_PIO_BASE_MAPPED;
/**
* @deprecated Please use driver model instead
* Request a GPIO. This should be called before any of the other functions
* are... |
C | /*************************************************************************
* *
* Copyright c 1984 The board of trustees of the Leland Stanford *
* Junior University. All rights reserved. *
* This subroutine may not be used outside of the SUPREM4 computer *
* program w... |
C | #ifndef STACK_H_INCLUDED
#define STACK_H_INCLUDED
/*stack structure definition*/
struct stack
{
int stackPointer;
float items[];
};
/*An alias for the stack struct*/
typedef struct stack Stack; //"Stack" is an alias for the struct
/* operation: declares a pointer to a stack and allocates */
/* ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstnew.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define SIZE 1000
#define TRUE 1
#define FALSE 0
void init_array(int *pinakas, int n, int a, int b);
void copy_array(int *dest, int *src, int n);
void print_array(int *pinakas, int n);
void swap(int *a, int *b);
int bubble_sort(int *pinakas, int n);
int select... |
C | /*该程序测试SOCKET网络通信其中的服务器
*
*
*/
#include <arpa/inet.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <sys/types.h>
#include <string.h>
int main(int argc, char *argv[])
{
if(argc != 3){
printf("%s IP PORT. \n", argv[0... |
C | /*
** password.c for in /home/levuoj/rendu/pamela/src/password
**
** Made by Jouvel Anthony
** Login <anthony.jouvel@epitech.eu>
**
** Started on Tue Nov 21 18:42:37 2017 Jouvel Anthony
** Last update Sun Nov 26 17:30:29 2017 Jouvel Anthony
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <sys/types.h>
#include ... |
C |
#include <stdio.h>
#include "ww.h"
//step 1 declare sprites
#include "player_one.h"
#include "player_two.h"
#include "ball.h"
//adding this to allow location of player 2 and ball location
int screen_width = 1024;
int screen_height = 576;
int y_dir = -5;
int x_dir = -5;
int main( int argc, char * argv[] ) {
if(... |
C | #include <stdio.h>
int main()
{
int n,i,j,a[100],mini,max;
scanf("%d",&n);
for(j=0;j<n;j++)
{
for(i=0;i<5;i++)
{
scanf("%d ",&a[i]);
}
mini=a[0];
for(i=0;i<5;i++)
{
if(mini>a[i])
mini=a[i];
}
... |
C | /* $Id$ */
#ifndef HOOK_H
#define HOOK_H
#ifndef COMMON_CORE_H
# error You should include "common_core.h" first.
#endif
//#include <stdlib.h>
extern SB_DECLARE_DATA const char *current_hooking_module;
extern SB_DECLARE_DATA int debug_module_hooks;
// meta module exportϴ api hook 屸.
// member HOOK_LINK(...) .
#d... |
C |
/*
This is a very simple c compiler written by Prof. Jenq Kuen Lee,
Department of Computer Science, National Tsing-Hua Univ., Taiwan,
Fall 1995.
This is used in compiler class.
This file contains Symbol Table Handling.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "symbol_t... |
C | #include <stdio.h>
int main( ) {
typedef char Letter;
Letter ch;
ch = 'a';
printf("%c\n",ch);
Letter ch1;
ch1 = 'i';
printf("%c\n",ch1);
return 0;
} |
C | /* ==========================================================================
* mem.c - Tiny heap.
* --------------------------------------------------------------------------
* Copyright (c) 2009 William Ahern
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software an... |
C | #include <stdio.h>
#include <stdlib.h>
#include "libreria.h"
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int i,num,numMax,numMin,bandera=0,total=0;
for(i=0;i<20;i++){
do{
printf("Ingrese un numero,va el numero%d\n>",... |
C | /*
When I was a kid, and wanted to count the dollar bills in my life savings, I would count out loud:
one, two, three, four, five, six, seven, eight, nine, ten;
eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen, twenty;
twenty-one, twenty-two, twenty-three, twenty-four, twenty-five..... |
C | #include <sys/queue.h>
#include <stdio.h>
#include <stdlib.h>
typedef struct mydata__
{
int data;
LIST_ENTRY(mydata__) list;
} mydata;
LIST_HEAD(listhead, mydata__) head;
static mydata all_data[100];
int main(int argc, char *argv[])
{
LIST_INIT(&head);
int i;
for (i = 0; i < 10; i++) {
all_data[i].data... |
C | #include<stdio.h>
int main()
{
int num1,num2, count=0;
scanf("%d",&num2);
for(num1=2; num1<num2; num1++)
{
if(num2%num1==0)
{
count=1;
//break;
}
}
if(count==1)
{
printf("%d is not a prime number\... |
C | #include<stdio.h>
int main()
{
int var=1;
printf("Using postfix (var++) var = %d\n",var++);
printf("Value after increment is:%d\n\n\n",var);
var=1;
printf("Using prefix (++var) var = %d\n",++var);
printf("Value after increment is:%d\n",var);
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
void *xcalloc(int, int);
void print_usage(void);
void print_version(void);
#define STR_EQ 0
#define LONG_OPT 0
#define TRUE 1
#define FALSE 0
int main(int argc, char *argv[]){
int... |
C | #include "heap.h"
int findMin(Heap *h){
return h->contents[0];
}
Heap* buildHeap(int *arr){
Heap *h=(Heap*)malloc(sizeof(Heap));
h->contents=(int*)malloc(sizeof(int)*(sizeof(arr)/sizeof(arr[0])));
for(int j=sizeof(arr)/(sizeof(arr[0])*2); j>=0; j--){
minHeapify(h,h->last,j);
}
}
void HeapSort(int *arr){
Heap ... |
C | #include <stdio.h>
#include <stdlib.h>
#define MAX_NUMBER_CHAR 1000
int main (int argc, char *argv[])
{
FILE *fp = NULL;
char get_string[MAX_NUMBER_CHAR] = "";
int c =0;
int count =0;
fp = fopen("file_text/file_source.txt", "r+"); // "r+"" : it mean read and write into file. If "r" it is only read
// printf(... |
C | /* Written By: Nikesh Srivatava & Chris Anderson
* ---- Version Table ----
* |==============================================================|
* | Ver | Dates | Author | Comments |
* |=======|============|==========|==============================|
* | v0.1 | 2012.10.03 | Nikesh | Ori... |
C | /*
* Tutorial 4 Jeopardy Project for SOFE 3950U / CSCI 3020U: Operating Systems
*
* Copyright (C) 2015, <GROUP MEMBERS>
* All rights reserved.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "questions.h"
question quest[NUM_QUESTIONS] = {
{
"BEATLES",
"This one was married to Yo... |
C | //
// main.c
// SIMP Assembler
//
// Created by Dan Malka on 28/12/2020.
//
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX_LEN 256
#define MAXLABELSIZE 50
#define MAXSIZE 500
typedef struct LABEL
{
char LABELNAME[MAXLABELSIZE];
int labeladdress;
st... |
C | /*
* strdup.c
*/
#include <string.h>
#include <stdlib.h>
/*@
requires \exists integer i; Length_of_str_is(s,i);
assigns \nothing;
ensures \result != \null ==> \forall integer i; 0 <= i <= Length(s) ==> s[i] == \result[i];
@*/
char *strdup(const char *s)
{
int l = strlen(s) + 1;
char *d = malloc(l);
//@ assert... |
C | #include <stdio.h>
/*
Binary Search
The binary search algorithm is used for searching for a value in a sorted array (either in
ascending or descending order). To see how this algorithm works, assume that we are
searching for a value in an array sorted in ascending order:
Step 1: We use two variables, that is, sta... |
C | /*
** buffer.c for buffer in /home/yan/Documents/psu/PSU_2016_zappy
**
** Made by yan
** Login <yan.poinssot@epitech.eu>
**
** Started on Fri Jun 23 13:58:04 2017 yan
** Last update Tue Jun 27 13:55:57 2017 yan
*/
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "zappy_buffer.h"
#include "zappy... |
C | #include<stdio.h>
int main()
{
int num1,num2,mul,i,flag=0;
printf("Enter the numbers");
scanf("%d %d",&num1,&num2);
mul=num1*num2;
for(i=1;i<mul;i++)
{
if(mul==i*i)
{
flag=1;
printf("\nYES");
break;
}
}
if(flag==0)
printf("\nNO");
return 0;
}
|
C | /*
* 编写一段程序。它不读取任何命令行参数或者读取一个命令行参数。
* 如果有一个参数,程序将它作为一个输入文件名。
* 如果没有参数,使用标准输入最为输入。假设输入完全由浮点数组成。
* 让程序计算并且报告输入数字的算数平均值。
*
* 将每次读入的数直接加到 sum 中,而不将其再存入一个数组中。
* */
#include <stdio.h>
#include <stdlib.h>
#define MAX 100
int main (int argc, char *argv[])
{
FILE *in;
double n;
int cnt = 0;
double sum = 0.0... |
C | #include<stdio.h>
int main(void)
{
int toes = 10;
int toes_twice;
int toes_square;
int temp ;
temp = toes;
toes_twice = toes*2;
toes_square = temp*temp;
printf("toes_twice is %d, toes_square is %d", toes_twice, toes_square);
getchar();
return 0;
}
|
C | double distance(int i, int j){//recibe numeros de equipos, no indices (hay que restar)
/*cout<<"locacion actual:"<<i<<endl;
cout<<"me muevo a:"<<j<<endl;
cout<<"recorro una distancia de:"<< D[i-1][j-1]<<endl;*/
return D[i-1][j-1];
}
double teamScheduleDistance(vector<vector<int>> S, int j){
... |
C | #include <stdlib.h>
#include <stdio.h>
void main (){
int fub[16] = {0, 1}, i, suma=0;
for(i=0; i<16; i++){
fub[i+2]=fub[i]+fub[i+1];
printf("%d, ", fub[i]);
}
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include<sys/types.h>
#include <unistd.h>
#include<sys/wait.h>
int main(){
pid_t pid,ppid, special_pid;
int status;
for( int i=0; i<2; i++){
pid=fork();
if (pid<0){
printf("error\n");
exit(-1);
}
if (pid==0){
printf("child %d with parent %d starts slee... |
C | #include<stdio.h>
#include<stdlib.h>
struct node{
int data;
struct node* next;
};
struct node* insert(struct node* head, int ele, int pos)
{
struct node* newnode = (struct node*) malloc(sizeof(struct node));
newnode->data = ele;
newnode->next = NULL;
if(head==NULL)
return newnode;
... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int valorA, valorB;
int soma, subtrair, multiplicar, dividir, resto;
printf("Digite o primeiro valor: ");
scanf("%d", &valorA);
printf("Digite o segundo valor: ");
scanf("%d", &valorB);
soma = valorA + valorA;
subtrair = valorA - va... |
C | /*
Desarrollar una función que reciba como parámetro un caracter.
La función debe mostrar un mensaje si es una vocal o no es una vocal.
Debe funcionar tanto con mayúsculas y minúsculas.
*/
#include<stdio.h>
int getVowels(char input);
int stopExecution();
///////////////////////////////////////////////////////////... |
C | #include <stdio.h>
#define NUM_ELEMENTS 10
int main(void)
{
//variable declarations
int akArray[NUM_ELEMENTS]; //int iarray changed to int akArray
int i, num, sum = 0;
//code
printf("\n\n");
printf("Enter Integer Elememts For Array : \n\n");
for (i = 0; i < NUM_ELEMENTS; i++)
... |
C | #include<stdio.h>
typedef struct product {
char name[20];
int price;
int stock;
}PRODUCT;
int main(void) {
PRODUCT product1 = {"ﰢ",1000,10};
PRODUCT product2 = { "",4000,10 };
PRODUCT product3 = { "",3000,10 };
/*ü 迭 ü ּҰ ؾѴ.*/
PRODUCT* prd[] = { &product1,&product2,&product3 };
for (int i = 0;i < sizeof(prd... |
C |
/* File: stock2.c
By: Tep Dobry
login: tep
Date:
Mod :
*/
/* Program to compute the value of one stock in a portfolio reading
the data at run time */
main()
{ /* Variable Declarations */
int shares; /* number of shares owned */
int sell_whole; /* selling price informa... |
C | #include<stdio.h>
void main()
{
int cost[10][10],visited[10]={0},ne=1;
int i,j,a,b,u,v,n,s,min,mincost=0;
printf("\nEnter number of vertices : ");
scanf("%d",&n);
printf("\nEnter adjacency matrix : ");
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
scanf("%d",&cost[i][j]);
if(cost[i][j] == 0)
cost[i][... |
C | #include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include "Alert.h"
#include "AlertManager.h"
#include "AlertScheduler.h"
enum {ALERT_SCHEDULER_UNACTIVE=0, ALERT_SCHEDULER_ACTIVE};
void alert_func(int sData, void *data)
{
AlertScheduler *sch... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
#if 1
//difference between scanf and sscanf
char s1[3], s2[3] = "San";
printf("Enter string: ");
scanf("%s", &s1);
printf("s1: %s\n", s1);
printf("s1 address %d\n", &s1);
sscanf(s1,"%s",s2); // s1 will get copied to s2
printf("s... |
C | #include <stdio.h>
int main(int argc, char *argv[])
{
long long int w, h;
scanf("%lld %lld", &w, &h);
printf("%lld", ((w*w)/4 * (h*h)/4));
return 0;
} |
C | # include <stdio.h>
#define MAX 40
void ler_vetor(int vetor[], int tam){
int i;
for(i=0;i<tam;i++)
scanf(" %d", &vetor[i]); /*atribui elemento pra cada posição*/
}
int compara(int element, int vetor2[], int tam){
int j;
for(j=0;j<tam;j++){
if(element==vetor2[j]) /*confere se há repetição entre os dois ve... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/stat.h>
#include <errno.h>
#include <signal.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#define FIFO1 "./fifo.1"
#define FIFO2 "./fifo.2" //Может быть доделаю с этим
void work(int gold_mine, int col_get_... |
C | #include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <netdb.h>
#define BUFLEN 1500
int main(int argc, char *argv[]) {
struct addrinfo hints, *ai, *ai0;
char ip_address[BUFLEN];
int i;... |
C | /*
Class: CPSC 346-01
Team Member 1: Matt Carter
Team Member 2: n/a
GU Username of project lead: mcarter6
Pgm Name: proj8.c
Pgm Desc: Constructing a virtual memory simulator
Usage: ./a.out BACKING_STORE.bin addresses.txt
*/
#include <stdio.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "handle_ferr.h"
#include "ggets.h"
#include "ll3.h"
static void *print(int tag, void *lp)
{
char *ln = lp;
printf("%d: %s\n", tag, ln);
return lp;
}
static void dofile(char *pname, char *fname, FILE * inf)
{
ll *beg = NULL;
char... |
C | #include "testLibrary.h"
int sizeOfPoint(){
return sizeof(POINT);
}
POINT newPoint(int x, int y){
POINT p;
p.x = x;
p.y = y;
return p;
}
int assertCorrectPoint(POINT aPoint, int x, int y){
return aPoint.x == x && aPoint.y == y;
}
int sizeOfLongStruct(){
return sizeof(LONG_STRUCT);
}
int passingLongStruct(L... |
C | #ifndef NODE_H
#define NODE_H
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdbool.h>
#include <math.h>
#define NODE_I(V) { .type = INTEGER, .int_value = V, .matcher = EQUAL }
#define NODE_IM(V, M) { .type = INTEGER, .int_value = V, .matcher = M }
#define NODE_S(V) { .type = STRING, .str_value... |
C | #include "frame_io.h"
void save_frame(AVPicture *pFrame, int width, int height, char *name) {
FILE *pFile;
int y;
// Open file
pFile = fopen(name, "wb");
if (pFile == NULL)
return;
// Write header
fprintf(pFile, "P6\n%d %d\n255\n", width, height);
// Write pixel data
for ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h> //Funciones sleep
#include <pthread.h> //Threads
#include "hidapi.h" //USB-HID
typedef int boolean;
#define TRUE 1
#define FALSE 0
boolean en_ejecucion;
void *captura_finalizacion(void *arg){
getchar(); //Este extrae del buffer del tecla... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
char rand_char(){
return (char)( (rand() % 26) + 97);
}
int main()
{
setvbuf(stdin, NULL, _IOFBF, 32768);
setvbuf(stdout, NULL, _IOFBF, 32768);
srand(rand()+time(NULL));
int T,N,H,i,j,score=0,new_score=-1;
scanf("%d%d%d",&T,&N,&H);
char pas... |
C | # 圆形体体积计算器(20 分)
# 本题要求实现一个常用圆形体体积的计算器。计算公式如下:
# 球体体积 V=3/4πr^3,其中r是球体半径。
# 圆柱体体积 V=πr^2h,其中r是底圆半径,h是高。
# 圆锥体体积 V=1/3πr^2h,其中r是底圆半径,h是高。
# 输入格式:
# 在每次计算之前,要求输出如下界面:
# 1-Ball
# 2-Cylinder
# 3-Cone
# other-Exit
# Please enter your command:
# 输出格式:
# 如果读入的指令是1或2或3,则执行相应的体积计算;如果是其他整数,则程序结束运行。
# 当输入为1时,在计算球体体积之前,打... |
C | #include <stdlib.h>
#include <string.h>
/**
* @author beanmoon
*/
/* typedef int stack_elem_t; */
//define stack_elem_t to (void *) to fit in p024binary_tree.c
typedef void * stack_elem_t;
typedef struct{
int size;
int capacity;
stack_elem_t *elems;
} stack_type;
stack_type * stack_create(int capacity){
... |
C | /*Checks numbers for repeated digits*/
#include <stdio.h>
#include <stdbool.h>
int
main (int argc, char *argv[])
{
bool digit_seen[10] = {false};
int digit;
long n, i = 0;
/* 首先将数读入一个数组,但是这里如何声明数组是个问题?*/
printf("Enter numbers(<=0 to terminate): ");
do
{
scanf("%ld", &n[i]);
... |
C | /**************************
* 函数功能:为进程设置文件模式创建屏蔽字,并返回以前的值;
* 函数原型:
*
* mode_t umask (mode_t cmask);
* 参数说明
* cmask是前面介绍的文件权限的9个值的若干个按位“或”构成,9个权限如下所示:
**/
/*****************************
* 文件访问权限
* st_mode屏蔽 意义
* S_IRUSR 用户-读
* S_IWUSR 用户-写
* S_IXUSR 用户-执行
*****************************
... |
C | #include <stdio.h>
int main()
{
int n = 0;
printf("Enter the size of an array: ");
scanf("%d", &n);
int a[n];
printf("Enter the elements of an array:\n");
for (int i = 0; i < n; i++)
{
scanf("%d", &a[i]);
}
int maximum = a[0];
for (int i = 1; i < n; i++)
{... |
C | #include <stdio.h>
int main()
{
int c[] = {2,8,3,4,4,6,7,5};
int j,*p = c, *q = c;
for(j = 0; j < 5; j++)
{
printf("%d\r\n",*c);
++q;
}
for(j = 0;j<5;j++)
{
printf("%d\r\n",*p);
++p;
}
}
|
C | /* icanna.c
* VERSION: 0.9.0
* AUTHER: knak@ceres.dti.ne.jp
* DATE: 2003.9.29
* LICENCE: GPL
*/
/*
* communicate unix domain cannaserver
* stdin -> cannaserver -> stdout
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <stdio.h>
#include <sys/un.h>
#include <string.h>
#include <unistd.h>
#include <st... |
C | #include <stdio.h>
int main(int argc, char *argv[])
{
int n,k;
for(k=31;k<100;k++)
{
n=k*k;
if((n%10==n/10%10) && (n/100%10==n/1000) && (n%10!=n/1000))
printf("%d\n",n);
}
return 0;
} |
C | //#include <stdio.h>
//
//int main()
//{
// int n;
// scanf("%d", &n);
//
// int min = 1000000, max = -1000000;
// int input;
// for (int i = 0; i < n; ++i)
// {
// scanf("%d", &input);
// if (input > max) max = input;
// if (input < min) min = input;
// }
//
// printf("%d %d\n", min, max);
// return 0;
//} |
C | /*
Implement atoi to convert a string to an integer.
Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases.
Notes: It is intended for this problem to be specified vaguely (ie, no given input specs). You are responsible to... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void)
{
int num1;
int num2;
int num3;
printf("Input three integer: ");
scanf("%d %d %d", &num1, &num2, &num3);
printf("%d\n", num1);
printf("%d\n", num2);
printf("%d\n", num3);
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define INITIAL_LIST_SIZE 8
typedef struct {
unsigned int maxSize;
unsigned int size;
void** entries;
} List;
List* InitList();
void DeleteList(List* ls);
int AppendToList(List* ls, void* entry);
void* GetListItem(List* ls, unsigned int index);
List* Inte... |
C | /**
* Copyright © 2018 Andrey Nevolin, https://github.com/AndreyNevolin
* Twitter: @Andrey_Nevolin
* LinkedIn: https://www.linkedin.com/in/andrey-nevolin-76387328
*
* Example code demonstrating use of Wall-clock Time Measurement library (wtmlib)
*/
#include <stdint.h>
#include <stdio.h>
#include <time.h>
#inclu... |
C | #include "mylib.h"
#include <limits.h>
struct pollfd client[OPEN_MAX];
char* name[OPEN_MAX];
uint8_t client_status[OPEN_MAX];
int main()
{
int listenfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
struct sockaddr_in servaddr;
bzero(&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_port = ... |
C | /**
* Defines für den Laser-Ranger
*
* Hokuyo URG-04LX: fov 240°, 681 samples
*/
#ifndef LASER_H
#define LASER_H
#include <math.h>
/**
* Field-Of-View in Grad
*/
#define LASER_FOV_DEG (240.0)
/**
* Samples in FOV
*/
#define LASER_SAMPLES (681)
/**
* Maximale Messung in Metern
*/
#define LASER_RANGE_MIN (0.35)
/**... |
C | /**************************************************************************
PROGRAM NAME : dssd (source dssd.c)
**************************************************************************/
#include <string.h>
#include <stdio.h>
#include <time.h>
FILE *inp; /* input file */
FILE *out; /* output file */
char *p1;
cha... |
C | #include <stdio.h>
#include <stdlib.h>
/*
int pedirIntRango;
int main()
{
int x = pedirIntRango();
printf("%d",x);
return 0;
}
int pedirIntRango(int min,int sup){
int num;
printf("Ingrese un numero entre %d y %d",min,sup);
scanf("%d",&num);
while(num < 0 || num > 500){
printf("... |
C | #include "headers.h"
#include "linkedList.h"
#include "PriorityQueue.h"
#include "Queue.h"
#include "PCB.h"
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <ctype.h>
#include <signal.h>
#include <time.h>
#include <m... |
C | //
// Created by Bori on 2/25/2020.
//
#include <stdlib.h>
#include <stdio.h>
#include "list.h"
dlList createDLList() {
dlList newdlList;
newdlList.sentinel = createNodeWithSelfReference(0);
return newdlList;
}
void addFirst(dlList *mydlList, int value) {
node *newNode = createNode(value, mydlList->s... |
C | #include "find.h"
#include <stdio.h>
#include <stdlib.h>
char **blocks_array = NULL;
unsigned int num_blocks = 0;
unsigned int initialized = 0;
char *search_dir = NULL;
char *file_search = NULL;
char *tmp_name = NULL;
int create_table(unsigned int size) {
if(initialized == 1) {
fprintf(stderr, "library ... |
C | #include "gpio.h"
struct Morse { char letter; const char* symbol; } code[] = {
{ 'a', ".-" },
{ 'b', "-..." },
{ 'c', "-.-." },
{ 'd', "-.." },
{ 'e', "." },
{ 'f', "..-." },
{ 'g', "--." },
{ 'h', "...." },
{ 'i', ".." },
{ 'j', ".---" },
{ 'k', "-.-" },
{... |
C | #include <stdio.h>
union uniao{
int x;
float y;
}uniao;
int main(void) {
int e=0, n=0;
float n1=0;
printf("Voce deseja entrar com um numero inteiro(1) ou flutuante(2)?\n");
scanf("%d", &e);
if(e==1){
printf("\nDigite seu numero: ");
scanf("%d", &n);
uniao.x = n;
printf("\nSeu numero em pont... |
C | #include <stdio.h>
#include <stdlib.h>
#include "graph.h"
static int *pre, *low;
static int *stack;
static int cnt;
static int k, n;
TG *cria(void) {
TG *g = (TG *) malloc(sizeof(TG));
g->prim = NULL;
return g;
}
TNO *busca_no(TG *g, int n) {
TNO *p = g->prim;
while ((p) && (p->id_no != n)) {
... |
C | /****************************************************************************
Jamie Zhang
cs12xre
Christopher Cabreros
cs12xjm
CSE 12, W15
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
void playerinfo();
void gamelayout();
int dice();
void game();
int control(int *,int *,int, int);
void snake();
void display();
void snakedecrement(int *, int *);
void ladderincrement(int *, int *);
void ladder();
char p1[30];
int i1 = 9;
int j1 = 0;
int i2 = 9;... |
C | //
// searchTfIdf.c
// Assignment 2 COMP1927
// 3 June 2016
// Created by Winnie Zheng && Vivian Bakiris
//
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include "searchTfIdf.h"
#include "prlist.h"
#include "searchPagerank.h"
#include "pagerank.h"
#include <math.h>
#include <sys/sta... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.