language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | //
// main.c
// challenge_2
//
// Created by Alessandro Narciso on 2019-03-16.
// Copyright © 2019 Alessandro Narciso. All rights reserved.
//
//Harder challenge: only if one or more of the numbers are prime, swap the places
//{100,17,25,3,1,80,50,2,79,62}
//{comp, prime, comp, prime, comp, comp, comp, prime, prim... |
C | #ifndef READ_FROM_CONFIG_H
#define READ_FROM_CONFIG_H
#define MAXSTR 500
/**
* Structure defining configuration variables.
*
* */
typedef struct {
unsigned int xdim;
unsigned int ydim;
unsigned int nzombies;
unsigned int nhumans;
unsigned int nzplayers;
unsigned int nhplayers;
... |
C | #include<stdio.h>
#include<conio.h>
void main()
{
int i,size,a[50],num,pos;
clrscr();
printf("Enter the size");
scanf("%d",&size);
printf("enter element of array");
for(i=0;i<size;i++)
scanf("%d",&a[i]);
printf("enetr the position");
scanf("%d",&pos);
printf("enter the number");
scanf("%d",&num);
if(pos<=0||pos>size+1)... |
C | //ģƥ㷨
#define N 10; //Ʒ
#define K 25; //ά
double LeastDistance()
{
double min=10000000000;
number_no number_no;
for(int n=0;n<N;n++)
{
for(int i=0;i<pattern[n].number;i++)
{
if(match(pattern[n].feature[i],testsample)<min)
{
//ƥСֵ
min=match(pattern[n].feature[i],testsample);
number_no.nu... |
C | #include <stdio.h>
#include <stdlib.h>
typedef int T;
int cmpInt(T a, T b) { return a < b; }
int cmp(const void *a,const void *b){
return *(int*)a - *(int*)b;
}
void quickSort(T *array, int (*compare)(T a, T b), int l, int r) {
int i, j;
T mid;
if (r - l < 2) return;
for (i = l, j = r - 1, mid = ar... |
C | #include <stdio.h>
#include <math.h>
int main()
{
int N, K;
double ans = 0.0;
scanf("%d%d", &N, &K);
// 確率計算
for (int i = 1; i <= N; i++) {
double tmp = 1/N; // その目が出る確率
int num = i;
// 勝つまでのループ
while (num<K)
{
num *= 2;
tmp /= 2;
... |
C | #include <stdio.h>
#include <stdlib.h>
/*
Exercise 1-8 Write a program to count blanks, tabs, and new lines.
*/
int main()
{
int c, nl, space, tab;
nl = 0;
space = 0;
tab = 0;
while ((c = getchar()) != EOF){
if(c == '\n'){
++nl;
}
if(c == ' '){
++sp... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
char command[1024];
if (argc != 2)
{
fprintf(stderr, "Usage: %s <filename>\n", argv[0]);
exit(0);
}
sprintf(command,"stat %s",argv[1]);
system(command);
return 0;
} |
C | #include <stdio.h>
int sum(int n)
{
int s = 0;
if (n == 0)
return 0;
else
{
s = n % 10;
n = n / 10;
return s + sum(n);
}
}
int main()
{
int n, y;
printf("enter the number\n");
scanf("%d", &n);
y = sum(n);
printf("sum of digit is %d", y);
} |
C | #include <stdio.h>
int main(){
int x;
while(1){
scanf("%d",&x);
if(x==0) break;
printf("Number %d in hexadecimal is %X.\n",x,x);
}
return 0;
}
|
C | #include<stdio.h>
#include<stdlib.h>
#include<pthread.h>
void *threadFn(void* arg) {
pthread_detach(pthread_self());
sleep(1);
printf("Thread Fn\n");
pthread_exit(NULL);
}
int main(int argc, char** argv) {
pthread_t tid;
int ret = pthread_create(&tid, NULL, threadFn, NULL);
if (ret != 0) ... |
C | #include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include "error_handling.h"
#include "shared_memory.h"
#define PERMS 0666
static inline int shm_get(key_t key, size_t size) {
assert(size > 0);
int shm_id;
shm_id = shmget(key, size, IPC_CREAT | PERMS);
if (shm_id == -1) {
handle... |
C | // Do not remove #ifdef ... #endif before and after each function.
//
// They are used to test different functions in your program and give
// partial credits, in case your program does not work completely.
#include "student.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "msort.h"
void Studen... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
//todo delete fun
//todo opt the insert index, because it is now sorted-index ,result in that it is just like link list
static int cas_int_inc(int *addr,int delta){
int ret =0;
__asm__ __volatile__(
"lock;xaddl %2,%1;"
:"=a"(ret)
:"m"(*addr),"0"(del... |
C | #include <stdlib.h>
#include <stdio.h>
#include <wiringPi.h>
#include <wiringPiI2C.h>
#include <pthread.h>
#include <unistd.h>
#include "Accelerometer.h"
struct Accelerometer {
void* userData;
void (*callback)(void*);
/*private*/ pthread_t thread;
/*private*/ int fd;
};
typedef struct Accelerometer Ac... |
C | #include "common.h"
struct spng_decomp
{
unsigned char *buf; /* input buffer */
size_t size; /* input buffer size */
char *out; /* output buffer */
size_t decomp_size; /* decompressed data size */
size_t decomp_alloc_size; /* actual buffer size */
size_t initial_size; /* initial value for dec... |
C | #include "MenuLCD.h"
void InitMenu()
{
m[0].down = &m[1];
m[0].right = &m1[0];
// 2
m[1].up = &m[0];
m[1].right = &m2[0];
m[1].down = &m[2];
// 3
m[2].up = &m[1];
m[2].right = &m3[0];
m[2].down = &m[3];
// 4
m[3].up = &m[2];
m[3].right = &m4[0];
m[3].down = &m[4];
// 5
m[4].... |
C | #include<stdio.h>
int main()
{
int a[3][4]={1,2,3,4,5,6,7,8,9,0,1,2};
display(a,3,4);
}
void display(int (*q)[4],int r,int c)
{
int i,j,*p;
for(i=0;i<r;i++)
{
p=(q+i);
for(j=0;j<c;j++)
{
printf("%d ", *(p+j));
}
printf("\n");
}
}
|
C | #include<stdio.h>
struct nikhil
{
int i;
} fuck;
int main()
{
int j;
printf("%d\n",fuck.i);
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <locale.h>
typedef struct data_{
int dia, mes, ano;
} data;
typedef struct hora_{
int hora, min;
} hora;
typedef struct compromisso_{
data d;
hora h;
char desc[50];
} compromisso;
int main()
{
setlocale(LC_ALL, "Portuguese");
... |
C | /*
** EPITECH PROJECT, 2020
** NWP_myteams_2019
** File description:
** tools
*/
#include "command.h"
int isquoted(lklist_char_t *ll)
{
int q = 0;
if (ll->size(ll) >= 2) {
for (size_t i = 0; i != ll->size(ll); i += 1) {
if (ll->at(ll, i) == '"')
q++;
}
if (... |
C | /* $OpenBSD: line.c,v 1.63 2021/03/01 10:51:14 lum Exp $ */
/* This file is in the public domain. */
/*
* Text line handling.
*
* The functions in this file are a general set of line management
* utilities. They are the only routines that touch the text. They
* also touch the buffer and window structures to mak... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strsplit.c :+: :+: :+: ... |
C | #include <stdio.h>
#include "myMath.h"
int main(){
double var;
printf("please enter a number\n");
scanf("%lf",&var );
double eToThex = Exponent(var);
double xToThe3 = Power(var, 3);
float fx1Add = add(eToThex, xToThe3);
float fx1 = sub(fx1Add, 2);
double x3 = mul(3, var);
double x2ToThe2 = mul(2,... |
C |
//Definition for singly-linked list.
struct ListNode
{
int val;
struct ListNode *next;
};
struct ListNode *reverseList(struct ListNode *head)
{
if (!head || !head->next)
return head;
struct ListNode *res = reverseList(head->next);
head->next->next = head;
head->next = 0;
return res;
}
void reorderList(struc... |
C | #include <stdio.h>
#include <cs50.h>
#include <math.h>
int main(void){
float change;
int coins = 0;
do {
printf("How much change do I owe you?\n");
change = GetFloat();
}
while(change < 0);
float c = change * 100;
c = round(c);
float cents = (float) c;
w... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* pipe.c :+: :+: :+: ... |
C | // C program to demonstrate the use of calloc()
// and malloc()
#include <stdio.h>
#include <stdlib.h>
int main()
{
int* arr;
// malloc() allocate the memory for 5 integers
// containing garbage values
// void* malloc(size_t size);
arr = (int*)malloc(5 * sizeof(int)); // 5*4bytes = 2... |
C | #include <poll.h>
#include "event.h"
// select specific
int maxfd = FD_SETSIZE;
typedef struct select_fds {
struct pollfd *fdarray;
} select_fds;
static void select_free_event(select_fds *api_state);
int select_create_event(eventloop *ep)
{
struct select_fds *main_fds = malloc(sizeof(select_fds));
if (main_fds... |
C | /* host_1 */
/******************************************************************
* Remote Shell - Server Program *
*
******************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#i... |
C | #include "stdio.h"
#include "stdlib.h"
int main(int argc, char const *argv[]) {
FILE *fd = fopen(argv[1], "rb");
if(fd)
{
fseek(fd, 0, SEEK_END);
size_t len = ftell(fd);
fseek(fd, 0, SEEK_SET);
char *data = malloc(len * sizeof(c... |
C | /*
** EPITECH PROJECT, 2019
** 106bombyx_2018
** File description:
** display the usage
*/
#include "./../include/bombyx.h"
void disp_usage(void)
{
my_putstr("USAGE\n");
my_putstr(" ./106bombyx n [k | i0 i1]\n\n");
my_putstr("DESCRIPTION\n");
my_putstr(" n number of first generation indi... |
C | #include <ansi.h>
/******************************************************************************
* Program: vitality.c
* Path: /players/dragnar/SevenSpires/scrolls
* Type: Object
* Created: June 30th, 2015 by Dragnar
*
* Purpose: One of the scrolls in the Seven Spires area that give temporary
* powers ... |
C | #include<stdio.h>
#define X 4
int main(void)
{
int i,j;
double mx1[X][X],mx2[X][X],mx3[X][X];
printf("Please input first matrix.\n");
for(j=0;j<X;j++)
{
for(i=0;i<X;i++)
{
printf("Please input component[ %d %d ].\n",j+1,i+1);
scanf("%lf",&mx1[j][i]);
}
}
printf("Please input second... |
C | #include <stdio.h>
#include <locale.h>
#include "MyLib.h"
#include <Windows.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
void First(){
fflush(stdin);
int *Matrix;
int n,m;
printf(" - - \n");
scanf("%d%d",&n,&m);
Matrix = (int*)malloc(n*m * sizeof(int));
printf(" (1) (2)?... |
C | #include <stdio.h>
#include <stdlib.h>
/*
QUESTAO
Implemente um algoritmo RECURSIVO que LEIA um vetor de inteiros
com n posições (n definido pelo usuário). Após o usuário
inserir elementos no vetor, o algoritmo deve imprimir os
números armazenados na última até a primeira posição do vetor.
*/
/* PROTOTYPES */
int... |
C | #include <stdio.h>
#include <time.h>
#include <stdlib.h>
int main(void){
int n;
srand((unsigned)time(NULL));
n = rand() % 100 + 1;
printf("数値:%d\n", n);
if(n >= 20 && n < 80){
printf("20以上80未満です\n");
}else{
printf("20未満か、80以上です\n");
}
} |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
int main(int argc, char* argv[]) {
int sockfd;
char buffer[1024];
char *hello = "Hello messag... |
C | #include <stdio.h>
int main(){
int ec[3][2], pendiente = 0;
for(int i = 0; i<2; i++){
for(int j = 0; j<2; j++){
if(j==0){
printf("\nIntroduzca el valor de X%d: ", (i+1));
}else{
printf("\nIntroduzca el valor de Y%d: ", (i+1));
}
... |
C | #include "holberton.h"
/**
* print_binary - prints binary representation of num
* @n: value to print
*
* Return: void
*/
void print_binary(unsigned long int n)
{
unsigned long int x;
unsigned long int r;
unsigned long int l;
short int switch_on = 0;
unsigned long int size;
size = sizeof(unsigned long int) *... |
C | #include "key.h"
#include "delay.h"
#include "pin_def.h"
#include "stm32f10x.h"
#include <string.h>
void key_init(void) {
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1 | (GPIO_Pin_8 - GPIO_Pin_3);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = ... |
C | class Base {
public:
Base() : i_() {}
virtual void increment(long v) { i_ += v; }
private:
long i_;
};
template <typename T>
class Derived : public Base {
public:
Derived() : Base(), j_() {}
void increment(long v) { j_ += v; Base::increment(v); }
// This does not compile even though... |
C | /**
* @file Element.h
* @brief Fichier d'entête du module \em Element.
*
* @author Alexis BRENON
*/
#ifndef __ELEMENT_H__
#define __ELEMENT_H__
/**
* @typedef Key
* @brief Une clé est un pointeur sur n'importe quel type.
* Seule la fonction de hachage devra savoir de quel type elle est.
*/
typedef v... |
C | #include <stdlib.h>
#include <stdio.h>
struct produto {
int codP;
float valor;
struct produto *proxP;
};
typedef struct produto *structP;
struct cliente {
int codC;
struct produto *prod;
struct cliente *proxC;
};
typedef struct cliente *structC;
void chegada();
void listarProd();
void consumo();
float saida();
void fec... |
C | #include"jitendra.h"
#include"prototype.h"
int bsort()
{
printf("In %s\n",__func__);
int i,a[100],n,temp,j;
printf("enter the number of aray\n");
scanf("%d",&n);
printf("ente the aray\n");
for(i = 0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i =0;i<n-1;i++)
{
for(j=0;j<n-1;j++)
{
if (a[j]> a[j+1])
... |
C | #include "queue_circular_headers.h"
static struct node *getnode() {
struct node *ptr = calloc(1, sizeof(struct node));
printf("enter node data:");
scanf("%d", &ptr->data);
return ptr;
}
/*
int createQueue(struct queue **q, unsigned int len)
{
struct node *last = NULL;
struct node *p;
int i;
if (q == NULL || ... |
C | #include "main.h"
/**
* _isupper - Check if a letter is upper
* @i: The number to be checked
*
* Return: 1 for upper letter or 0 for any else
*/
int _isupper(int i)
{
if (i >= 65 && i <= 90)
{
return (1);
}
return (0);
}
|
C | #include<stdio.h>
void main()
{
int n;
printf("Enter the number :");
scanf("%d",&n);
for(int i=1; i<n;i++)
{
for (int j=1; j<=n; j++)
{
printf("*");
}
printf("\n");
}
} |
C | #include <string.h>
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include "misc.h"
typedef struct {
int start;
int end;
} interval;
// make the last pair sorted first, and recur ahead and left pairs
static int partitionSort(interval * nums, int low, int high)
{
interval temp;
int j = low;
// max... |
C | /************************************************************************/
/* */
/* Interface file for a BINARY_TREE ADT */
/* */
/* Refer to lect... |
C | // Linked List : insert_at_begin: returning single pointer
#include <stdio.h>
#include <stdlib.h>
typedef struct node
{
int data;
struct node *next;
}node_t;
void display(node_t *head)
{
}
//void insert_at_begin(node_t **p_head, int value)
node_t *insert_at_begin(node_t *head, int value)
{
node_t *p_newnode;... |
C | /*
* File: sjf.c
* Author: Stephen Sampson
* Purpose: This file contains the shortest job first module to serve HTTP
* requests.
*/
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/sendfile.h>
#include <sys/stat.h>
#include <string.h>
#i... |
C | /*
* Copyright (c) 2017, Jack Lange <jacklange@cs.pitt.edu>
* All rights reserved.
*
* This is free software. You are permitted to use,
* redistribute, and modify it as specified in the file "PETLAB_LICENSE".
*/
#include <limits.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include "pet_jso... |
C | /***************************************
* EECS2031ON – Lab3 *
* Author: Chung, Chun-Kit *
* Email: chunkit@my.yorku.ca *
* eecs_username: chunkit*
* York Student #: 217125329
****************************************/
#include <stdio.h>
#define MAX_SIZE 21
int length(char[]);
int indexOf(char[], char);
int occurrence(... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* export_build_in.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <errno.h>
#include <signal.h>
#include <stdarg.h>
#include <sys/socket.h>
#include <netinet/in.h> // sockaddr_in
#include <arpa/inet.h> // htons
#define TOTALCLIENTS 10
#define MESSAGESSIZE 100
#define SMALLM... |
C | #include <stdio.h>
#include <stdlib.h>
/* Function to sort elements */
int cmpint(const void *a, const void *b) {
/* explicit type cast to pointers to integers */
return ( *(int*)a - *(int*)b );
}
int main() {
int values[] = { 88, 56, 100, 2, 25 };
printf("De array voor sorteren: \n");
for (int... |
C | #include "../library/commonUtils/arrayOperations.h"
#include "../library/stack.h"
#include <ctype.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
double convertStringToNumber(char* string, int* firstDigitIndex)
{
int i = *firstDigitIndex;
double number = 0;
for (; isdigit... |
C | #include "template.h"
uint8_t newTxDataAvaliable = 0; // flag to DLL interface, set buy USER to '1' when has some data to send (after newTxData has been set), set automaticly by Interface to '0' after sent.
uint8_t newTxData = 0; // hold data to send to Phy, (relevant only when "newTxDataAvaliable" == 1), set by USER.... |
C | /*
author: Alice Francener
problem: Extremely Basic
url: https://www.urionlinejudge.com.br/judge/en/problems/view/1001
*/
#include<stdio.h>
int main(){
int a, b, x;
scanf("%d %d",&a,&b);
x=a+b;
printf("X = %d\n",x);
return 0;
} |
C | /****************************************************************************
** FILE: assignment.c
** AUTHOR: Brendan Lally
** STUDENT ID: 18407220
** UNIT: Computer Communication (CNCO2000)
** PURPOSE: Contains implementations of the Application, Network and Datalink
layers for a simulated network in cn... |
C | /*
=====================================================================================================================================
Name : MatrixMultiplication3S.c
Author : Antonio Tino & Giacomo Astarita
Version : 2.0
Description : Bisogna effettuare il calcolo del prodotto C = A x B con A[m]... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "process.h"
/*
A method that mix two sounds together with sound weights correspond to the sound array.
Returns a single finished mixed sound structs.
*/
sound* mix(sound *s[],float w[], int c){
int longestLength = 0;
float rate = 0;
... |
C | #include "aircraft.h"
int aircraft_get_size(aircraft_linked_list * head){
int size = 1;
while(head->next != NULL){
head = head->next;
size++;
}
return size;
}
void aircraft_add_new(aircraft_linked_list ** head, aircraft_template new_aircraft, int pos_x, int pos_y){
airc... |
C | #include <stdio.h>
int main(void)
{
int num1 = 1,num2 = 2,asd = 0;
int sum = 2;
printf("߂̓1,2ƂA\n");
for (int i = 1; ; i++)
{
asd += num1 + num2;
if (asd%2 == 0)
{
sum += asd;
}
printf("%d %d %d\n",asd,num1,num2);
... |
C | /**** globals defined in main.c file ****/
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ext2fs/ext2_fs.h>
#include "type.h"
extern MINODE minode[NMINODE];
extern MINODE *root;
extern PROC proc[NPROC], *running;
extern char gpath[256];
extern char *name[64];
extern int n;... |
C | #include <stdio.h>
void main10()
{
int i;
for(i=10; i>=1; i--)
printf("%d\n", i);
getch();
} |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "plateau.h"
#include "coup.h"
#include "caractereEnEntier.h"
#include <stdio.h>
void OTH_affichagePlateau(PL_Plateau plateau)
{
int x,y;
printf(" abcdefgh ");
printf("\n");
printf(" +--------+");
printf("\n");
for (y = 1; y... |
C | #include<stdio.h>
#include<stdlib.h>
struct stu *ptr,*buff;
//#include"search.c"
//int *buff,*ptr;
struct stu{
char name[25];
char gen;
int rolno;
float hei;
char grade;
};
main(){
ptr=(struct stu *)malloc(1*sizeof(struct stu));
int i,n;
printf("\nenter how many students:");scanf("%d",&n);
ptr=(struct stu *)r... |
C | //using an array
//for decade counter
#include <avr/io.h>
#include <util/delay.h>
#include "sevenseg.h"
void sevenseg(int);
int main (void)
{
//defining integer array p
const int p[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
int i;
DDRD |= 0xFC;
//set 0 as output pin
DDRB |= ((1 << DDB0));
while (1)
{
... |
C | //
// Created by zhaomengz on 26/4/17.
//
#ifndef BIN_LINKEDLIST_H
#define BIN_LINKEDLIST_H
#include <stddef.h>
typedef struct list_node_t {
struct list_node_t* prev;
struct list_node_t* next;
} list_node_t;
#define container_of(ptr, type, member) \
(type*)((char*)(ptr)-offsetof(type, member))
#define ... |
C | #include <stdio.h>
#define ARRAY_SIZE(array) (sizeof(array) / sizeof(*array))
typedef struct {
int day;
int month;
} Date;
typedef struct {
char *name;
Date startDate;
Date endDate;
} ZodiacSign;
const ZodiacSign ZODIAC_SIGNS[] = {
{"Koziorożec", {1, 1}, {19, 1}},
{"Baran", {21, 3}, {19, 4}},
{"Byk", {20, 4}... |
C | #include <iostream>
int main(void)
{
double salary, netSalary;
int etype, otHrs, otRate;
bool x = true;
std::cout << "Enter Emp Type : ";
std::cin >> etype;
std::cout << "Enter Salary : ";
std::cin >> salary;
std::cout << "Enter OtHrs : ";
std::cin >> otHrs;
while(x)
{
x = true;
switch (etype)
{
cas... |
C | #include <stdio.h>
int main()
{
int sum=0, n;
float average=0.0;
printf("Input a 10 numbers: \n");
for(int i=1; i<=10; i++)
{
printf("Number-%d: ", i); ///gets the 10 inputted numbers
scanf("%d",&n);
sum+=n; /// sum = sum + n
}
average = sum/10.0; /// fo... |
C | /*
* Inputs.h
*
* Created on: Aug 13, 2013
* Author: Ryan
*/
#ifndef INPUTS_H_
#define INPUTS_H_
#include <Bounce.h>
#include <Encoder.h>
#include "PinDefinitions.h"
struct InputValues
{
bool mBlueButton;
bool mPinkButton;
bool mGreenButton;
bool mYellowButton;
bool mSwitch0;
boo... |
C | /**********************
*** CstFile.c ***
**********************/
#include <stdio.h>
#include "CstType.h"
void
cst_read( FILE *fp, cst_type *cst, int byte_no )
{
int no;
cst_realloc( cst, byte_no );
// cst->byte_no = fread( cst->data, 1, byte_no, fp );
no = fread( cst->data, 1, byte_no, fp );
cst->rp = ... |
C | #include <stdio.h>
#define N 8
void show(int a[]);
int quickpass(int a[],int i,int j);
void quicksort(int a[],int low,int high);
int main(void)
{
int a[N] = {50,36,66,76,36,12,25,95};
printf("原无序记录如下:\n");
show(a);
printf("排序过程如下:\n");
quicksort(a,0,N-1);
return 0;
}
//一趟快速... |
C | /* ************************************************************************** */
/* */
/* :::::::: */
/* get_next_line.c :+: :+: ... |
C | #include <unistd.h>
// ASCII code for ESC key
#define ESC 27
int main(){
char buffer[2];
while(read(0, buffer, 1)){
write(1, buffer, 1);
if(buffer[0] == '.') // terminate the processe once '.' is encountered !
break;
}
return 0;
} |
C | /*包含头文件*/
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
/*类型定义*/
typedef int DataType;
typedef struct Node {
DataType data;
struct Node* prior;
struct Node* next;
} DListNode, *DLinkList;
/*函数声明*/
void PrintDList(DLinkList head);
int InsertDList(DLinkList head, int i, char e);
/*函数实现*/
int InitDL... |
C | #include "generate_2d_curves.h"
#include "common_math.h"
bool generateCircleCurve(Point2D* pCurve, const size_t circlePointsCount, const Point2D* pInitialPoints, const size_t initialPointsCount, const double pointsDistance)
{
if (howManyPointsForCircleCurve(pInitialPoints, initialPointsCount, pointsDistance) != ci... |
C | /*******************************************************************************
* FILE NAME : client.c
*
* DESCRIPTION : contains main routine for client
*
* DATE NAME REFERENCE REASON
* 20-Dec-2010 Mohd Sadique PRISM PROJECT Initial Creation
*
/**************... |
C | #include <stdio.h>
int main()
{
int c,m,n;
printf("Enter the range of the nos :\n");
scanf("%d%d",&m,&n);
while(m<=n)
{
if(m%2==0)
printf("%d\n",m);
m=m+1;
}
return 0;
}
|
C | //cross-process communication
#include <signal.h>
#include <stdio.h>
#include <stddef.h>
#include <fcntl.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <termio.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <python3.7/Python.h>
int Actuator;
int Sensor;
char sensor... |
C | /*
* =====================================================================================
*
* Filename: fileutility.h
*
* Description:
*
* Version: 1.0
* Created: 2012年02月17日 19时24分04秒
* Revision: none
* Compiler: gcc
*
*
* ========================================... |
C | #include<stdio.h>
void main()
int num;
printf("Է: ");
scanf("%d", &num);
// if else ִ if() ̸ elseif Ȯ
// ʰ ü if elseif ´.
// if elseif ߺ ʾƾ ϸ ߺ ʴ
// if elseif Ͽ single if ۼϴ ͺ
// ʿ üũϴ ɾ ִ.
if(num<0){
printf("Է 0 ۴. \n");
}
else if(num>0){
printf("Է 0 ũ. \n");
}
else if(num==0){
prin... |
C | /*
** EPITECH PROJECT, 2020
** my_find_prime_sup.c
** File description:
** 02/10/2020
*/
#include "my.h"
char *my_array_nbr(int nb, int size, char *buffer)
{
int comm = 0;
memset(buffer, '0', size - 1);
buffer[size] = '\0';
if (buffer) {
for (int i = 0; nb && size; i++, size--) {
... |
C | /*
* consolaLoca.c
*
* Created on: 03/07/2014
* Author: utnso
*/
#include "consolaLoca.h"
void consolaLoca(void) {
puts(
"\nSE INICIO LA CONSOLA. ESCRIBA ALGUN COMANDO, USANDO ESPACIO PARA CADA PARAMETRO.\n");
while (1) {
puts(
"\nOPERACIONES VALIDAS:\n********** grabar PID BASE INICIO TEMPLAT... |
C | /*
** EPITECH PROJECT, 2017
** My_rpg
** File description:
** choose_player_name.c
*/
#include "character.h"
/*
** This fct create and init a new text by creating the font and
** setting the size. The string taken as parameter is the string displayed
** by the sfText
** return value sfText * or NULL
*/
static sfText... |
C | #include <stdio.h>
int main()
{
char text[10];
int i,alpha=0,num=0,sc=0;
for(i=0;i<10;i++)
{
scanf("%c", &text[i]);
}
for(i=0;i<10;i++)
{
if((text[i] >= 'a' && text[i] <= 'z') || (text[i] >= 'A' && text[i] <= 'Z'))
{
alpha=alpha++;
}
else if(text[i] >= '0' && text[i] <= '... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* pipe.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<math.h>
#define LI long int
int main()
{
int arr[10005];
LI low, high;
LI i, j, k;
LI maxi;
double rootd;
LI rooti[10005];
int time;
scanf("%d", &time);
while(time--)
{
scanf("%ld %ld", &low, &high);
for(i = low; i <=... |
C | /* Program 2_2.c Toggle Green LED (LD2) on STM32F446RE Nucleo64 using SysTick
*
* This program uses SysTick to generate 500 ms delay to
* toggle the LED. System clock is running at 16 MHz.
* SysTick is configure to count down from 3199999 to zero
* to give a 500 ms delay.
* Created on: 11/8/2021
* Author: SUNIL ... |
C | #include <stdio.h>
int main() {
int testCases;
scanf("%i", &testCases);
int i;
for (i = 0; i < testCases; i++) {
int numberOfFeedbacks;
scanf("%i", &numberOfFeedbacks);
int j;
int feedbackCode;
for(j = 0; j < numberOfFeedbacks; j++) {
scanf("%i", &fee... |
C | /* Write a function that takes three arguments: a character
* and two integers. The character is to be printed. The first
* integer specifies the number of times that the character
* is to be printed on a line, and the second integer specifies
* the number of lines that are to be printed. Write a program
* that ma... |
C | unsigned int h[26],n;
int go(int maxh,int cp)
{
int x,y,max;
while(h[cp]>maxh)cp=cp+1;
if(h[cp]==0)return 0;
x=go(maxh,cp+1);
maxh=h[cp];
y=1+go(maxh,cp+1);
max=(x>y)?x:y;
return max;
}
int main()
{
unsigned int i,c,t;
scanf("%d",&n);
for(i=0;i<n;i++)scanf("%d",&h[i]);
h[n]=0;
t=go(65535,... |
C | /*
* Project name:
C_math (Demonstration of using C Math Library)
* Copyright:
(c) Mikroelektronika, 2008.
* Revision History:
20080110:
- initial release;
* Description:
This program demonstrates usage of standard C math library routines.
Compile and run the code t... |
C | #include <stdio.h>
int main(void)
{
float balance, rate, monthly_rate, interest, payment;
printf("Enter amount of loan: ");
scanf("%f", &balance);
printf("Enter interest rate: ");
scanf("%f", &rate);
printf("Enter monthly payment: ");
scanf("%f", &payment);
monthly_rate = (rate * 0.01f) / 12.0;
i... |
C | #include <stdio.h>
#include <sqlite3.h>
#include <stdlib.h>
#include <string.h>
#include "../address.h"
char c_database_name[32] = {0};
/**********************
1、创建数据库文件
2、创建保存联系人信息的表
**********************/
void InitDataBase()
{
sqlite3 *ppdb; //数据库句柄
int ret = sqlite3_open("address.db", &ppdb);
if (r... |
C | #include <stdio.h>
#include <stdlib.h>
int main() {
int i, c;
c = 0;
for (i = 1; i < 1000; i++) {
if(i % 3 == 0 || i % 5 == 0) {
c = c + i;
printf ("num: %i\n",i);
}
}
printf ("%i\n", c);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.