language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include <string.h>
#include <security/pam_appl.h>
#include <security/pam_misc.h>
static const char *item_msg[14] = {"","SERVICE","USER","TTY","RHOST","CONV","AUTHTOK","OLDAUTHTOK","RUSER","USER_PROMPT","FAIL_DELAY","XDISPLAY","XAUTHDATA","AUTHTOK_TYPE"};
static struct pam_conv conv = {
misc_conv... |
C | //
// memoryReVariable.c
// TestingGround
//
// Get the address and size of the variable. Typecast the address to char pointer. Now loop for size of the variable and print the value at typecasted pointer.
//
#include <stdio.h>
typedef unsigned char *bytePointer;
/*
show bytes takes byte pointer as an argument... |
C | #include "image.h"
void I_print(struct color img[] , int nb_pixels){
for (int i = 0; i < nb_pixels; ++i)
{
C_print(img[i]);
}
}
void I_coef(struct color img[] , int nb_pixels, float coef){
for (int i = 0; i < nb_pixels; ++i)
{
img[i] = C_multiply(img[i],coef);
// C_print(img[i]);
}
}
void I_negative... |
C | /*
* Rahul Gautam
* Indian Statistical Institute
* MIN-MAX heap
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <math.h>
#define SIZE 10000
typedef struct MINMAX
{
int *arr;
int size;
int capacity;
} MinMax;
void swap(MinMax *mm, int i, int j)
{
int t = mm->arr[i];
mm->arr... |
C | #include <stdio.h>
#define ALPHABET 26
int main() {
FILE *in = fopen("task.in", "r");
FILE *out = fopen("task.out", "w");
char symbol;
int letter[ALPHABET];
int index;
for ( int i = 0; i < ALPHABET; i++ ) {
letter[i] = 0;
}
for ( ; fscanf(in, "%c", &symbol) == 1; ) {
... |
C | /*
* Filename: tea.c
* Description: TEA ȣȭ
*
* Author: (aka. , Cronan), ۿ (aka. myevan, ڷ)
*/
#include "stdafx.h"
/*
* TEA Encryption Module Instruction
* Edited by aka. , Cronan
*
* void tea_code(const DWORD sz, const DWORD sy, const DWORD *key, DWORD *dest)
* void tea_decode(const DWORD sz, ... |
C | #include <pebble.h>
#include "nav_series_menu.h"
#include "dashboard.h"
#include "mstrtok.h"
static Window *mWindow;
static SimpleMenuLayer *menu_layer;
static SimpleMenuSection menu_sections[1];
static SimpleMenuItem * menu_items;
int num_a_items = 0;
void nav_series_menu_window_unload(Window *mWindow) {// Deinitiali... |
C | int main(){
int n;
int a=0,b=0,c=0,d=0,e=0,f=0;
scanf("%d",&n);
if(n>=100){
a=(n-n%100)/100;
n=n%100;
}
if(n>=50){
b=(n-n%50)/50;
n=n%50;
}
if(n>=20){
c=(n-n%20)/20;
n=n%20;
}
if(n>=10){
d=(n-n%10)/10;
n=n%10;
}
if(n>=5){
e=(n-n%5)/5;
n=n%5;
}
f=n;
pr... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <openssl/sha.h>
#include <time.h>
const char hash_pwd1[]={"bd17a274120510b73cc32a41d1eda0fc36ed458a"};
const char hash_pwd2[]={"73b64be4d4f6d838de43460c607805141875ff43"};
const char hash_pwd3[]={"fa54a2c671b251d64060f2776072bf48590abf2e"};
const cha... |
C |
#include <stdio.h>
#include "inflection.h"
#include "utils.h"
void print_app_comm_data(struct app_comm_msg* comm_data) {
printf("Size = %d | Action = %d | Data = ", comm_data->header.size, comm_data->header.action);
int i = 0;
for (; i < comm_data->header.size; i++) {
putc(comm_data->data[i], std... |
C | /*
* gcc library source for MMURTL
*/
#include <stdio.h>
#include <errno.h>
#include <mmlib.h>
/*************** fseek *****************************/
/* Set file LFA to desired position. */
int fseek(FILE *stream, long offset, int origin)
{
int erc, crnt;
if (origin==SEEK_CUR)
erc = ... |
C | #include <string.h>
int numDecodings(char *s)
{
int n[strlen(s)];
int i;
if (!s || !s[0])
return(0);
for (i = 0; s[i]; i++) {
if (i == 0) {
if (s[0] == '0')
return(0);
else
n[0] = 1;
continue;
}
if (i == 1) {
if (s[1] == '0') {
if (s[0] != '1' && s[0] != '2')
return(0);
... |
C | #include <stdio.h>
#include <immintrin.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/wait.h>
#define SIZE 1024
double a[SIZE][SIZE];
double b[SIZE][SIZE];
void func(double *a[SIZE], double *b[SIZE], int start, int i, int j) {
if(fork() == 0) {
for (int k = 0; k < 64; k++) {
... |
C | #include "invertir_c.h"
#include "separar_canales_c.h"
#include "unir_canales_c.h"
#ifndef INVERTIR_C
#define INVERTIR_C
void invertir_c (unsigned char *src, unsigned char *dst, int h, int w, int row_size);
IplImage * aplicar_filtro_invertir_c(IplImage *src, void *param) {
IplImage *final;
final = cvCreateI... |
C | #include <stdio.h>
#include <ctype.h>
#include <string.h>
/* Exercise 5.6. Rewrite appropriate programs from earlier chapters and exercises
* with pointers instead of array indexing. Good possibilities include getline (Chapter 1 and 4),
* atoi, itoa, and their variants (Chapters 2, 3, and 4), reverse (Chapter 3), and... |
C | #include "gameControl.h"
int gameSetup(gameRoom** room, int totalRooms)
{
int maxCol, maxRow;
maxRow = 0;
maxCol = 0;
initscr(); //initalize ncurses
noecho(); //reduces characters to go on string
cbreak(); //give me input and output when it is available
curs_set(0); //r... |
C | //
// get_info.c
// pdbParse
//
// Created by mkaya on 26/07/2017.
// Copyright © 2017 mkaya. All rights reserved.
//
#include "read_file.h"
#include "get_info.h"
struct atom *getAtom(struct protein *P, char chainID, int residueID, char* atomName){
int i;
for(i = 0; i < P->size_atom; i++){
if(str... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_stream_reset.c :+: :+: :+: ... |
C | #define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <getopt.h>
//follows numpy convention,
//assuming 2-dim matrix, row operations
//summarizes across all rows, (#lines == 1, #columns = original input)
//while column operations summarize across the columns (#lines == #rows, #columns... |
C | /*
ǺȺ۵⣬ײе0ҳе25ĸȡýСֵ
ʵ2϶5࣬⼴ײ5ĸ
ps:̳ϸҳ5ĸģ20еȷ70 м30Ҳǿܳ0м䲻ܲ
ֻжٸ0
ps:ٴ֤2*5ģͣм0鲻55555555555555~ 7*8*9 = 504 *5=2520
ps:ʵͳ5ĸ0ǿɿأΪλ0Dzܽβ0еġ
Ŀǰͳ5ĸ⣬潫д
*/
#include <stdio.h>
#include <stdlib.h>
int _GetCountOf5(int n) //ͳƷ⣬ǰظͳƵ
{
int i, sum = 0;
for(i = n; i > n/2; i--)
{
if(i%5 == 0)
... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "iostr.h"
#include "opstr.h"
int main(int args, char **argv){
//Var
char* inTest1;
char* inTest2;
int inTest3;
char* mainTest4;
char* catTest4;
//Test 1
printf("\x1b[31m");
printf("\nTest 1.\n");
printf("\x1b[34m");
printf("Testing ... |
C | /*
* =====================================================================================
*
* Filename: printf.c
*
* Description:
*
* Created: 10.09.10
* Revision:
* Compiler: GCC 4.4
*
* Author: Yang Zhang, treblih.divad@gmail.com
* Company:
*
* =====... |
C | /* program to insert a new element in the given array. */
#include<stdio.h>
#define size 100
int main(){
int n, i, p, arr[size], new;
printf("Enter the size of an array : "); //Take the input from user for array size
scanf("%d", &n);
printf("\nEnter %d elements of an array : \n\n", n);
... |
C | #include "vendor/unity.h"
#include "../src/sort.h"
#include <stddef.h>
#include <stdbool.h>
void setUp(void) {}
void tearDown(void) {}
bool verify_orderliness(elementType list[], size_t length, bool (*compare)(elementType a, elementType b)) {
for (size_t i = 0; i < length - 1; i++) {
if (list[i] == lis... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(){
int r;
srand ( time(NULL) );
r = rand() % 3;
printf("%d", r);
printf("\n\n");
return 0;
} |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strjoin.c :+: :+: :+: ... |
C | #include<stdio.h>
void convert(int n) {
int ans[100],i=0;
while(n) {
ans[i]=n%16;
i++;
n=n/16;
}
printf("\nHexadecimal number : ");
for(int j=i-1;j>=0;j--){
printf("%X",ans[j]);
}
}
void main() {
int num;
printf("\nDecimal to hexadecimal : \n");
printf("\nEnter a number : ");
scanf("%d"... |
C | #include <stdio.h>
// ĺ ҹ ȯ
// a(97) - A(65) 32 ϰ ҹڸ ȯ ϴ.
int main(void)
{
char small;
char cap = 'G'; // char ʱȭ
if ((cap >= 'A') && (cap <= 'Z')) // ڿ 빮ڹ(ƽŰڵ尪 A(65) ~ Z(90) ̶)
{
small = cap + ('a' - 'A'); // /ҹ ̸ ҹڷ ȯ
// (cap ƽŰڵ尪) + (a(97) - A(65)) 32 .
}
printf("빮... |
C | //
// Created by Arthur.BOURGUE on 05.04.2019.
//
//====================================================================
//Titre: Sous programme "Maquette2"
//auteur: Arthur Bourgue
//But: Fonctionnement complet de la 1re maquette
//====================================================================
#ifndef BATNA... |
C | #include "led.h"
#include "uart.h"
#include "stdio.h"
void handler(void)
{
uart_putchar('1');
printf("handler!\n");
return;
}
int mymain(void)
{
char buf[10];
int cpsr;
led_init();
led_on();
// uart_init();
//
cpsr = get_cpsr();
printf("cpsr = %x \n", cpsr);
printf("hello, printf ... |
C | #include <stdio.h>
void pointerInc(int *p1,int *p2){
printf("The address of p1 is %p\n",&p1);
printf("The value of p1 is %p\n",p1);
printf("The address of p2 is %p\n",&p1);
printf("The value of p2 is %p\n",p2);
*p1+=1;
p1=p2;
*p1+=2;
}
int main(){
int i,j,*iptr=&i;
scanf("%d%d",&i,... |
C | /*
** bot_attacks.c for in /home/robin/delivery/CPE/CPE_2016_matchstick
**
** Made by Robin Pronnier
** Login <robin@epitech.net>
**
** Started on Sat Jun 10 21:30:26 2017 Robin Pronnier
** Last update Sat Jun 10 22:00:22 2017 Robin Pronnier
*/
#include <stdlib.h>
#include "my.h"
int find_line_atk(char **map, i... |
C | // save.c
inherit F_CLEAN_UP;
int main(object me, string arg)
{
object link_ob;
seteuid(getuid());
if( !objectp(link_ob = me->query_temp("link_ob")) )
return notify_fail("你不是经由正常连线进入,不能储存。\n");
if( environment(me)->query("valid_startroom") ) {
me->set("startroom", base_name(environment(me)));
write("当你下次... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
char UserInput[256];
// Find area of the floor
int AreaOfFloor(int length_floor, int width_floor)
{
printf("Please input the Length of the floor: \n");
if (fgets(UserInput, sizeof(UserInput), stdin)) {
if (1 == sscanf(UserInput, "%d\n", &length_floor)) ... |
C | /****************************************************************************
**
** Copyright (C) 2010 Agile Genomics, LLC
** All rights reserved.
** Primary author: Luke Ulrich
**
****************************************************************************/
#ifndef PARSEDBIOSTRING_H
#define PARSEDBIOSTRING_H
#includ... |
C | #include "io.h"
#include <pthread.h>
#include <stdio.h>
#include <sys/select.h>
#include <sys/time.h>
#include <termios.h>
#include "functions.h"
#define INPUT_BUFFER_SIZE 1024
pthread_t read_thread;
struct termios tty_restore;
char input_buffer[1024];
int16_t next_read = 0;
int16_t next_write = 0;
void * read_th... |
C | #include <ncurses.h>
#define hello_str "Hello, world!"
void get_inch(char *str)
{
int x = 0;
for (; x != sizeof(hello_str) - 1; ++x)
str[x] = mvinch(0, x);
str[x] = '\0';
}
void print_inch()
{
char str[sizeof(hello_str)];
get_inch(str);
addstr(str);
}
int main()
{
initscr();
adds... |
C | /* James Snee s3369721 Algorithms and Analysis */
/* Summer 2015 Assignment 2 - Code */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "stack.h"
/*The program accepts one command line argument: a user input string. If no*/
/*user input is specified, the program will use the sample input provided... |
C | #include<stdio.h>
#include<string.h>
char str[200], temp[30];
/*void checkvalid(char temp[30])
{
int i, flag1= 0, flag2= 0, flag3= 0, flag4=0;
if(strlen(temp)>=6 && strlen(temp)<=15)
{
for(i=0; temp[i]!='\0'; i++)
{
if(temp[i]>='a' && temp[i]<='z')
flag... |
C | /*Program : MenukarDuaAngka.c
* Deskripsi : menukar nilai dari dua angka pada suatu variabel
* Nama : Muhammad Azhar Alauddin
* tanggal/ versi : 31 Januari 2020
*/
#include <stdio.h>
void swapValue(int *value1, int *value2){
int temp;
temp=*value1;
*value1=*value2;
*value2=temp;
}
int main ()
{
int number1,numb... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* select_mode.c :+: :+: :+: ... |
C | /*
* togo_hashtable.c
*
* Created on: 2015-6-24
* Author: zhuli
*/
#include "togo.h"
#include "togo_load.h"
static uint32_t togo_hashtable_bucket(const TOGO_HASHTABLE * hashtable,
u_char *key, size_t len);
static void togo_hashtable_lock(const TOGO_HASHTABLE * hashtable,
uint32_t current_bucket);
stati... |
C | /*===============================================================
* Copyright (C) 2020 All rights reserved.
*
* 文件名称:daily5_homework4.c
* 创 建 者: dwl
* 创建日期:2020/08/17
* 描 述:
*
* 更新日志:
*
================================================================*/
#include <stdio.h>
int main()
{
int... |
C |
int main ()
{ int a,b,c,d,e,f,s[1000],i;
for(i=0;a!=0;i++){
scanf("%d%d%d%d%d%d",&a,&b,&c,&d,&e,&f);
s[i]=f+60*e+3600*d-c-60*b-3600*a+3600*12;
if(a!=0){printf("%d\n",s[i]);}
}
return 0;
}
|
C | /* just a hack for testsuites, do not use for security purposes. */
#include <stdlib.h>
#include <limits.h>
static unsigned int rseed;
int rand_r(unsigned int *seedp)
{
unsigned int rnd;
/* Lower 16bits. */
*seedp = *seedp * 1103515245 + 12345;
rnd = *seedp;
rnd >>= 16;
/* Upper 16bits. */
*seedp = *seedp... |
C | #include <stdio.h>
#include <stdint.h>
/*
1. https://graphics.stanford.edu/~seander/bithacks.html
2. Hacker's Delight 2nd Edition, Chapter 5. Counting Bits
*/
void print_bits(uint32_t n) {
int i = 32;
while(i--){
if ((n >> i) & 1)
printf("1");
else
... |
C |
#include <stdio.h>
#include <stdlib.h>
#include "utils.h"
#include "../shared/typedefs.h"
/*
shortArrToDouble takes in a short array,
a size of the array in BYTES, and whether the program is in debug mode or not.
the function will allocate enough space for a double array with the same number
of elements as the do... |
C | #include <stdio.h>
#include <string.h>
int fib_num[100];
int f_calls = 0;
int fib(int n)
{
f_calls += 1;
if (n == 1 || n == 2) {
fib_num[0] = 0;
fib_num[1] = 1;
fib_num[2] = 1;
return 1;
}
if (fib_num[n] == 0) {
fib_num[n] = fib(n - 1) + fib(n - 2);
... |
C | #include<stdio.h>
#include<string.h>
int main(){
char str[48] = "`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./";
char ch;
while(scanf("%c",&ch)==1){
if(ch=='\n' || ch == ' '){
printf("%c",ch);
}
else{
int index=0,i;
for(i=0;i<48;i++){
if(str[i]==ch){
index = i;
break;
}
}
... |
C | #include "q_incs.h"
#include <strings.h>
#include <math.h>
#include "_cum_for_evan_dt_F4_I4.h"
#define FTYPE float
#define GTYPE int32_t
int
main(
int argc,
char **argv
)
{
int status = 0;
int nF = 1024;
int chunk_size = 64;
FTYPE *F = malloc(nF * sizeof(FTYPE)); // input
GTYPE *G = malloc(nF ... |
C |
#include <stdio.h>
typedef struct _ {
int x; // 4 bytes
float y;
double z;
} newtype;
/*
compile and then object dump (objdump -s binaryfile)
and look at the .DATA segmment
double y = 1.2345;
int x = 0x12345678;
int x1 = 0x88888888;
int x2 = 0x99999999;
char c = 'A';
*/
int main(){
newtype var2; // debugger... |
C | #include<linux/init.h> //required for initialization of the module
#include<linux/module.h> //required to the kernel know this is a Loadable Kernel Module
int hello_init(void)
{
printk(KERN_ALERT "inside %s function\n",__FUNCTION__);
return 0;
}
int hello_exit(void)
{
printk(KERN_ALERT "inside %s function\n",__FUN... |
C | #include <stdio.h>
int main(int argc, char const *argv[])
{
float a = 2.95;
int b = a;
printf("%d\n", b);
return 0;
}
|
C | #include<stdio.h>
#include<stdlib.h>
int dp[5000][2];
//dp[i][0] stores the min num of ops,-1 means not possible
//dp[i][1] stores sum of last block.
//store the min block sum among all 'min' num of operations
int main(int argc, char *argv[])
{
int i,j,k,n,opt;
int max=0,sum=0;
scanf("%d",&n);
int *a=(i... |
C | /*! \file
* Implementation of a simple memory allocator. The allocator manages a small
* pool of memory, provides memory chunks on request, and reintegrates freed
* memory back into the pool.
*
* Adapted from Andre DeHon's CS24 2004, 2006 material.
* Copyright (C) California Institute of Technology, 2004-2010.
... |
C | /*
* merge.c
* 2016s1 Prac Exam #2
* UNSW comp1917
*
* Created by Daniel Lau
* Share freely
* 4/06/16
*/
#include <stdio.h>
#include <stdlib.h>
#include "merge.h"
void merge(list listA, list listB, list mergeList) {
//keeping track of where you are in each of the 3 lists
link currA = listA->head;
lin... |
C | /* Modem for MIPS AJF October 1996
Equalizer routines */
#include <stdio.h>
#include <string.h>
#include "private.h"
#include "complex.h"
#include "equalize.h"
void equalizer::reset()
{ for (int i = 0; i < 2*np+1; i++) coeffs[i] = 0.0;
coeffs[np] = 1.0;
for (int i = 0; i < size; i++) in[i] = 0.0;
... |
C | /*
Name: p4q6.c
Desc: Quiz program.
*/
//directives
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//defined data
#define Q_FILE "Questions.txt"
#define A_FILE "Answers.txt"
//data structures
typedef struct {
char question[30];
char answer[30];
} Quiz;
//declarations
int getQuestion(Quiz *quiz,... |
C | #include <stdint.h>
#include <string.h>
int user1_tobool(const char *Str) {
if (!memcmp(Str, "true", 4) || !memcmp(Str, "1", 1)) {
return 1;
} else if (!memcmp(Str, "false", 5) || !memcmp(Str, "0", 1)) {
return 0;
}
return -1;
}
int user2_tobool(const char *const StrIn, unsigned Len) {
int64_t Word ... |
C | #include <stdio.h>
int main(int argc,char **argv)
{
int num;//declaration of integer
int *numPtr;//declaration of pointer
int num2;
num=100;
numPtr=#//&num= address of variable num
num2=*numPtr;//*numPtr = value on numPtr address
printf("num=%d, numPtr=%d, address of num=%d, num2=%d", num, numPtr, &num, num... |
C | // Implements a dictionary's functionality
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <strings.h>
#include "dictionary.h"
// Represents a node in a hash table
typedef struct node
{
char word[LENGTH + 1];
struct node *next;
}
node;
// Number of ... |
C | #include <stdio.h>
float max(float arr[], int n) {
int i;
float t = arr[0];
for (i=0; i<n; i++) {
t = t > arr[i] ? t : arr[i];
}
return t;
}
float min(float arr[], int n) {
int i;
float t = arr[0];
for (i=0; i<n; i++) {
t = t < arr[i] ? t : arr[i];
}
retur... |
C | #include<Stdio.h>
int main()
{
int a;
printf("Enter a negative integer which is perfectly divisible by 2 : ");
scanf("%d", &a);
if ((a<0)&&(a%2==0))
{
printf("Good Job!");
}
else
{
printf("What's wrong with you?");
}
}
|
C | #include "const_errors.h"
void insertion_sort_array(int n, struct thing *object)
{
int location;
struct thing new_element;
for (int i = 1; i < n; i++)
{
new_element = object[i];
location = i - 1;
while (location >= 0 && object[location].weight / object[location].size \... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* trace_map.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct NODE{
int num;
struct NODE * next;
}node;
void addtohead(node ** head,node * new );
void addbetween(node ** frist,node ** next, node * new );
void addtotail(node ** head,node * new);
int main(){
node * head=malloc(sizeof(node));
//check... |
C | // printqueue_print.c: send jobs to a printer.
// Run one process for each printer.
#include "headers.h"
int main(int argc, char *argv[]) {
//initializing and creating semaphore, should be done before program is used normally
if(strcmp(argv[1],"-init")==0){
sem_t *sem = sem_open("/printqueue_sem", O_CREAT, S_... |
C | #include "lists.h"
#include <stdlib.h>
/**
* list_len - return number of elements in a linked list.
*
* @h: Pointer to list header.
* Return: Size of linked list
*/
size_t list_len(const list_t *h)
{
size_t size = 0;
if (h == NULL)
return (0);
while (h != NULL)
{
size++;
h = h->next;
}
return (siz... |
C | #include <stdio.h>
#include <string.h>
#include "basic.h"
int DetermineFunction(char *name)
{
int i;
char *string[4] = {"GOTO", "IF", "PRINT", "STOP"};
for (i = 0 ; i < 4 ; i++)
if (strcmp(name, string[i]) == 0)
return i+1;
return 0;
}
int DetermineCompare(char *code)
{
char *string[6] = {"==", "!=", ">... |
C | #include <stddef.h>
#include "mm.h"
#include "stats.h"
/* lower triangular matrix multiplication */
void mm1(double *restrict A, const double *restrict B,
const double *restrict C, size_t N)
{
{
start_stats();
for (size_t i = 0; i < N; i++) {
size_t ii = i * (i+1) / 2;
for (size_t j = 0; j <= i... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(void)
{
int a[5][5] = { 0 };
int tanknum = 0;
int x, y; //x y
int hitnum_user = 0;
int hitnum_com = 0;
srand((unsigned int) time(NULL));
////////////////////////////////////////////////
//
//////////////////////////////////////////... |
C | #include <stdio.h>
int main() {
// Array ar[n]
// int + k
// print (i,j)
// i < j
// (ar[i] + ar[j]) % k = 0
int k = 5;
int n = 6;
int ar[6] = {1, 2, 3, 4, 5 ,6};
for (int i = 0; i < n; i++) {
for (int j = 1; j < n; j++) {
if (i < j && (ar[i] + ar[j]) % k == 0) {
printf("[%d,%d] \0", ar[i], ar[j]... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_newmem.c :+: :+: :+: ... |
C | #include<stdio.h>
#include <string.h>
#include <stdlib.h>
#include "../../base/osplatformutil.h"
struct Product /*声明结构*/
{
char cName[10]; /*产品的名称*/
char cShape[20]; /*形状*/
char cColor[10]; /*颜色*/
int iPrice; /*价格*/
char cArea[20]; /*产地*/... |
C | #include <allegro.h>
#include "../include/defines.h"
#include "../include/global.h"
#include "../include/menu.h"
#include "../include/menus.h"
static int _id = DEMO_STATE_MISC;
static int id(void)
{
return _id;
}
static char *choice_yes_no[] = { "no", "yes", 0 };
static void on_fps(DEMO_MENU... |
C | #include <stdio.h>
#include <stdlib.h>
#define MAX_SIZE 20002
#define PLOT_DOWN '\\'
#define PLOT_FLAT '_'
#define PLOT_UP '/'
typedef struct section { int j, size; } sec_t;
int main(int argc, char **argv) {
char buf[MAX_SIZE];
char *ret;
int i, j, m, n, total, sub;
int s1[MAX_SIZE];
sec_t tmp;
sec_t s2[... |
C | #include<stdio.h>
char a, c;
int b;
int main(){
c=getchar();
while(c!='\n'){
a=c;
b=0;
while(c==a){
b++;
c=getchar();
}
printf("%c%d", a, b);
}
putchar('\n');
} |
C | #include <stdio.h>
int CountR( int iNo )
{
static int iCnt = 0;
if ( iNo != 0 )
{
iCnt++;
iNo = iNo / 10;
CountR( iNo );
}
return iCnt;
}
int main()
{
int iRet = 0;
iRet = CountR(1121);
printf( "%d", iRet );
return 0;
}
|
C | /*
*******************************************************************************
* *
* Copyright (c) *
* All rights reserved. *
* ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_draw.c :+: :+: :+: ... |
C | /*NICOLESCU Daniel-Marian-314CB*/
#ifndef _HASH_H_
#define _HASH_H_
//structura hash
typedef struct
{
TFHash fh;
TLG *v;
KeyCmp cmp;
ShowKey show_key;
FreeKey free_key;
} TH;
//prototipurile functiilor:
//functia hash
unsigned int hash_f(const void*, size_t, size_t);
void free_key(void*);
int int_cmp(v... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <ctype.h>
#define MAX_LIB_SIZE 100
#define MAX_LENGTH 1024
typedef struct song{
char songName[MAX_LENGTH];
char artist[MAX_LENGTH];
char genre[MAX_LENGTH];
} Song;
/* Function Prototypes */
void inputSt... |
C | /*
Author: AnOnYmOus001100
Date: 08/08/2020
Description: Ramanujan number is the smallest number that can be expressed as sum of two cubes in two different ways.
Find all such numbers upto a resonable limit.
*/
#include<stdio.h>
int main()
{
int i, n1, n2, x, y, r;
printf("Input a range n1 n2 between which to... |
C | #include <stdio.h>
#define max(a,b) (a>b?a:b)
int dp[55][55][55][55] = {0};
int arr[55][55] = {0};
int main()
{
int m,n;//ѧλmn
scanf("%d%d",&m,&n);
int i = 0;
int j = 0;
//ͬѧԣ1,1m,n)λѧĺøж
for(i = 1; i <= m; i++)
{
for(j = 1; j <= n; j++)
{
scanf("%d",&arr[i][j]);
}
}
int i1,j1,i2,j2;
for(i1... |
C | #include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>
#define NUM 5
pthread_mutex_t chopsticks[NUM];
void *philosopher(void *arg)
{
const char *args = (const char *)arg;
char id = args[0];
char d1 = args[1];
char d2 = args[2];
int o1 = d1 - '0' - 1;
int o2 = d2 - '0' - 1;
pthr... |
C | #include<stdio.h>
#include<time.h>
void insertion_sort(int array[], int length);
char* printArray(int* array, int length);
#define size sizeof(array) / sizeof(array[0])
int main()
{
// int array[] = {5, 2, 9, 4, 6, 1, 3, 8};
clock_t start, end;
double elapsed;
start = clock();
int array[1900];
for (int... |
C | #include<stdio.h>
#include<unistd.h>
int main()
{
int i;
i=fork();
if(i==0)
{
printf("\n");
char *p[]={"./child.sh",NULL};
execvp("./child.sh",p);
}
else
{
printf("\n");
char *p[]={"./parent.sh",NULL};
execvp("./parent.sh",p);
}
return 0;
}
|
C | /* set.c -- Set routines for Khepera
* Created: Wed Nov 9 13:31:24 1994 by faith@dict.org
* Copyright 1994-1997, 2002 Rickard E. Faith (faith@dict.org)
* Copyright 2002-2008 Aleksey Cheusov (vle@gmx.net)
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and assoc... |
C | /*
Reverse bits of a given 32 bits unsigned integer.
Input: 00000010100101000001111010011100
Output: 00111001011110000010100101000000
Explanation: The input binary string 00000010100101000001111010011100 represents the unsigned integer 43261596,
so return 964176192 which its binary representation is 00111001011110000... |
C | #include<stdio.h>
int main(){
int x;
printf("Which subjects did you pass\n");
printf("if passed maths enter the value 1\n");
printf("if passed science enter the value 2\n");
printf("if passed maths and science enter the value 3\n");
scanf("%d",&x);
if (x==1){
printf("You won 15 rupe... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct _gruppo
{
char* principale;
char** stringhe;
int nStringhe;
} gruppo;
int OrdinaCaratteri(const void* a, const void* b)
{
char uno[2];
char due[2];
uno[0] = *((char*) a);
due[0] = *((char*) b);
uno[1] = '\0'; due[1] = '\0';
return str... |
C | #include <stdio.h>
#include <dirent.h>
#include <string.h>
#include <sys/types.h>
#define LEN 256
int dir_tree(const char *path, int n)
{
int i;
struct dirent *dir;
char sub_dir[LEN];
DIR *dirp;
dirp = opendir(path);
if (dirp == NULL)
{
printf("path:%s\n", path);
perror("opendir failed");
return -1;
}
... |
C |
/*
GaussianBlurMatrixGen: generate Gaussian Matrix[nxn] by given standard deviation(σ) and radius(r), (n = 2 * r + 1)
Gaussian distribution formula in two-dimensions: G(x, y) = 1 * (e ^ (-(x*x + y*y) / (2 * σ * σ))) / (2 * pi * σ * σ)
Gaussian distribution formula in one-dimensions: G(x) = 1 * (e ^ (-(x*x) / (2 * σ... |
C | #include <stdio.h>
#include <math.h>
int main()
{
int x,y,m,n,a,b,xAB,yAB,xBC,yBC,xCA,yCA,AB_BC,BC_CA,CA_AB;
printf("Пожалуйста, введите координаты вершин треугольника АBC через пробел:\n");
printf ("A = ");
scanf("%d %d",&x,&y);
printf ("B = ");
scanf("%d %d",&m,&n);
printf ("C = ");
scanf("%d %d",&a,&b);
xA... |
C | /*******************************************************************************
Summary:
Command line program for printing VideoCore log messages
or assertion logs messages
Licensing:
Copyright (c) 2022, Joanna Rousseau - Raspberry Pi Ltd All rights reserved.
******************************************... |
C | #include <stdio.h>
int main(void) {
int n, a, b, sum, t, ans = 0;
scanf("%d %d %d", &n, &a, &b);
for(int i = 1; i <= n; i++){
t = i;
sum = 0;
while(t > 0){
sum += t % 10;
t /= 10;
}
if(a <= sum && sum <= b) {
ans += i;
}
... |
C | #include<stdio.h>
int main()
{
int i,a[10],len,element,pos;
printf("Program to insert element into array:");
/*inputting the array*/
printf("\nEnter the size of the array:");
scanf("%d",&len);
for(i=0;i<len;i++)
{
printf("Enter the element:");
scanf("%d",&a[i]);
}
/*inserting the elem... |
C | #include <stdio.h>
#include <math.h>
int main()
{
int num = 1;
while (num != 0)
{
printf("num = ? (0 : 종료) : ");
scanf("%d", &num);
if (num < 0)
{
// 음수면 continue 수행, 루프의 선두로 복귀
printf("num : Negative number ! \n\n");
continue;
}
printf("Squareroot of %d = %f \n\n", num, ... |
C | #include <stdio.h>
#include <sys/time.h>
#include <math.h>
#include "micromouse.h"
#include "position.h"
/**
* i_pos, i_vel, i_acc: initial position, velocity and acceleration
* status: the micromouse data
*/
void init_pos(Vec3 i_pos, Vec3 i_vel, Vec3 i_acc,
Vec3 i_ang, Vec3 i_ang_vel, Vec3 i_ang_ac... |
C | #include "dctime.h"
uint8_t time_is_leap_year(struct tm* tm){
uint16_t year = tm->tm_year + 1900;
if ((year % 400) == 0){
return 1; //Exactly divisible by 400
}
else if ((year % 100) == 0){
return 0; //Exactly divisible by 100, but not 400
}
else if ((year % 4) == 0){
return 1; //Exactly divisi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.