language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*
* WHATWG Encoding API built-ins
*
* API specification: https://encoding.spec.whatwg.org/#api
* Web IDL: https://www.w3.org/TR/WebIDL/
*/
#include "duk_internal.h"
/*
* Data structures for encoding/decoding
*/
typedef struct {
duk_uint8_t *out; /* where to write next byte(s) */
duk_codepoint_t lead; /... |
C | #include <stdio.h>
int main(){
double notas[12]= {100, 50, 20, 10, 5, 2,1, 0.50, 0.25, 0.10, 0.05, 0.01};
double valor;
int i;
scanf("%lf",&valor);
for(i = 0; i<12 ; i++){
int n=0;
if(valor>=notas[i]){
n=valor/notas[i];
valor = valor - n*notas[i];
... |
C | #pragma once
#ifndef __WALL_H_
#define __WALL_H_
struct wall_t
{
float left;
float right;
float top;
float bottom;
void init(ivec2 size);
};
inline void wall_t::init(ivec2 size)
{
if (size.x >= size.y)
{
float aspect = size.x / (float)size.y;
left = -1.0f * aspect;
right = 1.0f * aspect;
top = 1.0f;
... |
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 "Funciones.h"
#include "Validaciones.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
int mostrarMenuABM(void)
{
char entrada[10];
int opcion;
printf("BIENVENIDOS: \n\n");
printf("1. Cargar los datos de los empleados desde el archivo data.csv ... |
C | #include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
/* kernel-XXX.elf получаемое из npk файла напрямую не может быть распакован. xz ругается на повреждение данных!
сравнительный анализ показал что в данных действительно содержится мусор: [ 7F FF 80 00... |
C | #include<stdio.h>
#define MAX 10
int MAT[MAX][MAX],A[MAX],Q[MAX];
int n,r=-1,f=0;
void depth(int i,int vis[])
{
if(i!=n){
printf("%d ",A[i]);
vis[i]=1;
for(int j=0;j<n;++j)
if(!vis[j]&&MAT[i][j])
depth(j,vis);
}
}
void breadth(int i,int vis[]){
for(int j=0;j<... |
C | //Creando un Archivo secuencial
#include <stdio.h>
#include <cerrno>
int main(void)
{
int cuenta; /* nmero de cuenta */
char nombre[30]; /* nombre de la cuenta */
double saldo; /* saldo de la cuenta */
errno_t err;
FILE* cfPtr; /* cfPtr = clientes.dat puntero a tipo ar... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define N 200000
int custo;
int pai[N];
typedef struct {
int x, y, v;
} Grafo;
Grafo grafo[N];
int cmp(const void *a, const void *b);
void definir(int n);
int buscar(int x);
int unir(int x, int y, int p);
int main() {
int m, n, i;
while(scanf("... |
C | #include<stdio.h>
int main()
{
int ID ,hrs;
float wperh,salary ;
scanf("%d %d %f",&ID,&hrs,&wperh);
salary=hrs*wperh;
printf("NUMBER = %d\nSALARY = U$ %.2f\n",ID,salary);
}
|
C | #include<stdio.h>
int main()
{
int A[10][10],B[10][10],i,j,k,l,MULTIPLICATION[10][10],r1,r2,c1,c2;
printf("Enter rows and columns for first matrix:");
scanf("%d %d",&r1,&c1);
printf("Enter rows and columns for the swecond matrix:");
scanf("%d %d",&r2,&c2);
if(c1==r2)
{
printf("Enter elements in fir... |
C | #include <stdio.h>
#include <math.h>
int main()
{
long long N;
scanf("%I64d", &N);
N *= 2;
for(long long i = sqrt(N) - 3; i < sqrt(N) + 3; ++i) {
if(i * (i - 1) < N && N <= i * (i + 1)) {
printf("%I64d\n", N / 2 - (i - 1)*i / 2);
break;
}
}
return 0;
}
|
C | /* ----------------------------------------------------------------------
* Project: CMSIS DSP Library
* Title: arm_shift_q31.c
* Description: Shifts the elements of a Q31 vector by a specified number of bits
*
* $Date: 18. March 2019
* $Revision: V1.6.0
*
* Target Processor: Cort... |
C | #include<stdio.h>
#include<stdlib.h>
int** a;
int cnt[3];
int same(int x, int y, int n) {
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
if (a[x][y] != a[x + i][y + j])return 0;
}
}
return 1;
}
void solve(int x, int y, int n) {
int m = n / 3;
if (same(x, y, n)) {
cnt[a[x][y] + 1]++;
retur... |
C | #include <stdio.h>
//change a to "a" in string
#define STRING(a) #a
//combine a and b
#define PASTER(a,b) a##b
int macro2()
{
int nData = 10;
//PASTER(nDa, ta) is same as nData
printf("%d\n", PASTER(nDa, ta));
printf("%d\n", nData);
//STRING(nData) is same as "nData"
printf("%s\n", STRING(nData));
return 0... |
C | #include<stdio.h>
int main()
{
int i,n;
printf("Type Year");
scanf("%d",&n);
if(n%400==0)
printf("Yes");
else if(n%4==0)
printf("Yes");
else
printf("No");
}
|
C | /* NICOLESCU Daniel-Marian - 314CB */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "TStiva-Lista.h"
#include "TCoada-Lista.h"
#include "TInfo.h"
// eliberare informatie
void FreeInfo(void **ae)
{
free(*ae);
*ae = NULL;
}
// eliberare celula
void FreeCel(void **ac)
{
free(*ac);
*ac = NULL;... |
C | #include "prog1Functions.h" /*Including our functions and variables*/
int main (int argc, char * argv[])/*argc/argv allows us to pass into main command line arguments to use*/
{
FILE * mazeFilePointer; /*file pointer for opening up our maze txt filesa*/
int z; /*used in our for loop to alloca... |
C | #include <stdio.h>
//function declaration
void subfun();
int main()
{
subfun();
subfun();
subfun();
return 0;
}
//function definition
void subfun()
{
static int st = 1; //static variable declaration
printf("\nst = %d ", st);
st++;
} |
C | //
// T54-spiral-matrix.c
// algorithm
//
// Created by Ankui on 5/4/20.
// Copyright © 2020 Ankui. All rights reserved.
//
// https://leetcode-cn.com/problems/spiral-matrix/
#include "T54-spiral-matrix.h"
#include "algorithm-common.h"
/**
* Note: The returned array must be malloced, assume caller calls free().... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
int VSIZE;
int HSIZE;
//Open specified file, read in occupancy grid, and return grid as 2D int array
int **readOccupancyGrid(char *filename) {
//Result
int **grid;
//Open file
FILE *fin = fopen(filename, "r");
if(fin == NULL) {
f... |
C | // Program - Output a box with given width and height (Box drawn with *)
#include <stdio.h>
void draw_box (unsigned int width, unsigned int height)
{
// Output the top of the box with "width" asterisks
for(unsigned int i = 0 ; i < width ; ++i)
printf("*");
// Output height-2 rows of "width" charact... |
C | #include "users/ucode.c"
#include "include/type.h"
#define LINES 24
print_page(int fd);
print_line(int fd);
int main(int argc, char *argv[])
{
int fd, r;
char cmd, tty[64];
if (argc > 1)
{
fd = open(argv[1], RDONLY);
}
else
{
fd = dup(0);
close(0);
gettty(tty);
open(tty, RDONLY);
... |
C | /*=============================================================================
# FileName: 3-sqrt.c
# Desc: accepts a b c, finds out roots of the equation.
# Author: Max Lee (Ho Suk Lee)
# Email: hoso1312@gmail.com
# HomePage: http://imnotbermuda.com
# Version: 0.0.1
# LastChange: 2... |
C | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/shm.h>
#include <sys/ipc.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <pthread.h>
#define SHMSZ 1024
int shmid;
char *data, *od;
void *reciever() {
while(1) {
if(strcmp(od, data) != 0) {
pr... |
C | int main()
{
int firstnum = 1;
int secnum = 1;
printf("%i\n%i\n", firstnum, secnum);
for (int i = 0; i<23; i++)
{
int num = secnum;
secnum += firstnum;
firstnum = num;
printf("%i", secnum);
}
return 0;
}
|
C | #include<stdio.h>
int main()
{
int n,i,max,count=0,x;
scanf("%d",&n);
int z[n+1],y[n+1];
for(i=0;i<n;i++)
{
scanf("%d",&y[i]);
}
for(i=0;i<n;i++)
{
if(y[i]<=y[i+1])
{
count++;
z[i]=count;
}
else
{... |
C | #include <stdio.h>
#include <math.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
int main()
{
const int N = 100;
struct res
{
float masg[N];
float masf[N];
float masy[N];
};
uint8_t test;
int error,exit1, j, i, k;
char* sovp;
float mas[N];
float F, G, Y, a, x, x2, shag, m... |
C | /*
TODO:
make a storage system (flat file)
make a transport system (email most likely, IRC requires an IRC server...)
fix caps lock bug (if caps is on when start, we don't know. so just learn when caps goes off, and consider everything before it reversed.
fill out special keys, so we aren't blinded when... |
C | #include "coder.h"
#include "command.h"
#include <stdlib.h>
int encode_file (const char *in_file_name, const char*out_file_name) {
FILE *in;
FILE *out;
in = fopen(in_file_name, "r");
out = fopen(out_file_name, "wb");
CodeUnit enc_point;
uint32_t point;
while (!feof(in)) {
... |
C | #include "map_surface.h"
void CDMap_display_grid(Carc_Layout *layout){
int tile_size=CDUtils_get_tile_size_in_pixels(layout->tile_size);
int width = layout->map_surface->w;
int height = layout->map_surface->h;
int i=0, cur_coord=0;
SDL_Surface *vertical_line = SDL_CreateRGBSurface(0,1,height,32,0,... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "bruteForce.h"
#include "time.h"
/**
* This program is the implementation of the TSP problem with brute force.
* The program runs the vertices from a file.
*
* @author probal chandra dhar
* @date 12/1/2016
* @info Course COP5990
*... |
C | // encoder VI
void DoEncoderVI() {
if (encVI.isClick()) { // нажата кнопка экодера - меняем его текущий режим - выбор яркости или часа
SaveTimer = millis(); // сбросить таймер записи в eprom
encVImode = ++encVImode;
if (encVImode > 1) encVImode = 0; // modes till 0 to 1, коротким нажатием выбираем ... |
C | /*
** EPITECH PROJECT, 2020
** CPE_lemin_2019
** File description:
** pathfinding
*/
#include "lemin.h"
void create_ants(lemin_data_t *data)
{
ant_t *ant;
for (int i = 1; i <= data->ants_nb; i++) {
ant = malloc(sizeof(ant_t));
ant->nb = i;
ant->current_room = data->start_room;
... |
C | #include <stdio.h>
#include <math.h>
//Potencias de dos, compilar con -lm al final
void sum(long long *i){
int n=0;
for (n;n<=37;n++){
(*i) = pow(2,n);
printf("2^%d\t", n);
printf("%lld\n", (*i));
}
}
main(){
long long i;
sum(&i);
}
|
C | #ifndef STRINGCACHE_H
#define STRINGCACHE_H
#include "stdtypes.h" // to make VS2005 not complain about stricmp
C_DECLARATIONS_BEGIN
typedef const char *constCharPtr;
void stringReorder(void);
int numIndexedStringsInStringTable(void);
void stringCachePreAlloc(int size);
// Generic string table
const char* allocAddS... |
C | #include <stdio.h>
main()
{
printf("hello, world\n");
// return 0; nothing special if commented out
}
// commenting out the first line will cause the following message:
/*
ex1-1.c:2:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
2 | main()
| ^~~~
ex1-1.c: In function ‘main’:
ex1-1.c:4:3: warn... |
C | #include "esstd.tête" // Entrées-sorties standard
#include "bibstd.tête" // Bibliothèque standard
// Fonction principale, qui affiche ses arguments puis quitte
ent principal(ent carg, car** varg) {
ent i; // Déclaration d’entier
pour(i = 0; i < carg; i++) // Boucle «pour»
imprimerf("%s ", varg[i]); // Affichage fo... |
C | #include <ir/ir.h>
#include <target/util.h>
static void init_state_kx(Data* data) {
emit_line("var main = function(getchar, putchar) {");
for (int i = 0; i < 7; i++) {
emit_line("var %s = 0;", reg_names[i]);
}
emit_line("var mem = [];");
for (int mp = 0; data; data = data->next, mp++) {
if (data->v)... |
C | /**
* All functions you make for the assignment must be implemented in this file.
* Do not submit your assignment with a main function in this file.
* If you submit with a main function in this file, you will get a zero.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "debug.h"
#include "sfmm... |
C | #ifndef __LLIST_H
#define __LLIST_H
#include <stdlib.h>
#include <mex.h>
/* pt = point */
/* ll = linked list */
struct pt{
long x;
long y;
long z;
long idx;
struct pt *prev;
struct pt *next;
};
typedef struct pt PT;
struct ll{
PT *head;
PT *curr;
long length;
};
typedef struct ll LL... |
C | /** \file test_report.c
* \brief units tests for report.h
*
* Description: Unit test for report funcionalities
*
* Version: 1.0
* Created: 04-03-2017 20:39:25
* Revision: none
* Compiler: gcc
*
* Author: Edgard Leal (edgardleal@gmail.com),
* Organization:
*
... |
C | #ifndef STRUCTS_H
#define STRUCTS_H
typedef struct arr_r
{
int *data;
int len;
int capacity;
int max_cap;
} arr_t;
typedef struct node_r
{
int data;
unsigned char height;
struct node_r *left;
struct node_r *right;
} node_t;
typedef struct hash_r
{
int *data;
int *key;
... |
C | #include "./polyhedron.h"
#include <math.h>
#include "./common.h"
#include "./geom.h"
static void get_vertex_by_index(vertex_float *dest, const vertex_float *project_vertices, uint32_t index) {
uint32_t stride = index * 3;
dest[0] = project_vertices[stride + 0];
dest[1] = project_vertices[stride + 1];
... |
C | #include <cs50.h>
#include <stdio.h>
int main(void)
{
printf("x is ");
int x = get_int();
printf("y is ");
int y = get_int();
printf("the sum of %i and %i is %i\n", x, y, x + y);
printf("the substract of %i and %i is %i\n", x, y, x - y);
printf("the product of %i and %i is %i\n", x, y, x... |
C | #include<stdio.h>
int arr[5];
int front=-1;
int rear=-1;
void enqueue(int value)
{
if(front==-1 && rear==-1)
{
front=rear=0;
arr[rear]=value;
printf("%d pushed to the circular queue\n",value);
}
else if((rear+1)%5==front)
printf("The circular q... |
C | #include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <curses.h>
#include <time.h>
#include "edge_runner.h"
#define SCREEN_WIDTH 120
#define SCREEN_HEIGHT 50
void update_map();
void generate_random_map(enum position, int[]);
void create_left_map(void);
void create_bottom_map(void);
void create_top_map(v... |
C | #include "../headers/clase4.h"
/*
Ejercicio para resolver:
04.05 –Leer tres datos «a» , «b» y «c». Se pide imprimirlos ordenados de mayor a menor (considerar que son distintos).
Notar la complejidad y cantidad de instrucciones que se necesitan para resolverlo con las variables escalares que estamos usando hasta ahora.... |
C | #include <stdio.h>
#include <stdio.h>
#include <sys/socket.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <signal.h>
#include <string.h>
int main(int argc, char** argv) {
int sock = 0;
int valRead;
int error = 0;
char response[1024] = {0};
struct sockaddr_in serv_addr;
if((sock = socket(AF_INET, SO... |
C | /**
CS50: Introduction to Computer Science (course by Harvard University, taken via edX.org)
PSet2: Initials (more comfortable)
@author: Andrey Tymofeiuk
Important: This code is placed at GitHub to track my progress in programming and
to show my way of thinking. Also I will be happy if somebody ... |
C | //binary tree: each node has an additional field node which is initialized to be NULL at first. Asked to, for each node,
//point its next pointer to the next node in level-by-level traversal order. NO QUEUE should be used HERE!
//Solution:
//Notice although the order of depth first search is not exactly same to breat... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* semicolon.c :+: :+: :+: ... |
C | /*************************************************************************
> File Name: sbrk.c
> Author:
> Mail:
> Created Time: 2017年07月05日 星期三 11时03分59秒
************************************************************************/
#include<stdio.h>
#include <unistd.h>
#include <stdlib.h>
int main()
{
printf(... |
C | /*
Peter Faulkner
Final Project
player.c
*/
#include "player.h"
#include <f3d_lcd_sd.h>
#include <f3d_uart.h>
#include <f3d_led.h>
#include <stm32f30x.h>
#include <stdlib.h>
int rand_battle;
void player_init(player *p){
p->x = 64;
p->y = 80;
p->pokeballs = 8;
p->caught = 0;
f3d_lcd_drawChar(p->x,p->... |
C | #include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef unsigned char BYTE;
int main(void){
// addr: variable where we will save the hex address we want to read from
// i, n: i is a counter for bytes left to read, n is the total number of bytes we want to read
// ptr: simple pointer
... |
C | /* ====================================================
# Copyright (C)2019 All rights reserved.
#
# Author : Wythe Chao
# Email : hi@bug.js.cn
# File Name : simple_read.c
# Last Modified : 2019-11-21 13:49
# Describe :
#
# ====================================================*/
#inc... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv) {
char* text="";
FILE * output=stdout;
for(int i=1;i<argc;i++){
printf("%s%c",argv[i],' ');
}
printf("\n",output);
return 0;
}
|
C | #pragma once
#include "defs.h"
#include <stdint.h>
/* TODO: improve docs, since the current ones are somewhat
* non-descriptive */
/**
* Encode src into dest using Most Significant Byte (MSB)
* @param src - source 32-bit int
* @param dest - dest octet buffer
*/
void msb_encode32(uint32_t src, octet* dest);
/**... |
C | /*
* rotary_encoder.c
*
* Created on: 3 Sep 2019
* Author: grein
*/
#include <gpio.h>
#include <Interrupts/SysTick.h>
#include <Rotary_encoder/rotary_encoder.h>
#include <stdlib.h>
#include <stdbool.h>
#include "board.h"
//This driver has an ISR called by an SysTick Callback
//Number of SysTicks per ISR CA... |
C | #include <GL/glut.h>
#include <stdio.h>
#include <stdlib.h>
float xc,yc,r;
void draw8points(float xc,float yc, float x,float y){
glBegin(GL_POINTS);
glColor3f(0,0,1);
glVertex2i(xc+x,yc+y);
glVertex2i(xc+x,yc-y);
glVertex2i(xc-x,yc+y);
glVertex2i(xc-x,yc-y);
glVertex2i(xc+y,yc+x);
glVertex2i(xc+y,yc-x);
gl... |
C | #include<stdio.h>
#include<string.h>
void main()
{
int i, j, l, s = 1;
char str[100];
printf("\nEnter the string=");
gets(str);
l = strlen(str);
printf("length=%d", l);
printf("\nDuplicate characters are=");
for (i = 0; i < l; i++)
{
for (j = i + 1; j < l; j++)
{
if (str[i] == str[j])
{
if (s ... |
C | #include <stdio.h>
#include <stdlib.h>
int main() {
int *vetor;
vetor = (int*) malloc(3 * sizeof(int));
printf("\nmalloc()\n");
vetor[0] = 10;
vetor[1] = 20;
vetor[2] = 30;
for (int i=0; i<3; i++)
printf("vetor[%d]=%d\n", i, vetor[i]);
//calloc()
vetor = (int*) reallo... |
C | #include <stdio.h>
#include "list_queue.h"
int main(int argc, char* argv[]) {
QUEUE queue = queue_construct();
for(;;) {
char buf[256];
char c;
int value = 0;
fgets(buf, 256, stdin);
if(sscanf(buf, "%c %d", &c, &value) == 0) {
continue;
}
... |
C | #ifndef PARSER_C
#define PARSER_C
#include "stackvm.h"
char labelnames[256][32];
int labelnamecount = 0;
unsigned char skip(char **str, const char *pre) {
unsigned char found = strncmp(pre, *str, strlen(pre)) == 0;
if(found)
*str += strlen(pre);
return found;
}
void skipmany(char **str, char ch) {
while... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define DIM 100
void sostituisciCarattere(char parole[DIM][DIM], char carattere, char sostituto, int n)
{
for (int j = 0; j < n; j++)
{
for (int i = 0; i < strlen(parole[j]); i++)
{
if (parole[j][i] == carattere)
... |
C | // Given the string find the corresponding excelsheet number
// Sample Case: AB - 28, ZY - 701, A - 1
#include<stdio.h>
#include<string.h>
int main()
{
int i,sum = 0;
char columnTitle[7];
int letters[26];
printf("Enter the string like in excelsheets:");
gets(columnTitle);
for(i=1;i<=26;i++)
{
... |
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 | unsigned int SwapBBBB(unsigned int i)
{
unsigned int result=(i>>24)&0xff;
result|=(i>>8)&0xff00;
result|=(i<<8)&0xff0000;
result|=(i<<24)&0xff000000;
return(result);
}
unsigned int SwapBB(unsigned int i)
{
unsigned short result=(i>>8)&0xff;
result|=(i<<8)&0xff00;
return(result);
}
unsigned long SwapWW(unsigne... |
C | /*
* Find the sum of all strong repunits under N
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "hash_table.h"
#include "utils.h"
int main (int argc, char ** argv) {
if (argc != 2) {
fprintf (stderr, "usage: %s <N>\n", argv[0]);
return 1;
}
long N = atol (argv[1]);
if (N < 1) {
pri... |
C | #include <stdio.h>
#include <signal.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
static pid_t pid;
void do_sig(int num)
{
if (pid > 0)
{
static int m = 1;
printf("I am %d\t %d\n", getpid(),m);
m += 2;
kill(pid,10);
}
else
{
static int n;
printf("I am %d\t %d\n", getpid(),n);
n... |
C | #include <stdlib.h>
#include <stdio.h>
#include <math.h>
unsigned char prepara(char* coluna){
char ret[8];
x[1] x[]
for(int i=0; i<8; i++){
if(comparativa(coluna[i],'0')){
ret [i]='0';
}else if(comparativa(coluna[i],'1')){
ret[i]='1';
}
}
}
int comparativa(char a, char b){
int pot... |
C | #include "delay.h"
// very simple delay
// CPU oscilator is 16MHz
// 1 instr = 0.0625 uS
// 1 cycle = 4 instruction
// 1 us = 4 cycle
#define DFACTOR 4
static volatile unsigned long i;
void delay_us(unsigned long d)
{
i = DFACTOR * d;
while (--i != 0);
}
void delay_ms(unsigned long d)
{
i = DFACTOR * d * 1000... |
C | #define _CRT_SECURE_NO_WARNINGS
//#include<stdio.h>
//#define MAX 20
//int main()
//{
// int n, arr[MAX], i, x, k = MAX, b;
// scanf("%d", &n);
//
// for (i = 1; i <= n; i++)
// {
// scanf("%d", &arr[i]);
// }
// scanf("%d", &x);
// if (n == 0)
// {
// return 0;
// }
// for (... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n = 5;
printf("fatorial de %d = %d", n, fatorial(n));
return 0;
}
//recursividade
int fatorial(int n)
{
if (n == 1)
return 1;
return n * fatorial(n - 1);
}
|
C |
#include "apue.h"
#include <fcntl.h>
extern void TELL_WAIT();
extern void TELL_CHILD(pid_t pid);
extern void TELL_PARENT(pid_t pid);
extern void WAIT_CHILD();
extern void WAIT_PARENT();
static int number = 0;
static char str[10];
void pr()
{
printf("Pid = %d,Number = %d\n",getpid(),number);
}
int getNumber(const... |
C | #include <stdio.h>
int main(int argc, char const *argv[])
{
int n,fac=1,i=1;
scanf("%d",&n);
while(i<=n){
fac*=i;
i++;
}
printf("%d!=%d\n",n,fac );
return 0;
} |
C | /* Replace "dll.h" with the name of your header */
#include "dll.h"
#include <windows.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
//#include <libusb-1.0/libusb.h>
#include "libusb.h"
#include <sys/types.h>
// Device vendor and product id.
#define IDVENDER ... |
C | #include <stdio.h>
int josephus(int pessoas, int ignorar)
{
if (pessoas == 1)
{
return 1;
}
else
{
return (josephus(pessoas - 1, ignorar) + ignorar - 1) % pessoas + 1;
}
}
int main()
{
int pessoas = 5;
int ignorar = 3;
printf("Vencedor: %d", josephus(pessoas, ignora... |
C | /*
* hardware/Intel/cp_daemon/cpdUtil.c
*
* General utilities for CPDD.
*
* Martin Junkar 09/18/2011
*
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <utime.h>
#include <sys/time.h>
#include <time.h>
static struct timeval start_time;
void initTime(void)
{
... |
C | #include "holberton.h"
/**
* swap_int - a function that swaps the values of two integers
* @a: an integer
* @b: b is an integer
* Return: void
*/
void swap_int(int *a, int *b)
{
int temp = *a;
*a = *b;
*b = temp;
}
|
C | #include <stdio.h>
int s=0;
int sum(int n)
{
int r;
r=n%10;
s+=r;
n=n/10;
if(n!=0)
sum(n);
else
return s;
}
int main()
{
int a;
printf("enter a number: ");
scanf("%d",&a);
sum(a);
printf("sum of digits=%d",s);
return 0;
}
|
C | #include<stdio.h>
int multi ( int a , int b)
{
return (a*b);
}
int main()
{
int a,b;
printf("enter the two number");
scanf("%d%d",&a,&b);
int result=multi( a,b);
printf("the result is %d",result);
} |
C | #ifndef FRAME_H
#define FRAME_H
struct Frame
{
int lowerBound;
int upperBound;
int pageNumber;
int pid;
Frame();
Frame(int x, int y);
};
Frame::Frame()
{
}
Frame::Frame(int x, int y)
{
lowerBound = x;
upperBound = y;
}
#endif
|
C | #include <cs50.h>
#include <stdio.h>
int main(void)
{
char c = get_char("Do you agree? Type Y or N\n"); //Asking the Question//
if (c == 'Y' || c == 'y')
{
printf("Good for you, wanna cookie?\n");
}
else if (c == 'N' || c == 'n')
{
printf("Well that sucks, don't it?\n"... |
C |
#include <stdio.h>
int main(){
int physics, chemistry, maths;
float total;
printf("\nEnter Physics Marks: ");
scanf("%d", &physics);
printf("\nEnter Chemistry Marks: ");
scanf("%d", &chemistry);
printf("\nEnter Maths Marks: ");
scanf("%d", &maths);
// Assuming marks are out o... |
C | #include <stdlib.h>
#include "afficheFonctions.h"
#include "signal2D.h"
void traceFonctions2D(trace *fonction, char *fichier, int axe, bool temporal)
{
//Pre-treatment
if(!temporal)
{
unsigned int i, originalWidth = fonction[0].nbValeurs;
for (i = 0; i < originalWidth; i++)
truncate(&fonction[i]... |
C | #include <stdio.h>
#include <errno.h>
#include <sys/socket.h>
#include <resolv.h>
#include <arpa/inet.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define MY_PORT 9999
struct header {
char from;
char to;
unsigned short len;
};
void handle_request(int clientfd) {
struct ... |
C | #include<stdio.h>
int main()
{
int current_february = 28;
int january = 31;
int february = 29;
int april = 30;
int march = 31;
int may = 31;
int july = 31;
int august = 31;
int october = 31;
int december = 31;
int june = 30;
int september = 30;
int november = 30;
int quarter_1_current = january + current... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#include <string.h>
int search(int minimum, int maximum);
char *lowerString(char *str);
int main(int argc, char *argv[])
{
if (argc != 3)
{
printf("Usage: NumberGuesser.elf minimum maximum\n");
return (1);
}
//... |
C |
#include <stdio.h>
#include <float.h>
double income_limits[] = { 0, 23350, 56550, 117950, 256500, DBL_MAX };//DBL_MAXͷļfloat.hӵбĩβ֤ѭе̫
float base_tax[] = { 0, 3502.5, 12798.5, 31832.5, 81710.5 };
float percentage[] = { 0.15, 0.28, 0.31, 0.36, 0.396 };
double single_tax(double income)
{
int category;
for (category =... |
C | //
// Created by Sam on 2018/1/22.
//
#include <malloc.h>
#include "utils/opstack.h"
/*使用链表表示栈:入栈*/
op_stack *stackPush(op_stack *opstack, TokenType opType) {
op_stack *stack = (op_stack *) malloc(sizeof(op_stack));
stack->operatorType = opType;
stack->next = opstack;
return stack;
}
/*出栈*/
op_stack ... |
C | #include "LinkedStack.h"
/*
InitStack() : 初始化一个栈
*/
struct LinkedStack*InitStack()
{
struct LinkedStack*s = malloc(sizeof(*s));
s->top = s->bottom = NULL;
s->num = 0;
return s;
}
/*
DestroyStack() :销毁一个栈
*/
void DestroyStack(struct LinkedStack*s)
{
ClearStack(s);
free(s);
}
/*
ClearStack() :清空一个栈
*/
void C... |
C | #include <stdio.h>
extern void bsort(size_t len, long *array);
extern void msort(size_t len, long *array);
void parray(size_t len, long *array) {
int i;
for (i = 0; i < len; i++) {
printf("%d,", array[i]);
}
printf("\n");
}
int main(int argc, char **argv) {
long x[] = { 6,1,3,7,124,7,23,... |
C | // Justin Ting, 430203826 - Operating Systems Internals Assignment 1
// Monday 10am-12pm lab - Tutor: Jeshua
#include "commands.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>
#include <string.h>
#include <termios.h>
/*
Note that the behaviour of the child process count
here does ... |
C | #include <stdio.h>
int crescente(int n)
{
if (n == 1) {
return 1;
}
int res = crescente(n - 1);
printf("%d\n", res);
return n;
}
int main()
{
int n, res;
scanf("%d", &n);
res = crescente(n);
printf("%d\n", res);
} |
C | #include <cs50.h>
#include <stdio.h>
int main (void) {
int hash;
int height;
int space;
int nl;
height = GetInt();
for(nl = 0; nl < height + 1; nl++)
{
printf("\n");
printf("%d", nl);
for(space = height - 1 ; space >= nl ; space--)
{
printf(" ");
printf("%d", space);
}
for(hash = height - nl ; hash < height + 2 ; ha... |
C | #include <stdio.h>
/* Include other headers as needed */
int main()
{
int test,rot,n,arr[50],i,j;
scanf("%d",&test);
while(test--)
{
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
scanf("%d",&rot);
while(rot>=n)
rot=rot-n;
if(rot<0)
rot=-rot;
for(i=rot... |
C | /* TP12 Systeme Info - (c) Daniel Doubrovkine - 1997
---------------------------------------------------------------------------------------------
launch with either params delimited by spaces or input strings at first line space delim
use right arrow to complete strings or show lists
notes: there's maybe a ... |
C | /**
* A Ring is much like a Sequence: it holds N values associated with the integer indices
* zero through N-1 when N is positive. An empty Ring holds no values. Values are pointers.
* Like the value in a Sequence, values in a Ring may be accessed by indexing.
*
* Unlike a Sequence, however, values can be added to... |
C | /*pointers - get 3 addres of three numbers and array with 3 number and set in each addres the max,med,min*/
#include <stdio.h>
#include <stdlib.h>
#define N 3
void init(int* arr, int size);
void SetOrder(int* numbers, int* min, int* med, int* max);
int main() {
srand(time(0));
int arr[3];
int min = 0;
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.