language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
#include <stdlib.h>
int main()
{int x,y,c,a;
for(x=1;x<=6;++x){
for(y=1;y<=6,y<=x,y!=x;++y){
for(c=1;c<=6,c<=y,c!=y;++c){
for(a=1;a<=6,a<=c,a!=x,a!=y,a!=c;++a){
}
printf("\n %d%d%d%d",x,y,c,a);
}
printf("\n");... |
C | #include <stdio.h>
#include <math.h>
int main(){
double x,y;
printf("Enter a number");
scanf("%lf",&x);
y=sqrt(x);
printf("squart root of a number=%lf",y);
} |
C | // pow function demo program
#include <stdio.h>
#include <math.h> // Files can be included in any order
main()
{
printf("%g \n" , pow(2 , 3)); // 8
printf("%g \n" , pow(-2 , -3)); // -2 ^ -3
printf("%g \n" , pow(10 , -2)); // 10 ^ -2 = 0.01
printf("%g \n" , pow(2 , pow(3 , 2))); // 2 ^ 3 ^ 2... |
C | #include <stdio.h>
#include <stdlib.h>
#include <mpi.h>
#include <math.h>
int main(argc, argv)
int argc;
char* argv[];
{
int myid, numprocs;
MPI_Init(&argc, &argv);
MPI_Comm_size(MPI_COMM_WORLD, &numprocs);
MPI_Comm_rank(MPI_COMM_WORLD, &myid);
struct {
int intRank;
double doubleRank;
} newStruct;
in... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
void agendador();
void agendar_por_horario();
void agendar_por_hora_restante();
void cancela();
int main(int argc, char *argv[]) {
int opc... |
C | /* Software to print out version and implementation information */
#include <spr-defs.h>
#include "mor1kx-defs.h"
#include "printf.h"
#include "cpu-utils.h"
int main(void)
{
unsigned long reg;
printf("mor1kx version check software\n");
// Check if we have the AVR
reg = mfspr(SPR_CPUCFGR);
if (reg & S... |
C | #include<omp.h>
#include<stdio.h>
main()
{
int x,y,z,tid;
x=3;y=5,z=4;
#pragma omp parallel firstprivate(x,y) private(z,tid)
{
tid=omp_get_thread_num();
printf("A : In thread %d : (x,y,z)=(%d,%d,%d).\n",tid,x,y,z);
++x; ++y; ++z;
printf("B : In thread %d : (x,y,z)=(%d,%d,%d).\n",tid,x,y,z);
}
}
|
C | /*
* sequence.c
*
* Created: 25/04/2018 18:58:38
* Author: Dima
*/
#include "sequence.h"
struct sequence
{
int current_index; // current index of the sequence
int *random_pattern; // an array of integers to be filled up with random numbers
};
sequence_t sequence_create()
{
sequence_t seq = (sequence_t)mall... |
C | #include <stdio.h>
#include <stdlib.h>
struct TreeNode {
int val;
struct TreeNode *left;
struct TreeNode *right;
};
struct ListNode {
int val;
struct ListNode *next;
};
int main()
{
return 0;
}
struct ListNode* removeElements(struct ListNode* head, int val) {
struct ListNode* q = (struct L... |
C | #include "mygrep.h"
/**
* This function interprets grep patterns
* @return 0 if successful, -1 otherwise
**/
int mypattern(char * pattern, char * patfile){
if (pattern[0]=='\0'){
if (patfile[0]=='\0'){
printf("Invalid usage\n");
return -1;}
FILE *file = fopen(patfile, "r");
if(file !=NULL) {
patte... |
C | #include <stdio.h>
#include <stdlib.h>
#include <drinkmachine.h>
#include <stdbool.h>
//I created this drinkMachineDriver file separately from drinkmachine.c or drinkmachine.h, so there will be a lot overlaps.
//So dear grader, you only need to read this file and my drinkmachine.h
//Thanks for your hard work.
DrinkMa... |
C | /*
A program to implement vigenere's cipher.
It take the keyword as an cmd line arg and plaintext from user
and process it to print a scrambled version of plain text.
*/
#include <D:\CS50\cs50.h>
#include <stdio.h>
#include <ctype.h>
int main(int argc, string argv[]) //int main(int argc, strin... |
C | /*---------------------------------------------------------------------------
|
| Evaluates unary, binary and ternary arithmetic and logical expressions
|
| See 'C:\SPJ1\swr\tiny1\TOS1 Guide rev.nn.pdf'
|
|--------------------------------------------------------------------------*/
#include "common.h"
#include "wo... |
C | void addDays(char *date,int days,char *newDate)
{
int d1,m1,y1,d2,m2,y2;
int j1,x,j2,k;
splitDate(date,&y1,&m1,&d1);
j1=julian(d1,m1,y1);
x= isLeap(y1) ? 366-j1 : 365-j1;
if(days<=x)
{
j2=j1+days;
y2=y1;
}
else
{
days=days-x;
y2=y2+1;
k=isLeap(y2) ? 366 :365;
while(days>=k)
{
if(isLeap(y2)... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <semaphore.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <pthread.h>
#define BUFFSIZE 1024
#define NBUFF 8
struct {
struct {
char data[BUFFSIZE];
ssize_t n;
} buff[NBUFF];
... |
C | //
// This file was generated by the Retargetable Decompiler
// Website: https://retdec.com
//
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
// ------------------- Function Prototypes --------------------
int32_t __divdi3(void);
int32_t __udivdi3(void);
int32_t abs32(int32_t a1);
int32_t abs64(int32_t ... |
C | #include "menger.h"
/**
* menger - draws a 2D Menger Sponge
* @level: is the level of the Menger Sponge to draw
*/
void menger(int level)
{
int row, column, size;
char Char;
size = pow(3, level);
for (row = 0; row < size; row++)
{
for (column = 0; column < size; column++)
{
Char = characters(row, colum... |
C | //
// Created by PetnaKanojo on 12/02/2018.
//
#include "mystd.h"
#include "trieTree.h"
#include "mylib.h"
/*************************************
Function: initTrieTreeNode
Description: init the smallest of a node in the trieTree
Input:
word: the character.
isWord: whether it is the end of a comple... |
C | #include <stdio.h>
#include <conio.h>
#include <string.h>
int main() {
char cadena[20]="-Hoy-es-lunes-.";
int longitud, i;
longitud = strlen(cadena); //longitud de la cadena
printf("\nPALABRA ALREVEZ: ");
for(i=longitud;i>=0;i--){
printf("%c",cadena[i]);
}
return 0;
}
|
C | #pragma warning(disable : 4996)
#include <stdio.h>
int main(void)
{
int a, b;
scanf_s("%d %d", &a, &b);
// 0 :
// 1 :
printf("%d %d", a && b, a || b);
} |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <dirent.h>
#include <curses.h>
#include <string.h>
#include <fcntl.h>
#include <ctype.h>
#include <sys/stat.h>
#include <sys/mman.h>
#define flechaArriba 0x1B5B41
#define flechaAbajo 0x1B5B42
#define flechaDerecha 0x1B5B43
#define flecha... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "ringbuffer.h"
/* retturn: 1-empty, 0-not empty */
int ringbuf_empty(struct ringbuffer *ringbuf)
{
if(ringbuf == NULL)
return -1;
return (ringbuf->len == 0 ? 1 : 0);
}
/* retturn: 1-full, 0-not full */
int ringbuf_full(struct ringbuffer *ring... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <unistd.h>
const char AsciiTableHeaderStr[] = " | CHAR | HEX | DEC | BINARY |";
const char AsciiTableHeaderSep[] = " +------+------+-----+----------+";
unsigned int AsciiTableHeaderStrLen =
sizeof(AsciiTableHeaderStr) /... |
C | #include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include<dirent.h>
#include<sys/wait.h>
#include<stdio.h>
#include<string.h>
//fungsi untuk mempersingkat fork
void eksekusi(char perintah[],char *arg[]){
int status;
pid_t child_id;
child_id=fork();
if(child_id==0){
... |
C | #include <stdio.h>
/* Գв汾2 */
int main(int argc, char *argv[])
{
while(--argc){
//printf("%s%s", *++argv, argc>1?" ":"\n");
printf(argc>1?"%s ":"%s\n", *++argv);
}
return 0;
}
|
C | //
// Created by AmFlint on 2/16/2020.
//
#include "strconv.h"
int* get_ascii_codes()
{
int start = 48, i = 0;
int ascii_codes[10];
while(i < 10)
{
ascii_codes[i] = start + i;
i++;
}
return ascii_codes;
}
int atoi(char* string)
{
int ascii_codes[10]... |
C | #include <stdbool.h>
void _if(bool value, void (*func1)(), void (*func2)())
{
if(value)
func1();
else
func2();
} |
C | // moverobots.c
// by Chris Minich
// cfminich@gmail.com
/***
consolidate(array, count)
When multiple robots are at the same location, they have collided.
We need to sort the array, and check consecutive elements for matching locations.
Once we have a match, we add a new mine to the mine array.
Then, see if ... |
C | #include "xy_config.h"
void NVIC_Config(void); //Ӻ
/*
ܣ豸ʼ
βΣ
ֵ
ע
*/
void XY_driver_init(void)
{
NVIC_Config(); //ж
bsp_InitTimer(); //ϵͳζʱãжϣ Freertos ṩ
USART1_Config(9600); //ڳʼ ʣ9600 printf
}
/*
ܣӡϵͳʣÿʱӵ
βΣ
ֵ
ע
*/
void Get_System_clock_freequency(void)
{
//һRCC_ClocksTypeDef Ľṹ
RCC_Cl... |
C | // WII-MAZE Skeleton code written by Jason Erbskorn 2007
// Edited for ncurses 2008 Tom Daniels
// Updated for Esplora 2013 TeamRursch185
// Updated for DualShock 4 2016 Rursch
// Headers
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <ncurses/ncurses.h>
#include <unistd.h>
// Mathema... |
C | /*
* list.c
Joel Wolfrath 2013
*
* Linked list function implementations
*/
#include <lib/list.h>
extern uint32_t debug;
/* Add the node to the end of the list */
void list_add(struct w_listnode* head, struct w_listnode* node){
struct w_listnode* it = head;
while(it->next)
it = NEXT_NODE(it);
it->ne... |
C | #include<stdio.h>
struct wordstr
{
char word[100];
int len;
};
struct wordstr wordstring[100];
char* largestword(char *rstr)
{
int i,iword,jword,wordlen,g;
wordlen=0;
iword=0;
jword=0;
for(i=0;rstr[i]!='\0';i++)
{
if((rstr[i]==' ')||(rstr[i]=='.'))
{
if(wordlen)
{
wordstring[iword].word[jword]='\0';
wordstring[iwor... |
C | /* sort.c */
#include "global.h"
#include "sort.h"
/* Descending order. */
void quickSortDouble (int* index, double* order, int l, int r)
{
int i;
if (l < r)
{
i = partDouble (index, order, l, r);
quickSortDouble (index, order, l, i-1);
quickSortDouble (index, order, i+1, r);
... |
C | #include <stdlib.h>
#include <stdio.h>
#include <time.h>
void selectionSort(int array[], int size) {
int i, j, swapper, position;
for (i = 0; i < size - 1; i++){
position = i; //first element
for (j = i + 1; j < size; j++){
if (array[position] > array[j])
position = ... |
C | class Solution {
public:
string convertToBase7(int num) {
string res;
long num0 = num;
if(num0<0) num0 = -num0;
do{
res.push_back(num0%7+'0');
num0/=7;
}while(num0);
if(num < 0) res.push_back('-');
reverse(res.begin(), res.end());
... |
C | #include<stdio.h>
main()
{
char a;
int sum=0;
for (; ;)
{
printf("Enter any character_",&a);
scanf(" %c",&a);
sum=sum+1;
if(a=='z')
break;
}
printf("number of characters = %d",sum);
}
|
C | #include <ctype.h>
#include "./Calculator/getch.c"
#define SIZE 100
int getch(void);
void ungetch(int);
int n, arr[SIZE], getint(int *);
int cnt;
int main(int argc, char const *argv[])
{
for(n=0; n<SIZE && getint(&arr[n]) != EOF;n++)
{
cnt++;
};
for(int i=0; i<cnt; ++i)
{
printf("%d\n", arr[i]);
}
return ... |
C | #include <stdio.h>
#include <unistd.h>
int main() {
int n = 10;
printf("主进程号pid: %d\n", getpid());
pid_t pid = fork();
if (pid > 0) {
printf("父进程的返回值: %d\n", pid);
printf("父进程pid: %d\n", getpid());
printf("父进程ppid: %d\n", getppid());
printf("父进程n值修改前: %d\n", n);
... |
C | #include <stdio.h>
int bissexto(int n){
if(n%4==0){
if((n%100==0) && (n%400!=0))
return 0;
else{
return 1;
}
}
return 0;
}
int main(void)
{ int x;
scanf("%d", &x);
printf("A %d\n", bissexto(x));
}
|
C | #pragma once
// - ;
double**CreateMatr(int sizeI, int sizeJ);
// - ;
void DeleteMatr(double **ptr, int sizeI);
//-
void InputMatr(double **ptr, int sizeI, int sizeJ);
//-
void OutputMatr(double **ptr, int sizeI, int sizeJ);
// - random;
void RandMatr(double **ptr, int sizeI, int sizeJ);
// ;
double Su... |
C | #include "shell.h"
/**
* _strcpy - copies the string pointed to by src,
* @dest: destnation poiter to take value
* @src: array poited that gets copied
* Description: copies string pointed to by src,
* Return: dest
*/
char *_strcpy(char *dest, char *src)
{
int i;
for (i = 0; src[i] != '\0'; i++)
dest[i] = sr... |
C | #include<stdio.h>
int main(){
char * hello="Hello, World\n";
printf("%s", hello);
return 0;
}
|
C | // Calculate Net price
#include <stdio.h>
void main()
{
int qty, price, amount, discount, tax,gross_amount,net_price;
printf("Enter quantity : ");
scanf("%d",&qty);
printf("Enter price : ");
scanf("%d",&price);
amount = qty * price;
discount = amount * 0.10;
gross_amount = amount... |
C | #include <stdio.h>
int main()
{
const int target = 200;
int coins[] = {1, 2, 5, 10, 20, 50, 100, 200};
// initialise array to all zeros, first value as 1
int n[target];
for (int i = 0; i <= target; i++) n[i] = 0;
n[0] = 1;
for (int i = 0; i <= 8; i++) {
for (int j = coins[i]; j <=... |
C | #include <stdio.h>
#include <stdlib.h>
#include "stack.h"
// Define a new NULL stack pointer and return it
// Constructor that initializes an empty stack pointer
STACK new_stack() {
STACK new = NULL;
return new;
}
/* Add one more element
* Setter for pushing a value onto the stack
1. Allocate memory for ... |
C | //Written By Pragik Timsina
//Find the Factorial of a Given Number N.
#include <stdio.h>
#include <conio.h>
void main()
{
long int n,i,f=1;
clrscr();
printf("Enter the Number\n");
scanf("%ld",&n);
for (i=1;i<=n;i++)
{
f=f*i;
}
printf("The factorial of %ld is %ld",n,f);
getch();
}
|
C | #include <stdio.h>
#include "ex6.h"
void main (){
int x = 12988181;
int y = ddd (x);
printf("%d", y);
x = 32988181;
y = ddd (x);
printf("\n%d", y);
x = 31982289;
y = ddd (x);
printf("\n%d", y);
int a = 5;
int b = 32;
int c = 99;
x = soma1SePar (a);
y = soma1SePar (b);
int z = soma1Se... |
C |
void ft_putnbr(int nb);
int main()
{
int nb;
nb = -2147483648;
ft_putnbr(nb);
}
|
C | #include<stdio.h>
#include<math.h>
double tfun(char a, double f);
int sqr(int sq);
int cange(void);
int main(void){
int b = 1, w = 1, sq;
double f, s, ans, ans2, k;
char a, c, d, e, fun;
/*eはエンター読み取り専用*/
/*平方根*/
printf("平方根を求めたい場合は's'を、電卓機能を使いたい場合はそれ以外をを入力してください。\n");
scanf("%c", &fun);
if(fun == '\... |
C | #include <stdio.h>
int main(void)
{
char lowercase[26];
char ch;
int count;
for (count = 0,ch = 'a'; count < 26,ch <= 'z'; count++,ch++) {
lowercase[count] = ch;
}
for (count = 0; count < 26; count++) {
printf("%c ", lowercase[count]);
}
return 0;
} |
C | /*
* UserProgram.c
*
* Created on: 11 de jun de 2018
* Author: Gabriel
*/
/* Includes ------------------------------------------------------------------*/
#include "UserProgram.h"
/* User ScanTime selection */
int ScanTimeLimit()
{
int TimeLimit = 25;
return TimeLimit;
}
/* User p... |
C | /*~!exp.c*/
/* Name: exp.c Part No.: _______-____r
*
* Copyright 1992 - J B Systems, Morrison, CO
*
* The recipient of this product specifically agrees not to distribute,
* disclose, or disseminate in any way, to any one, nor use for its own
* benefit, or the benefit of others, any information contained herein
... |
C | /**
* @file gameentities.h
*
* @author Killax-D | Dylan DONNE
*
* @brief GameEntities contains all the entities defined in game (Items Entities & IA Entities)
*
* This file contains all declarations and function regarding GameEntities
*
*/
#ifndef GAMEENTITIES_H
#define GAMEENTITIES_H
#include "gameitemsentit... |
C | #include <stdio.h>
//t.cn/E9lOOZQ
int fanxushu(int x){
while(x!=0){
if(x%10==7) return 1;
x/=10;
}
return -1;
}
int ifrel2seven(int x){
// printf("%d",fanxushu(x));
if((x%7==0)||(fanxushu(x)==1)) return 1;
else return -1;
}
main(){
int b=0;
scanf("%d",&b);
int x,sum=0;
for(x=0;x<=b;x++){
// printf(... |
C | #include <stdio.h>
#include <stdlib.h>
#define true 1
#define false 0
#define _MAX_ELEMENTOS_ 1000
typedef int bool;
typedef struct aux
{
int id;
float prioridade;
struct aux* ant;
struct aux* prox;
} ELEMENTO, * PONT;
typedef struct
{
int maxElementos;
PONT fila;
PONT* arranjo;
} FILADEPRIORID... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <stdbool.h>
#include "../src/zsorted_hash.h"
// generate strings of random ASCII characters 64 to 126
// between 5 and 20 characters
static char *random_string()
{
size_t length, ii;
char *str;
length = rand() % 15 + 5;
s... |
C | #ifndef SILO_GATE_CODE
#define SILO_GATE_CODE
#include <stdio.h>
#include "silo_node.h"
#include "silo_gate.h"
#include "silo_simulate.h"
inline SIGNAL NodeReadInput(NODE * node, PORTID portid) {
return node->input[portid];
}
void GateADD(NODE * node) {
SIGNAL a, b, c;
a = NodeReadInput(node, 0);
b = ... |
C | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<time.h>
void main()
{
float Total_HoldingCost[30], Daily_Demand[30], Monthly_Demand[30], Initial_Inventory[30], Final_Inventory[30], Holding_Cost[30], THC;
float PDF[6]= {0.1,0.2,0.2,0.3,0.1,0.1};
float CDF[6]= {0,0,0,0,0,0};
CDF[0]= PDF[0];
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: ... |
C | #include <stdio.h>
int A[10] = { 0,1,3,6,11,17 };
int H[10] = { 0,2,5,1,5,0 };
int airtel(int);
int airtel(int n)
{
int i,k;
int m[7];
int cost=0;
m[0] = 0;
for (i = 1; i < n; i++)
{
m[i] = 999999;
for (k = 0; k < i; k++)
{
cost = m[k] + H[k] + A[i - k];
if (m[i] > cost)
m... |
C | #include<stdio.h>
int main()
{
int m, n, a, num, i=0;
printf("Enter range in which you want to print Armstrong Numbers: ");
scanf("%d %d", &m, &n);
for(m;m<=n;m++)
{
i=0;
num=m;
while(num)
{
a = num%10;
num /= 10;
i += (a*a*a);
... |
C | #include <stdio.h>
#include <stdlib.h>
main()
{
printf("%5s\n","abcd");
printf("%5s\n","abcdef");
printf("%-5s\n","abc");
printf("%5.2s\n","abcde");
printf("%-5.2s\n","abcde");
getchar();
getchar();
} |
C | /*
* $Id: glob.c,v 1.16 2008-07-27 03:18:38 haley Exp $
*/
/************************************************************************
* *
* Copyright (C) 2000 *
* University Corporation for A... |
C | #include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include "util.h"
// Returns true if arr1[0..n-1] and arr2[0..m-1]
// contain same elements.
bool arrays_are_equal(uint8_t * p_arr1, uint8_t * p_arr2, uint8_t n, uint8_t m)
{
if (n != m)
return false;
... |
C |
/*
#include <stdio.h>
#include <stdlib.h>
//ֱӵrand()ɵһԵģһ41 18467 6334Ժÿ41 18467 6334
//ֵһ£ԺɴжõһεݡʱҪʹã
//ķΧΪ0-RAND_MAX,<stdlib>жRAND_MAXֵΪ21474836472^31 - 1--intΧ-2^31+1 - 2^31
int main()
{
int x1 = rand();
int x2 = rand();
int x3 = rand();
printf("%d %d %d ", x1, x2, x3);
return 0;
}
*/
//0-100... |
C | /* Project Euler Problem #4 */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
char
palindrome(char *str) {
int len = strlen(str);
if (len%2 != 0)
return 0;
int i;
for (i=0; i<len/2; i++) {
if (str[i] != str[len-i-1]) {
return 0;
}
}
return 1;
}
... |
C |
int choice,e;
do
{
display menu 1.peek 2.push 3.pop 4.exit
printf("enter your choice");
take input in choice variable
switch(choice){
case 1:
//call peek function
break;
case 2:
//call push function
break;
case 3:
//call pop function
break;
case 4:
/... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
//孤儿进程:父进程已经退出了 子进程还在运行
//孤儿进程最终会被1号init进程收养
//pstree -p | less
int main(void)
{
pid_t pid = 0;
pid = fork();
//子进程
if (0 == pid)
{
while(1)
{
printf("getppid: %d hello world..\n", getppid());
... |
C | #include<stdio.h>
#include<windows.h>
#include<time.h>
int main()
{
int a[100], N, i, j, temp, num, mid, start, end, even_count = 0, odd_count = 0;
printf("Enter array size: ");
scanf("%d", &N);
printf("Elements: ");
for(i = 0; i < N; i++)
{
scanf("%d", &a[i]);
}
for(i = 0; i... |
C | #include "hash_tables.h"
/**
* hash_table_create - create a hash table
* @size: size of the array
*
* Return: pointer to the new array
*/
hash_table_t *hash_table_create(unsigned long int size)
{
hash_table_t *hasht = NULL;
hasht = malloc(sizeof(hash_node_t));
if (!hasht)
return (NULL);
hasht->size = size... |
C | #include<stdio.h>
int main()
{
int n,k,s=1,i;
scanf("%d %d",&n,&k);
for( i=1;i<=k;i++)
{
s=s*n;
}
printf("%d",s);
return 0;
}
|
C | #include "calcul.h"
void addition(int n1[400], int n2[400], int result[400]){
for (short i = 0; i < 200; i = i+1){
int temp = result[399-i];
result[399-i] = (result[399-i] + n1[399-i] + n2[399-i]) % 10;
result[399-(i+1)] = (n1[399-i] + n2[399-i] + temp) / 10;
}
}
void soustra... |
C | #include <stdio.h>
#include <assert.h>
#include <string.h>
#include "util.h"
#include "errormsg.h"
#include "symbol.h"
#include "absyn.h"
#include "types.h"
#include "helper.h"
#include "env.h"
#include "semant.h"
// TODO: nil handling.
// TODO: break handling.
// TODO: cycle detection. (16)
// TODO: () exp (12,20,43)... |
C | // C program to generate random numbers
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include<time.h>
// Driver program
int main(void)
{
// This program will create different sequence of
// random numbers on every program run
// Use current time as seed for random generator
srand(time(0))... |
C | #include <stdio.h>
/*m row,n columns*/
int a[4][5] = {
{1,2,3,4,5},
{6,7,8,9,10},
{11,12,13,14,15},
{16,17,18,19,20},
//{21,22,23,24,25}
};
int showMatrix(int m,int n);
int main(int argc, char *argv[]) {
showMatrix(4,5);
}
int showMatrix(int m,int n) {
int i=0,j=0,p=0,q=0;
p=m-1;
q=n-1;
for(;p&&q;p--,q--,i+... |
C | #include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/kobject.h>
#include <linux/string.h>
#include <linux/sysfs.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
#include <asm/io.h>
#define DEV_MAJOR 0 /* 动态申请主设备号 */
#define DEV_NAME "red_led" /*led设备名字 */
/* GPIO虚拟地址指针 */... |
C | #include<stdio.h>
int main()
{
int num,a,multi=0,i;
printf("\n enter the number:");
scanf("%d",&num);
a=num;
for(i=num;multi=1;i++)
{
if(i%10==0)
{
multi=1;
break;
}
}
if(multi==1)
{
printf("\n the nearest multiple of %d is %d ",a,i);
return 0;
}
}
|
C | //
// quicksort.h
// Quick sort is based on the divide-and-conquer approach based on the idea of choosing one element as a pivot element and partitioning the array around it such that:
// Left side of pivot contains all the elements that are less than the pivot element Right side contains all elements greater than t... |
C | //ʤΪ16ϴʳbug,
// ܵ20
//
#pragma warning(disable:4996)
#include <stdio.h>
#include<Windows.h>
#include<time.h>
#include<conio.h>
#include<stdlib.h>
int head, tail;
int score = 0;
int gamespeed = 300;//Ϸٶ
int win = 16;//ʤ
int change_model(char qi[22][22], int zb[2][20], char dir) {
int x = 0, y = 0;
if (dir == 72)... |
C | #include <stdio.h>
#include <stdlib.h>
struct Student{
int number;
int moral;
int intelligence;
};
void Sort(struct Student arr[], int length, int high);
int Compare(struct Student s1, struct Student s2, int high);
int CompareInSameLvl(struct Student s1, struct Student s2);
void Heapify(struct Student arr... |
C | #include "../m_pd.h"
#include <math.h>
#include <string.h>
#include "ringmods.h"
#ifdef NT
#pragma warning( disable : 4244 )
#pragma warning( disable : 4305 )
#endif
#define PI 3.141592653589793
#define TWOPI 6.283185307179586
/* ------------------------ vdpll~ ----------------------------- */
/*
phase locked loop ... |
C | #ifndef QUEUE_H
#define QUEUE_H
typedef struct Node
{
int jobNumber;
float time;
struct Node* next;
}Node;
typedef struct Queue
{
struct Node* front;
struct Node* last;
unsigned int size;
}Queue;
void initQueue(Queue* queue);
float front(Queue* queue);
float last(Queue* queue);
void EnQueue... |
C | #include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
int main(int argc, char const *argv[])
{
if (argc < 2)
{
printf("Digite na forma: %s <n><número de usuários>\n",argv[0] );
return 1;
}
setuid(0);
char buf[100];
sprintf(buf, "bash questao08.sh %s", argv[1]);
system(buf);
r... |
C | #include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
void handler(int num) {
int status;
pid_t pid = waitpid(-1, &status, WNOHANG);
if (WIFEXITED(status)){
printf("child pid %d, exit with code: %d \n", pid, WEXITSTATUS(status))... |
C | /**************************************************************************/
/*!
@file wma_u16.c
@author Nguyen Quang Huy, Nguyen Thien Tin
@brief A simple moving average filter using uint16_t values
@code
// Declare a data buffer 8 values wide
uint16_t wma_buffer[8];
uint8_t wma_... |
C | /*
THIS FUNCTION TESTS OPEN FILE, PRINTING THE BUFFER AFTER READING!
I'M USING /FILE2.TXT BECAUSE IT HAS MORE THAN ONE CLUSTER, TURNING THE EXAMPLE MORE INTERESTING, BECAUSE IT SHOWS THE
CASE IN WHICH WE START FROM THE MIDDLE OF A CLUSTER AND CONTINUE IN THE NEXT ONE
YOU CAN TEST OTHER FILES FROM THE HD CHANGIN THE CH... |
C | /*
* linkedlist.c
*
* Copyright (c) 2016-2019 Tim <and-joy@qq.com>
* All rights reserved.
*/
#include <stdlib.h>
#include <string.h>
#define AWE_LOG_TAG "linkedlist"
#include "awe/log.h"
#include "awe/atomic.h"
#include "awe/linkedlist.h"
static awe_linked_obj* linked_obj_create(awe_object *obj){
awe_linked_... |
C | //
// Point.h
// AnyViewer
//
// Created by Aomei on 2021/9/9.
//
#ifndef Point_h
#define Point_h
struct CPoint
{
CPoint() : x(0), y(0) {}
CPoint(int x_, int y_) : x(x_), y(y_) {}
inline void Clear() { x = 0; y = 0; }
inline void setPoint(int x_, int y_) { x = x_; y = y_; }
inline void move(int deltaX, ... |
C | #include <signal.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
sig_atomic_t sigusr1_count = 0;
sig_atomic_t sigusr2_count = 0;
void handler1(int signal_number)
{
++sigusr1_count;
}
void handler2(int signal_number)
{
++sigusr2_count;
}
int main()
{
struct sigaction sa1;
... |
C | /**
*--------------------------------------------------------------------\n
* HSLU T&A Hochschule Luzern Technik+Architektur \n
*--------------------------------------------------------------------\n
*
* \brief C Template for the MC Car
* \file
* \author Christian Jost, ... |
C | //
// bit_1.h
// Test2019
//
// Created by Denys Risukhin on 2/2/20.
// Copyright © 2020 DenysRisukhin. All rights reserved.
//
#ifndef bit_1_h
#define bit_1_h
#pragma mark - 1_1
0110 + 0010 = 1000
0011 * 0101 = 1111
0011 + 0010 = 0101
0011 * 0011 = 1001
0110 - 0011 = 0011
1101 >> 2 = 0011
1000 - 0110 = 0010
1... |
C | #include "porteiro.h"
/**
* ATENÇÃO: Você pode adicionar novas funções com PUBLIC para serem usadas por
* outros arquivos e adicionar a assinatura da função no .h referente.
*/
/*============================================================================*
* Definição das variáveis globais (publicas ou privadas) ... |
C | #include <stdio.h>
#include <string.h> // necess'ario para strcmp
int main(void)
{
char str1[4] = "abc";
char str2[4] = "abc";
char str3[15] = "Curso de C";
char str4[15] = "Curso de Java";
int retorno;
int retorno2;
retorno = strcmp(str1, str2); // gera um valor inteiro, 0, valor posi... |
C | /* Anotações Next Level Week:
- Pilares do metodo: Foco, Prática e Grupo
-TypeScript: javascript com "super poderes", permite incluir tipagens no código, algo que facilita reconhecer
o formato das variáveis, argumentos de funções que eu esteja usando.
OBS.: pesquise intel... |
C | // Globals
int gbPrintPrimes = false;
// BEGIN OMP
int gnThreadsMaximum = 0 ;
int gnThreadsActive = 0 ; // 0 = auto detect; > 0 manual # of threads
// END OMP
int parse_args( const int nArg, const char *aArg[] )
{
int iArg = 1;
for( iArg = 1; iArg < nArg; iArg++ )
{
... |
C | //1.дunsigned int reverse_bit(unsigned int value);
//ķֵvalueĶλģʽҷתֵ
//
//磺
//32λ25ֵиλ
//00000000000000000000000000011001
//ת2550136832
//10011000000000000000000000000000
//أ
//2550136832
#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <math.h>
unsigned int reverse_bit(unsigned int... |
C | //
//
//
#include "buffer.h"
struct buffer_t {
apr_allocator_t *allocator;
apr_memnode_t *node;
int offset;
};
static void buffer_tidy(buffer_t *self)
{
if (buffer_len(self) == 0)
buffer_clear(self);
else
{
int total = self->node->endp - (char *)self->node - APR_MEMNODE_T_SIZE;
if (self->offset > (total ... |
C | #include "lc3.h"
#include <stdio.h>
#include <stdlib.h>
/*Phansa Chaonpoj
Samantha Shoecraft
problem 2
lc3.c - implement the instructions add, and, not, trap, ld, st,
jmp, and br as a lc3 simulator.
*/
// you can define a simple memory module here for this program
unsigned short memory[32]; // 32 words of memory e... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* parser.c :+: :+: :+: ... |
C | #include <stdio.h>
#define DEBUG
#define ALPHABET_LEN 255
char StrOriginal[] = "On a dark deseart highway, cool wind in my hair.";
char StrKey[] = "wind";
char* ForceSearch(char text[], char key[])
{
// ここを実装する
int text_len,key_len,start,pos;
text_len,key_len=0;
while(1){
if(text[text_len... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.