language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include <string.h>
//strcmp
void main()
{
char userName[25];
int decision;
int bucle = 1;
int estudiando = 1;
while(bucle == 1){
printf("bienvenidos a Platzi Terminal\n");
printf("ingresa tu nombre de usuario:\n");
scanf("%s", userName);
printf("bienvenido %s ,... |
C | #include "../include/main.h"
#include "../include/audio.h"
#include "../include/g722_encoder.h"
#include "../include/g722_decoder.h"
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>
#define BUFFER_SIZE 80
static void
usage(const char *argv0)
{
... |
C | #include <stdio.h>
int main() {
printf("#=====================================================#\n");
printf("# act3_4.c #\n");
printf("# Autor: Jose Luis Esteban Rodriguez Gonzalez #\n");
printf("# Cod: 220282746 Seccion: D04 #\n");
p... |
C | //
// Scene.c
// SDL_Expensive
//
// Created by Ben on 9/3/20.
// Copyright © 2020 Ben. All rights reserved.
//
#include "Scene.h"
#define max_lights 50
#define max_materials 50
#define max_images 50
Light _lights[max_lights];
Material _materials[max_materials];
SDL_Surface* _images[max_images];
unsigned int nu... |
C | /**
* \brief Interface for rank library
* \file rank.h
* \version 1.0
* \copyright
*
* purpose functions for filling the array and calculate its amount with set accurace
*/
#pragma once
#include <cstddef>
#if defined(rank_STATIC_DEFINE) || defined(rank_DLL_EXPORTALL)
# define RANK_EXPORT
# define RANK_NO_EXP... |
C | /*****************************************************************************
* Copyright (C) 2021 by Taher Ujjainwala
*
* Redistribution, modification or use of this software in source or binary
* forms is permitted as long as the files maintain this copyright. Users are
* permitted to modify this and use it to learn... |
C | #include <stdio.h>
void main()
{
int a = 10;
int b = 20;
printf("\n a=%d -- init", a);
printf("\n b=%d -- init", b);
swap_by_value(a, b);
printf("\n a=%d -- after value", a);
printf("\n b=%d -- after value", b);
swap_by_reference(&a, &b);
printf("\n a=%d -- after ref", a);
printf(... |
C | #include <stdio.h>
#include <stdlib.h>
struct node {
int vertex;
struct node * next;
};
/* We use int ** to store a two dimensional array which is the adjacent list.
* Similary, we need struct node** to store an array of Linked lists
*/
struct Graph {
int num_vertices;
int * visited;
struct node ** adjacent_li... |
C | //
// Created by Nick Lai on 2021/10/2.
//
#ifndef ARRAY_STACK_H
#define ARRAY_STACK_H
typedef struct {
void **data;
int length;
int top;
} ArrayStackStructure, *ArrayStack;
ArrayStack InitStack(int size);
void UninitStack(ArrayStack stack);
int Size(ArrayStack stack);
int Length(ArrayStack stack);
i... |
C | /*EX01 - Scrivere il Programma legge un Nome e stampa il numero caratteristico (calcolato nel
seg. modo: somma del numero corrispondente a ogni lettera A=1, B=2, C=3... es. ADA stampa 6, infatti 1(A) +4(D) +1(A) = 6)
*@author Danilo Cappellino
*@version 1.0
*@date 26/01/2017
*@param cifra
*@return stampa della somma de... |
C | /*
基础题:20190627
定义一个 fn(n)函数,其中 n 表示输入 n 行 n 列的矩阵(数的方阵)。
在输出时,先输出 n 行 n 列的矩阵,再输出该矩阵的转置形式 。 例如,当参数为 3 时,先输出:
1 2 3
4 5 6
7 8 9
再输出:
1 4 7
2 5 8
3 6 9
运行方式:如下所示
gcc 程序.c/a.exe
请输入行和列n:3
输入矩阵元素:
输入元素 a11: 1
输入元素 a12: 2
输入元素 a13: 3
输入元素 a21: 4
输入元素 a22: 5
输入元素 a23: 6
输入元素 a31: 7
输入元素... |
C | int main()
{
int sz[1000];
int a,b,c,d,e,f,s,i;
for(i=1;i<1000;i++){
scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);
if(a==0&&b==0&&c==0&&d==0&&e==0&&f==0){break;}
sz[i]=(d+12-a)*3600+(e-b)*60+f-c;
printf("%d\n",sz[i]);
s=s+1;
}
return 0;
}
|
C | #include <stdio.h>------------------->COPIED FROM OTHER
int main(void)
{
int t,i;
scanf("%d",&t);
for(i=0;i<t;i++)
{
long int s,j,k,m,cal=0,n;
scanf("%ld",&s);
long int intro[s];
for(j=0;j<s;j++)
{
scanf("%ld",&intro[j]);
}
for(m=0;m<s;m++)
{
long int ep=0;
... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/syscall.h>
int main(int argc, char **argv, char **envp)
{
char buf[100];
// write(1, "hello uclibc\n", 13);
// fprintf(stderr, "hello, world\n");
sprintf(buf, "argc: %d\n", argc);
syscall(SYS_write, 1, buf, strlen(buf));
s... |
C | #include "test_perm.h"
#define START 0x96
unsigned int __attribute__((noinline))
fn_test(void fn(state *s, int round_constant), state *x) {
uint64_t oldcount, newcount;
fn(x, START);
oldcount = getcycles();
fn(x, START);
newcount = getcycles();
return (unsigned int)(newcount - oldcount);
}
st... |
C | #include <stdio.h>
#include<math.h>
int gcd(int a, int h)
{
int temp;
while(1)
{
temp = a%h;
if(temp==0)
return h;
a = h;
h = temp;
}
}
char encryptor(int msg){
double p = 3;
double q = 7;
double n=p*q;
double count;
double totient = (p-1)*(q-1... |
C | #pragma once
/*
* compiler.h
*/
#define TRUE 1
#define FALSE 0
#define NOOPSTMT 100
#define PRINTSTMT 101
#define ASSIGNSTMT 102
#define IFSTMT 103
#define GOTOSTMT 104
#define KEYWORDS 8
#define RESERVED 28
#define VAR 1
#define IF 2
#define WHILE 3
#define SWITCH 4... |
C | /*********************************************************
* Zadanie 3
* Aleksander Profic
*********************************************************/
#include <stdlib.h> /* rand */
#include <string.h>
#include <stdio.h> /* printf */
#include <sys/types.h> ... |
C | #include <stdio.h>
#include<stdlib.h>
#include<time.h>
struct MaxHeap
{
int size;
int* array;
};
int main( int argc, char *argv[] )
{
clock_t tic = clock();
FILE *file;
FILE *fp;
file=fopen(argv[2],"r");
int a[100],i,t,j,d;
for(i=0;i!=EOF;i++)
{
fscanf(file,"%d",&a[i]);
}
int len=i;
int ch=argv[1];
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <String.h>
/**
* INFO 4A - PROJET 2019-2020 - L2
* Auteurs : MEURANT Christophe & CHIBILE Romuald
* Enseignant de TP : MORLET Lucas
**/
char*** genPuzzEXP(int);
int isSolved(char***,int);
char*** mixGame(char***,int);
char*** swapPiece(char***,ch... |
C | #include <math.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <time.h>
#include <headers.h>
void sumVec(double *A, double *B, double *C, int n) {
for (int i=0; i < n; i++) {
A[i] = B[i] + C[i];
}
}
void resetGradient(double* gradA, double* gradB, double* TermA, double* TermB, int lenP) {
... |
C | /*
*
* Copyright (C) 2011 Colin Patrick McCabe <cmccabe@alumni.cmu.edu>
*
* This is licensed under the Apache License, Version 2.0. See file COPYING.
*/
#ifndef DUTILS_CORE_fast_log_H
#define DUTILS_CORE_fast_log_H
#include "util/compiler.h"
#include <stdint.h>
/** fast_log is a fast circular buffer used to l... |
C | #define _CRT_SECURE_NO_WARNINGS
//给你一个字符串 s,由若干单词组成,单词之间用空格隔开。返回字符串中最后一个单词的长度。如果不存在最后一个单词,请返回 0 。
//
//单词 是指仅由字母组成、不包含任何空格字符的最大子字符串。
int lengthOfLastWord(char* s)
{
while (*s == ' ')
{
s++;
}
if (*s == '\0')
return 0;
char* fast = s;
char* slow = s;
while (*fast)
{... |
C | #include<stdio.h>
#include<string.h>
void main()
{
char a[50],b[50];
int c;
printf("\n enter the string");
scanf("%s",a);
strcpy(b,a);
strrev(b);
c=strcmp(a,b);
if(c==0)
printf("\n yes");
else
printf("\n no");
getch();
}
|
C | //goulias ioannis aem:1785 bistarakis aleksandros aem:1829
/*this is a program that reads various expressions containing wildcards ("?*") if the expressions are valid the program reads various names and checks if the names match the expressions.
* If the names match,a replacement for each name is printed for each spe... |
C | #include <stdio.h>
#include <stdlib.h>
#define dim1 = 100;
int inverso(int A[dim1],int dim)
{
char B[dim1];
int i=0,j, rep=0;
j=dim;
for (i=0;i<dim;i++){
B[j-1]=A[i];
if(A[i]=='e')
rep++;
j--;
}
puts(B);
Printf("Frecuencia de e: %d",&rep);
} |
C | /*
* Queue.c
*
* Created on: Apr 20, 2016
* Author: shapa
*/
#include "Queue.h"
#include <stdlib.h>
#include <string.h>
#include "system.h"
#include "memman.h"
typedef struct Node {
struct Node *next;
Event_t evt;
} Node_t;
struct {
Node_t *head;
} s_queue;
static Node_t *newNode(EventTypes_e type, void *d... |
C | //子进程发送给父进程发送SIGABRT信号,父进程正在要执行的语句不会执行了
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
int main()
{
int i = 0;
pid_t pid;
pid = fork();
if(pid == -1){
printf("fork error\n");
}else if(pid == 0){
printf("zijinch");
//sleep(1);
sleep(3);
printf("zijinch");
printf("yyy");
... |
C | #include "monty.h"
/**
* _pall - prints all the values on the stack starting from the top
*
* @head: head of a stack_t
* @line_number: line number of the opcode in the file
*
* Return: void
*/
void _pall(stack_t **head, unsigned int line_number)
{
stack_t *current;
current = *head;
while (current)
{
pri... |
C | /*Compensation ratio = 256.0 / (Black value White value)*/
#define COM_RATIO_0
#define COM_RATIO_1
#define COM_RATIO_2
#define COM_RATIO_3
#define COM_RATIO_4
#define COM_RATIO_5
#define COM_RATIO_6
#define COM_RATIO_7
#define B_VAL_0
#define B_VAL_1
#define B_VAL_2
#define B_VAL_3
#define B_VAL_4
#define B_VAL_5
#d... |
C | #include <stdio.h>
#include<math.h>
///AC
int prime(int p) {
int i,rt;
rt=sqrt(p)+1;
if(p==2)
return 1;
else if(p%2==0)
return 2;
else {
for(i=2; i<=rt; i++)
if(p%i==0)
break;
}
if(i==(rt+1))
return 1;
else
return 2;
}
... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* ParseText();
void PadWithSpaces(char* text, int rows, int cols, int textlen);
long* ParseBombs(int* bombsLength);
void BlowRows(long * bombs, int rows, int cols,int bombLength,char matrix[][cols]);
void Print(int rows,int cols,int textlen, char matrix[... |
C | #ifndef LISTA_ENCAD_H
#define LISTA_ENCAD_H
/**
* @typedef Nó
* Representa um elemento dentro da lista encadeada. Além disso, aponta
* para o próximo Nó da Lista ou para NULL caso seja o último.
*
* Variáveis:
* *prox - Ponteiro para o próximo Nó
* *back - Ponteiro para algum Nó anterior ou... |
C | #include "omp.h"
#include <stdio.h>
#include <stdlib.h>
#define N 10000
int randy = 2000;
void fill(int length, double *a)
{
int i;
for (i=0;i<length;i++) {
randy = (1344 * randy + 150888) % 71400;
*(a+i) = ((double) randy)/((double) 71400);
}
}
double sum_(int length, double *a)
{
int i... |
C | #include <stdio.h>
#define PI 3.141592
int main(void)
{
double radius;
double area;
printf(" ԷϽÿ: ");
scanf("%lf", &radius);
area = radius * radius * PI;
printf(" : %lf \n", area);
return 0;
} |
C | #define _GNU_SOURCE
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include<sys/mman.h>
#include<fcntl.h>
#define FILEMODE S_IRWXU | S_IRGRP | S_IROTH
#define MAX 150
int main(int argc, char const *argv[])
{
int fd, ret;
size_t len_file, ... |
C | /********************************************************************
* tocgen.c - Sierra table of contents generator
*
* $Id$
********************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <cocopath.h>
#include <util.h>
static int do_tocge... |
C | #ifndef LABA4_H_INCLUDED
#define LABA4_H_INCLUDED
#include <stdio.h>
#include <stdlib.h>
typedef struct el{
int* pred;
int element;
int* next;
}el;
int loneinost(struct el *n, int kol);
void rendomm(struct el *n, int kol,int rendom);
int deleteE(struct el *n,int kol);
void vovod(struct el *n,int... |
C | #include <stddef.h>
#include <string.h>
#include <ctype.h>
#include "kernel.h"
int sys_open(char *path, int mode)
{
int ifs;
if(strlen(path) < 3)
return -1;
if(path[1] != ':' || path[2] != '/')
return -1;
if(!isalpha(path[0]) && path[0] != '$')
return -1;
if(path[0] == '$')
ifs = 0;
else
... |
C | #include "IVolume.h"
IVolume_p GetIVolumeFile(IVolume_p vol, const char* file){
if(!vol)return 0;
if(!file || !*file)return (IVolume_p)vol->Children;
char* p = (char*)file;
if(*p == '\\')p++;
IVolume_p ret = (IVolume_p)vol->Children;
if(!ret)return 0;
while(*p) {
if(strcmp2delim(vol->Name, p, '\\'... |
C | #include "disjointset.h"
#include <stdlib.h>
Node * create_set(int id){
Node * set = malloc(sizeof(Node));
set->id = id;
set->rank = 0;//número de arestas do caminho mais longo desse nó pra baixo
set->parent = set;
return set;
}
/**
* União por rank:
* Fazer a raiz da arvore com menos nós apontar pra... |
C | #include"hashtable.h"
/*funcao que cria um novo jogo*/
pjogo novojogo(char* nome,char* equipa1, char* equipa2,int score1,int score2){
pjogo p_jogo;
p_jogo=(pjogo)malloc(sizeof(struct jogo));
p_jogo->nome=(char*)malloc(sizeof(char)*(strlen(nome)+1));
p_jogo->equipa1=(char*)malloc(sizeof(char)*(strlen(eq... |
C | #include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
#include <stdlib.h>
int main(){
int p;
p = fork();
if (p==-1){
printf("Error at forking\n");
exit(1);
}
if(p==0){
printf("I am child : pid: %d, parent pid: %d\n", getpid(), getppid());
exit(0);
}
else {
printf("I am parent!");
p = fork();... |
C | #include<stdio.h>
#include<stdlib.h>
int main(int argc,char *argv[])
{
double ounce ;
ounce=atof(argv[1])/16.0 ;
printf("%f\n",ounce) ;
return 0 ;
}
|
C |
#include <stdio.h>
#include <stdlib.h>
#include "status.h"
//- - - - - 线性表的静态单链表存储结构 - - - - -
#define ElemType int //线性表存放的数据类型
#define MAXSIZE 1000 //链表的最大长度
typedef struct{
ElemType data;
int cur;
}component,SLinkList[MAXSIZE];
//- - - - - - - - - - - - - - - - - - - - - - - -
int LocateELem... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
//Di_You_hw4.h needs to be included to use the ASP_CHGACCDIR function.
#include "Di_You.h"
int main()
{
int fp, ret, ori;
unsigned char ch[]="... |
C | /*
The Expat License
Copyright (c) 2017, Shlomi Fish
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publ... |
C | #include <process/scheduler.h>
#include <command.h>
#include <memory/paging.h>
#include <memory/frame.h>
PRIVATE PROCESS* _nextTask(int withPriority);
PRIVATE void saveESP(int oldESP);
PRIVATE void killChildren(int pid);
void downPages(PROCESS *p);
void upPages(PROCESS *p);
/*
* Función cementerio al cual van a parar... |
C | /*************************************************************************
> File Name: module2.c
> Author:
> Mail:
> Created Time: 2018年10月05日 星期五 16时43分57秒
************************************************************************/
#include<stdio.h>
extern int n;
void func(){
printf("module: %d\n", n);
}
|
C | #include <REGX51.H>
#define ON 1
#define OFF 0
sbit led1=P1^0;
sbit led2=P1^1;
sbit led3=P1^2;
#define PRESS 1
#define NOT_PRESSED 0
sbit sw1=P3^3;
sbit sw2=P3^4;
#define HIGH 1
#define LOW 0
sbit M_a=P1^5;
sbit M_b=P1^6;
#define LCD P2 //liquid cristal display
sbit RS =P3^0; //control signal rregister select
sbit ... |
C | /* minimal code example showing how to call the zfp (de)compressor */
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "zfp/inc/zfp.h"
/* compress or decompress array */
static int
compress(float* array, size_t nx, size_t nt, float tolerance, char *outdir, char... |
C | #include <stdio.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <poll.h>
#include <getopt.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <ctype.h>
#include <libgen.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
... |
C | /* tpstatic2: static declaration */
int printf(char*, ...);
static int a, b, c[10];
static int f()
{
static int count = 0;
count++;
return count;
}
int main()
{
static int d = 1;
a = f() + d;
b = f();
d = f();
printf("%d %d %d \n", a, b, d);
return 0;
}
|
C | #include "output.h"
#include "cardPrinter.h"
int checkPattern(int rank, int x, int y)
{
if(rank > 10 || rank < 2) {
return 0;
}
for(int i = 0; i < rank; i++)
{
if(x == COORDS[rank-2][i][0] && y == COORDS[rank-2][i][1]) {
return 1;
}
}
return 0;
}
void printFlippedCard(int x, int y)
{
fillArea(x, y, ... |
C | /*====================================================================*
*
* signed strcomp (char const *string1, char const *string2, unsigned char convert (unsigned));
*
*. Motley Tools by Charles Maier
*: Published 1982-2005 by Charles Maier for personal use
*; Licensed under the Internet Software Consorti... |
C | #include <unistd.h>
#include <pthread.h>
#include <string.h>
#include <string>
#include <cstdio>
#include <iostream>
#include <errno.h>
#include <stdlib.h>
using namespace std;
//错误检查函数
inline void ERR_EXIT(const string &msg,int retnum)
{
if(retnum!=0)
{
cerr<<msg<<": "<<strerror(retnum)<<endl;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <math.h>
#include <complex.h>
typedef double complex cplx;
char *inputFile;
char *outputFile;
int numThreads;
FILE *input, *output;
int N;
double PI;
double* inputValuesDouble;
cplx* inputValues;
cplx* outputValu... |
C | #include<stdio.h>
int main(){
int i,j;
int max;
int arr[3][3] = {{1,2,3},{4,5,6},{7,8,9}};
for(i=0;i<3;i++){
for(j=0;j<3;j++){
printf("%d\t",arr[i][j]);
}
printf("\n");
}
for(i=0;i<3;i++){
max = arr[i][0];
for(j=1;j<3;j++){
if(arr[i][j]>max){
max = ar... |
C | /*************************************************************************************
This file includes TTS common type declarations. A voice phrase is defined by
a data structure named TTS_FLASH which consists of several properties:
id: voice phrase ID to be found in voice-recognition's module memory
secon... |
C | // test.c: main() for testing earth c routines
// Comments containing "TODO" mark known issues
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <float.h>
#include <math.h>
#include <stdbool.h> // defines bool, true, false
#include <time.h>
#include <crtdbg.h>
#include "../../src/... |
C | #include <stdio.h>
int main () {
// division A brings in 62% of total sales for company COM
// predict how much they'll make if the total sales is $4.6 million
double percent = 0.62;
double totalSales = 4.6; // in millions
double prediction = totalSales * percent;
printf("Division A will bring in $%f\n", predi... |
C | /* Abygail Stiekman
Unix Tools
Homework 2
03/02/2018*/
#include <unistd.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <time.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
#define MAX_ROWS 50
#define MAX_COLS 101
/*this program is an extension of The diff command line util... |
C | #ifndef _DELETECHILD_H
#define _DELETECHILD_H
Status DeleteChild(BiTree &T, BiTree p, int LR)
{// p ָ T ijڵ
if(p)
{
if(LR == 0)
{
DestroyBiTree(p->lchild);
return TRUE;
}
else if(LR == 1)
{
DestroyBiTree(p->rchild);
return TRUE;
}
}
return OK;
}
#endif
|
C | #ifndef LIB
#define LIB
#define TYPE1 1
#define TYPE2 2
#define TYPE3 3
#define TYPE4 4
#define ACK_T1 "ACK(TYPE1)"
#define ACK_T2 "ACK(TYPE2)"
#define ACK_T3 "ACK(TYPE3)"
#define MSGSIZE 1400
#define PKTSIZE 1396
// Dimensiunea maxima a payload-ului unui cadru
#define MAXLEN_PAYLOAD 60
// Numarul maxim de... |
C | #include <stdio.h>
/**
* 插入排序
* @param array
* @param length
*/
void insertSort(int array[], int length) {
for (int i = 1; i < length; i++) {
int value = array[i];
int j = i - 1;
while (j >= 0 && array[j] > value) {
array[j + 1] = array[j];
array[j] = value;
... |
C | //str concatination
#include <stdio.h>
#include <string.h>
void main(){
char a[20], b[20];
int i=0,j=0,len_a=0;
printf("Enter two strings:");
scanf("%s",&a);
scanf("%s",&b);
len_a=strlen(a);
for(i=0;i<strlen(b);i++){
a[len_a]=b[i]; len_a++;
}
printf("%s\n",a);
}
|
C | #include<stdio.h>
int main(){
int a,i,d=0;
for(i=0;i<5;i++){
scanf("%d",&a);
if(a%2==0){
d++;}}
printf("%d valores pares\n",d);
return 0;}
|
C | #include "battleship.h"
coordinates tryEveryDirection(cell board[][COLS], stackElement **stack){
coordinates target = (*stack)->coordinate;
int shot_checker;
if ((*stack)->number_of_tested_shots == -1){ //right provera sta se nalazi desno od pogotka
target.y += 1;
(*stack)->number_of_tested_shots = 0;
s... |
C | #include <stdio.h>
int soucet_delitelu(int cislo){
int i;
int soucet = 0;
for (i = 1; i <= cislo; i++){
if (cislo%i == 0){
soucet += i;
}
}
return soucet;
}
int abundantni_cislo(int cislo){
if (cislo * 2 < soucet_delitelu(cislo)){
return 1;
}
return 0;
}
int abundantni_cisla(int n){
int i;
int soucet... |
C | // Dificuldade 2, o retorno deve ser a quantidade de trocas.
// Dificuldade 3, o vetor preenchido deve ser de um arquivo
// 17 de Fevereiro entrega do Trabalho
#include <stdio.h>
#define n 5
void imprimir_vetor (int vet[]);
void preencher_vetor (int vet[]);
int bubble (int vet[]);
int selection (int vet[]);
int inse... |
C | #include <unistd.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <fcntl.h>
#include <stdio.h>
#define BUF_SIZE 1024
int main(int argc, char *argv[]) {
int inputFd, outputFd, openFlags;
mode_t filePerms;
ssize_t numRead;
char buf[BUF_SIZE] = {0};
if (argc != 4) {
printf("Usage: %s old... |
C | #include "trig.h"
int trig(char string[], double startValue, double finalValue, double intermediateRows)
{
// Default our logical operators to false (zero)
int isSin = 0, isCos = 0, isTan = 0, isRadians = 0, isDegrees = 0;
// Check the input string and assign boolean values to terms
for (int i = 0; i < strlen(s... |
C | void frequencia_elementos(int* v, int n, int *elementos, int *frequencia, int *tam_elementos);
void frequencia_elementos(int* v, int n, int *elementos, int *frequencia, int *tam_elementos){
int i, j, repetido;
*tam_elementos = 0;
for(i = 0; i < n ; i++){
repetido = 0;
for(j = 0; j < tam_elementos; j++... |
C | #include <stdio.h>
#define max( x , y) ((x) > (y) ? (x) : (y))
const int MAX = 1e5 +5;
const int ROWS = 30;
const int COLS =30;
// set has or not
// size of set
// insert
// search
// delete
//
int SET[MAX];
static int count =0;
int getdata()
{
int val;
if (!scanf("%d" , &val))
{
printf("The entered val mus... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include "normal_bst.h"
struct bst {
int info;
BST* l;
BST* r;
};
BST* create(int info){
BST* new = malloc(sizeof(*new));
new->info = info;
new->l = NULL;
new->r = NULL;
return new;
}
void destroy(BST* bst){
if(!bst) r... |
C | #include <stdio.h>
#include <math.h>
int main()
{
double a,b,r=0;
scanf("%lf", &a);
if(a<0 || a>10){
printf("Digite a novamente: ");
return 0;
}
scanf("%lf", &b);
if(b<0 || b>10){
printf("Digite b novamente: ");
return 0;
}
r=((3.5*a)+(7.5*b))/11;
prin... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mpi.h>
#include <time.h>
#include <sys/times.h>
#include <sys/time.h>
#define INCLUDED 0
#define NOT_INCLUDED 1
#define max(a,b) (a>b?a:b)
#define MAIN_PROC 0
#define N_MAX 1000
#define VALUE_MAX 100
#define WEIGHT_MAX 1000
#define EVAL_TAG 0x20
voi... |
C | /*
* C the Hard Way
* Exercise 1
* D Rams, 8/11/2015, CS50
*/
#include <stio.h>
int main(int argc, char *argv[])
{
puts("Hello, World!");
return 0;
}
|
C |
#ifndef ALLNET_CHAT_STORE_H
#define ALLNET_CHAT_STORE_H
#include "lib/keys.h"
/* start_iter and prev_message define an iterator over messages.
* the iterator proceeds backwards, setting type to MSG_TYPE_DONE
* after the last message has been read. */
/* the iterator should be deallocated with free_iter after it is... |
C | extern volatile int pixel_buffer_start;
extern volatile char * char_buffer_ptr;
extern short title[76800];
extern short blue_choice[2400];
extern short green_choice[2400];
extern short red_choice[2400];
extern short yellow_choice[2400];
extern short blue_in_green[14400];
extern short blue_in_red[14400];
extern short... |
C | // p.13.5.12.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define row 20
#define col 30
int main(int argc, char *argv[])
{
FILE *fin, *fout;
int data[row][col];
char file_input[] = "data";
char file_output[] = "graphic";
char convert[] = {' ', '.', '\'', '\"', '^', '*', '%', '$', '@', '#'};
if... |
C | #include "inv.h"
//MAP* maps[MAX_MAPS];
MAP* testMap(void){
MAP* test = (MAP*)malloc(sizeof(MAP));
SDL_Rect rect1 = {.x=-960,.y=200,.w=1920,.h=500};
test->world[0] = &rect1;
return test;
}
int addMap(MAP** maps, MAP* map){
for(int i = 0; i < MAX_MAPS; i++){
if(maps[i] == NULL){
maps[i] = map;
return 0;
... |
C | /* Averages the driving force of particels over time */
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>
#include<sys/stat.h>
int main ()
{
FILE *in;
FILE *out;
int start = 0;
int end = 600000;
int count = 0;
double sum4 = 0.0;
double sum5 = 0.0;
double sum6... |
C | static int Sub(int a, int b) {
return b -a;
}
static unsigned Select(unsigned a, unsigned b, unsigned c) {
const int pa_minus_pb =
Sub((a >> 8) & 0xff, (b >> 8) & 0xff) +
Sub((a >> 0) & 0xff, (b >> 0) & 0xff);
return (pa_minus_pb <= 0) ? a : b;
}
__attribute__((noinline)) unsigned Predictor(u... |
C | #include <stdio.h>
//#ifdef UNIT_TESTING
extern void mock_assert(const int result, const char* const expression,
const char * const file, const int line);
#undef assert
#define assert(expression) \
mock_assert((int)(expression), #expression, __FILE__, __LINE__);
//#endif // UNIT_TE... |
C | /************************************
* Author: Ben R. Olson
* Date: 5/21/2016
* Assignment: Oregon State University CS 344 Operating Systems Assg 3 smallsh
* *********************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.... |
C |
#include<stdlib.h>
#include<stdbool.h>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include"memoizationfactorials.h"
// --------------------------------------------------------
// FUNCTION factorials_calculate
// --------------------------------------------------------
bool factorials_calculate(factorials*... |
C | #pragma once
#include <math.h>
#include <stdlib.h>
#define PI 3.14159265358979323846
typedef struct mesh
{
float *verts;
float *norms;
float *texCoords;
unsigned int *elements;
unsigned int numVertices;
unsigned int numElements;
unsigned int maxElements;
};
struct Vertex
{
float position[3];
float normal[3];... |
C | #include <stdio.h>
extern void set_key(int);
extern int get_key(void);
int key;
int main(void)
{
int res;
set_key(10);
key = get_key();
set_key(20);
res = key + get_key();
printf("%d", res);
return 0;
} |
C | #include <stdio.h>
#include <stdlib.h>
#define QUEUE_SIZE 5 /* 格納データの最大個数 */
typedef int QUEUE_TYPE; /* 格納データの型 */
QUEUE_TYPE gQueue[QUEUE_SIZE + 1]; /* データ格納用の配列 */
int gQFront = 0; /* 待ち行列の先頭の位置 */
int gQRear = 0; /* 待ち行列の末尾の次の位置 */
void error(char *s);
void initQueue(void... |
C | # include <stdlib.h>
# include <stdio.h>
# include <string.h>
# include <time.h>
# include <math.h>
# include "fem_io.h"
/******************************************************************************/
char ch_cap ( char ch )
/******************************************************************************/
/*
Purp... |
C | #include <pthread.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <ctype.h>
#define READKEY 6667
void P(int semid, int index);
void V(int semid, int index);
void *subp1(void *arg);
void *sub... |
C | #include <stdio.h>
#include <stdlib.h>
// Node of the linked list
typedef struct Node {
int data;
struct Node *prev;
struct Node *next;
} Node;
// Handle of the list. Its head points to the first node in the list.
typedef struct List {
Node *head;
int number_of_nodes;
} List;
// i... |
C | /*
<vectors.c>
04oct91 jm Original code.
26feb92 jm Added wipvectornpts and modified wipvector routine.
This was due to a change in the VECTOR structure to
include the current number of points in the array.
26feb92 jm Modified wipNewVector for VECTOR->npts member.
31jul92 jm Modified to use wipnews... |
C | int an1[len + 10];
int an2[len + 10];
char szline1[len + 10];
char szline2[len + 10];
int Add(int maxlen, int* a1, int* a2)
{
int high = 0;
for(int i = 0; i < maxlen; i++)
{
a1[i] = a1[i] + a2[i];
if(a1[i] >= 10)
{
a1[i] = a1[i] - 10;
a1[i + 1]++;
}
}
for(int i = maxlen - 1; i >= 0; i... |
C | #include "mylib.h"
#include "vector.h"
#define TEST_NUM 1000
// Test data structure
typedef struct {
int num;
} data_t;
void
data_free_func(void *entry) {
data_t *data = (data_t *)entry;
log_debug("Freeing %d", data->num);
free(data);
}
#define test(func, expect, got) \
do { ... |
C | #include "insertionSort.h"
int main()
{
node *curr;
node *head=NULL;
int i;
for(i=0;i<40;i++)
{
curr=(node *) malloc(sizeof(node));
curr->value=rand()%100;
curr->next=head;
head=curr;
}
curr=head;
printf("Unsorted List:\n");
printList(curr);
print... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* gestrr.c :+: :+: :+: ... |
C | #include "control.h"
#include "protocol.h"
#include "commun.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef Linux
#include <unistd.h>
#include <fcntl.h>
#endif // Linux
extern HOST_ADDR gl_Host_Addr;
void clean_stdin()
{
#ifdef Windows
fflush(stdin);
#endif //Windows
#ifdef Linux
int ... |
C |
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<dirent.h>
#include<sys/socket.h>
#include<arpa/inet.h>
#include<unistd.h>
#include<pwd.h>
#define M 100
#define N 100
#define BUFF_SIZE 1500
extern void RunCmd();
extern char ipcmd[100];
extern char opcmd[10000];
extern int status;
char BUF[1000];... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.