language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*
* NAME: Megan Chu
* ID: A12814536
* LOGIN: cs12waot
*/
/*
* Filename: hw5_C.c
* Author: Megan Chu
* Userid: A12814536
* Login: cs12waot
* Description: allows user to specify array size, input elements in array,
* and return the location and value of the maximum value
* Date: Feburary 13, 2017
... |
C | /*
目的:递归函数
输入输出格式说明:
1,每一行末尾可见字符后面没有不可见字符;
2,每一行的末尾都有一个换行符,但是最后一行没有换行符;
3,如果只有一行,则末尾没有换行符;
4,所有标点符号均为西文标点符号。
题目描述:Collatz conjecture,又称为奇偶归一猜想、3n+1猜想:是指对于每一个正整数,
如果它是奇数,则对它乘3再加1,如果它是偶数,则对它除以2,如此循环,最终都能够得到1。
程序接受一输入正整数,设计递归函数计算f(n):
f(n) = n/2 如果n为偶数
f(n) = 3*n+1 如果n为奇数
程序每调用一次,输出计算后的值。如果值不等于1,继续调用函数计算,直到函数值等于1为止。
程序... |
C | #include<stdio.h>
#include<assert.h>
char student_marks[10] = {20, 45, 49,50,42,23,1,18,34,33};
int add_grace(int marks);
int main(){
int i,add,marks;
for (i=0;i<10;i++)
if(student_marks[i]!=50){
marks=add_grace(student_marks[i]);
student_marks[i]=marks;
}
for (i=0;i<10;i++){ ... |
C | #include <stdio.h>
int main()
{
int a,b, year = 0;
do
{
printf("nhap vao tuoi cha :");
scanf("%d", &a);
printf("nhap vao tuoi con :");
scanf("%d", &b);
while(a != 2*b)
{
a++;
b++;
year++;
}
printf("vay sau %d thi tuoi cha gap 2 lan tuoi con", year);
}
while(a < 2*b);
return 0;
} |
C |
#include "test_libft.h"
static int int_test(ssize_t i, char *text)
{
int rs0;
int rs1;
(void)text;
i = 0;
while (i < BUFF_SIZE)
{
rs0 = ft_isalnum(g_buff0[i]);
rs1 = isalnum(g_buff0[i]);
if (!((!rs0 && !rs1) || (rs0 && rs1)))
{
PRINT_FAIL;
}
i++;
}
PRINT_OK;
return (1);
}
int test_isalnum(v... |
C | #include<stdio.h>
#include<stdlib.h>
#define MAXLINE 1000
#define MAXCHLD 10
typedef struct node{
char ch;
int stat;
struct node *chld[MAXCHLD];
}node_t;
node_t *new_node(){
node_t *node=(node_t *)malloc(sizeof(node_t));
node->stat=-1;
for (int i=0;i<MAXCHLD;i++)
node->chld[i]=NULL;
return node;
}
nod... |
C | //
// Sudoku.c
//
//
// Created by Paul Adeyemi on 08.11.13.
//
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int sudokuarr[9][9];
int main()
{
int check=0;
char c;
char filepath[50];
int i, j;
do {
//Menü
printf("Auswahl:\n(a)Test Raetzel 1\n(b)Test Raetzes... |
C | #include<conio.h>
#include<stdio.h>
#define max 100
void equation(int [],int);
int main()
{
int a[max],i,n;
clrscr();
printf("Enter the limit\n");
scanf("%d",&n);
printf("Enter the numbers\n");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
equation(a,n);
getch();
return;
}
void equation(int a[],int n)... |
C | #include "holberton.h"
/**
* is_palindrome - the function return palindrome.
*@s: char the pointer
* Return: Always 0.
*/
int is_palindrome(char *s)
{
int length;
length = lengthc(s);
if (length == 0)
{
return (1);
}
return (validate_palindrome(s, 0, length - 1));
}
/**
* lengthc - the function longtitu... |
C | #include <stdio.h>
#include "wich.h"
/* translation of Wich code:
func f() {
var x = "cat" + "dog"
print(x)
print(x[1]+x[3]) // x[i] returns a String with one character in it
}
f()
*/
void f() {
// var x = "cat" + "dog"
String *tmp1;
String *tmp2;
String *x = String_add(tmp1=String_new("cat"), tmp2=String_n... |
C | #include"MyHeader.h"
int main(int argc, char const *argv[])
{
int iBrr[10];
int iCnt=0;
for(iCnt=0;iCnt<10;iCnt++)
{
printf("Enter number at brr[%d]:",iCnt);
scanf("%d",&iBrr[iCnt]);
}
DisplayReverse(iBrr,10);
return 0;
} |
C | /*14.Construye un programa que permita ingresar las medidas de los
lados de un rectángulo;el mismo debe emitir por pantalla su superficie
y su perímetro.*/
#include <stdio.h>
int main() {
float lado_1, lado_2;
printf("Por favor, Ingrese la medida del primer lado del rectángulo\n");
scanf("%f", &lado_1... |
C | #include <stdio.h>
#include <stdlib.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(void) {
float m, mm, cm, dm, km;
char ch;
printf("Nhap vao do dai tinh theo met:\n");
scanf("%f", &m);
printf("Chon don vi de doi: 1.mm, 2.cm, 3.dm, 4.km\n");
sca... |
C | //
// main.c
// BFS
//
// Created by 권택준 on 2020/04/06.
// Copyright © 2020 권택준. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#define MAX_SIZE 1001
typedef struct _NODE{
int index;
struct _NODE * next;
}Node;
typedef struct _queue{
Node * front;
Node * rear;
int count;
... |
C | // test single linked list implementation
#include <stdio.h>
#include <stdlib.h>
struct node
{
int val;
struct node *next;
} *head = NULL;
void list_insert(int x) {
struct node *new_node;
new_node = (struct node*)malloc(sizeof(struct node*));
new_node->val = x;
if(head == NULL) {
new... |
C | /*
* LEDCube.c
*
* Created: 2017. 12. 17. 0:03:49
* Author : zoltan
*/
#define F_CPU 1000000UL
#define DELAY 200
#define LED_LOW_DDR DDRA
#define LED_HIGH_DDR DDRC
#define LED_LOW PORTA
#define LED_HIGH PORTC
#define LAYERS PORTD
#define LAYERS_DDR DDRD
#include <avr/io.h>
#include <avr/inter... |
C | /*
* heapalloc.c
* Copyright: 1997 Advanced RISC Machines Limited. All rights reserved.
*/
/*
* $RCSfile: app_kernel/heapalloc.c $
* $Revision: 1.4 $
* $Date: 2006/02/24 12:02:09EST $
*/
#include <stdlib.h>
// Necessary for heap.h to include the correct heap1a information. The only software
// avai... |
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<stdio.h>
int main(void)
{
char string[]="DigitalSeries";
int i=0;
while (string[i] != '0'){
i++;
}
printf("%d\n", i);
return 0;
}
|
C | #include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
/* time measurement for MPI_Bsend */
int main(int argc, char** argv) {
MPI_Init(NULL, NULL);
int a = 1;
while(a < 256*256*256){
int world_rank;
MPI_Comm_rank(MPI_COMM_WORLD, &world_rank);
int world_size;
MPI_Comm_size(MPI_COMM_WORLD, &world_size);
... |
C |
#ifndef __TEST_MACRO_DEFINE_H__
#define __TEST_MACRO_DEFINE_H__
#define offsetof(type, member) ((unsigned long)(&((type *)0)->member))
#define member_entry(ptr, type, member) \
((unsigned long)((char *)(ptr)+ offsetof(type, member))
#define member_size(type, member) (sizeof((type *)0)->member)
#de... |
C | #include<stdio.h>
void main()
{
int num=0;
scanf("%d",&num);
int b=num;
int i=0;
int c[20];
while(b!=0)
{
c[i]=b%2;
b=b/2;
i++;
}
for(int j=i-1;j>=0;j--)
{
printf("%d",c[j]);
}
}
|
C | #include "shell.h"
/**
* Upath - Find path
* @av: Double pointer to free
* @env: Environment
* @arv: Command
* @x_av: Integer lenght command
* @pfid: Integer pointer
*
* Description: Find path
* Return: Nothing
*/
void Upath(char **av, char *env, char *arv, int x_av, int *pfid)
{
int x = 0, start, c_path = 0;
char *s... |
C | /*
* util.c
*
* Status: T
*
* Created on: Feb 3, 2017
* Author: Fred
*
* Contains helper function implementations
*/
#include "util.h"
/* Simple function to check if input is changed from last_value by at least threshold amount*/
BOOL int32U_changed_by_threshold(INT32U input, INT32U last_value,
... |
C | #include <pksm.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <string.h>
int main(int argc, char **argv)
{
unsigned char version = *argv[0];
enum Generation gen;
switch (version)
{
case 35: // red
case 36: // green[jp]/blue[int]
case 37: // blue[jp... |
C | // tjadanel - C Programming 2nd Ed.
// Chapter 5 - Program Exercise 5.11
// This program takes a two digit number and writes it out
#include <stdio.h>
int main(void)
{
int d1, d2;
printf("Enter a two-digit number: ");
scanf("%1d%1d", &d1, &d2);
printf("You entered the number ");
if (d1 == 1){
... |
C | #include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <unistd.h>
#include <string.h>
int main(int argc, char **argv)
{
int opt;
const char *optstr = "n:";
long count = -1;
int current, i, primecount = 0;
while ((opt = getopt(argc, argv, optstr)) != -1)
{
switch (opt)
... |
C | #include "holberton.h"
int main(void)
{
char school[10] = "Holberton";
int i = 0;
while (i < 9)
{
_putchar(school[i]);
i++;
}
_putchar('\n');
return (0);
}
|
C | #include <stdio.h>
#include <stdlib.h>
double divop(double orig, int slots)
{
if (slots == 1 || orig == 0)
return orig;
int od = slots & 1;
double result = divop(orig / 2, od ? (slots + 1) >> 1 : slots >> 1);
if (od)
result += divop(result, slots);
return result;
}
int main()
{
... |
C | /*
* Main source code file for lsh shell program
*
* You are free to add functions to this file.
* If you want to add functions in a separate file
* you will need to modify Makefile to compile
* your additional functions.
*
* Add appropriate comments in your code to make it
* easier for us while grading your... |
C | #include<stdio.h>
void main(){
char name[100],addres[100],phonenumber[100];
printf("Please enter your detail below : \n");
printf("Enter your name :");
scanf("%s",name);
printf("Enter your current adress:");
scanf("%s",addres);
printf("Enter your Phone number :");
scanf("%s",phonenumber);
printf("\n")... |
C | /**
* @FilePath: \undefinedd:\git\Algorithm_Library\CatalanNum\catalan.c
* @brief:
* @details:
* @author: Lews Hammond
* @Date: 2022-05-19 20:53:35
* @LastEditTime: 2022-05-19 21:01:28
* @LastEditors: Lews Hammond
*/
#include <stdio.h>
unsigned long long catalan(unsigned int n)
{
unsigned long long num... |
C | #include<stdio.h>
void encode(int n,int x[],char y[])
{
int i,j,k=0;
for(i=0;i<n;i++)
{
for(j=0;j<x[i];j++)
{
printf("%c",y[k]-3);
k++;
}
printf(" ");
}
}
int main()
{
int n;
char y[100];
scanf("%s",y);
scanf("%d",&n);
int x[n... |
C | #include "sorting.h"
#include "../tpcontato/tpcontato.h"
void dllist_insertion_sort(dl_node *llist, int (*cmp)(const void *, const void*))
{
dl_node *p, *i;
if (llist == NULL || llist->next == NULL) return;
/* Iterates the llist */
for (i = llist; i != NULL; i = i->next) {
for (p = i; p->prev != NULL && ... |
C | #include <stdio.h>
#include <unistd.h>
int main()
{
unsigned char c = 0;
while (c != 255)
{
printf("%d - %c , ", c,c++);
usleep(1000000);
}
} |
C | // Reference: 4-1 in Intel's 8080 Microprocessor System User's Manual
//#include <sys/types.h>
#include <stdio.h> // printf
#include <stdlib.h> // exit()
#include "8080.h"
// get register pair
inline uint16_t rpBC(struct i8080* cpu) { return cpu->B << 8 | cpu->C; };
inline uint16_t rpDE(struct i8080* cpu) { return c... |
C | #include <ctype.h>
#include <errno.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <signal.h>
#include <sys/wait.h>
#include <termios.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "tokenizer.h"
/* Convenience macro to silenc... |
C | /*
** EPITECH PROJECT, 2019
** game loading functions
** File description:
**
*/
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <curses.h>
#include "my.h"
#include "my_sokoban.h"
box_t *box_load(map_t *map, int box_count)
{
box_... |
C | #include "pathfinder.h"
static int **copy_matrix(int **deixtra_matrix) {
int size = 0;
int **copy = NULL;
for (;deixtra_matrix[0][size] != -2; size++);
copy = (int **)malloc(sizeof(int *) * 3);
for (int j = 0; j < 3; j++) {
copy[j] = (int *)malloc(sizeof(int) * size + 1);
for (int ... |
C | /* **************************************************************************
* more - display the contents of a file
*/
nomask int
more_file(string path)
{
int line;
object tp;
CHECK_LEVEL(_BUILDER);
tp = this_interactive();
if (!path || !strlen(path))
{
tp->catch_tell("Usage: ... |
C | #ifdef APP_BETA_LABS
#include "usr/beta_labs/cmd/cmd_inv.h"
#include "sys/commands.h"
#include "sys/defines.h"
#include "usr/beta_labs/inverter.h"
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
static command_entry_t cmd_entry;
#define NUM_HELP_ENTRIES (2)
static command_help_t cmd_help[NUM_HELP_ENTRIES... |
C | #include "csapp.h"
#define NUM_THREADS 4
#define SBUF_SIZE 16
// an array queue
// interestingly, using PV we don't have to manage the state of
// empty or full, it will suspend and wait for insert or remove
// but we can't insert and remove on the same thread, it may cause dead-lock.
typedef struct
{
int *buf; ... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define FILE_NAME "dict_spanish.txt"
#define MAX_DIC_LEN 100000
typedef struct dicto {
char **values;
int length;
} dicto;
int buildDicto(char ** d) {
FILE * infile;
char line[121];
char ** info = NULL;
int llen;
int counter = 0;
int backdown;
inf... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lib.h"
#include "funciones.h"
/** \brief Inicializa el status en un array de programadores
*
* \param personArray[] ePerson el array en el cual inicializara
* \param arrayLenght int la longitud del array
* \return void
*
*/
void inicializarPro... |
C | /*
cٲ:
: feof
: ϵļ
: int feof(FILE *stream);
*/
#include <stdio.h>
int main(void)
{
FILE *stream;
/* open a file for reading */
stream = fopen("file.txt", "r");
/* read a character from the file */
fgetc(stream);
/* check for EOF */
if (feof(stream))
printf("We... |
C | #include "stdio.h"
int main() {
int km;
scanf("%d",&km);
int tempo = (60 * km) / 30;
printf("%d minutos\n",tempo);
return 0;
}
|
C | #include "TreeData.h"
Data* createData(int n, char* label)
{
Data* data = malloc(sizeof(Data));
data->name = label;
data->num = n;
}
int compareNodes(TYPE left, TYPE right)
{
Data* newLeft = (Data*)left;
Data* newRight = (Data*)right;
if (newLeft->num < newRight->num)
{
return -1;
}
else if (newLeft->num ... |
C | #define _CRT_SECURE_NO_DEPRECATE
#include "rwchead.h"
int* bubblesort(int* inputArray, int length);
void swap(int *i, int *j);
int main(void) {
char* inputFileName = "random.txt";
char* outpuFileName = "c bubble sort.txt";
int count = countElement(inputFileName);
int* readfile = readTxtfile(inpu... |
C | Ҫ: Linuxled
1, ӦÿռõĿ
2, Զ豸ڵķ
3, ں˶Ӳʼķʽ
4, Ӧÿռں֮ݽ
5, linuxioctlʵֺgpio⺯ʹ
---------------------------------------------------
2, Զ豸ڵķ
#define MINORBITS 20
#define MINORMASK ((1U << MINORBITS) - 1)
#define MAJOR(dev) ((unsigned int) ((dev) >> MINORBITS))
#define MINOR(dev) ((unsigned int) ((dev) & MINORMASK))
#defin... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_listdelnode.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
int main(int ac, char **av) {
if (ac == 4) {
int nb1 = atoi(av[1]), nb2 = atoi(av[3]), result = 0;
char op = av[2][0];
if (op == '+') result = nb1 + nb2;
if (op == '-') result = nb1 - nb2;
if (op == '*') result = nb1 * nb2;
if (op == '/') result = nb1 / nb2;
if (op... |
C | /*******************************************************************************
* @File: main.c
* @Author: Milandr, L.
* @Project: Sample 2.1
* @Microcontroller: 1986VE92U
* @Device: Evaluation Board For MCU 1986VE92U
* @Date: 04.04.2017
* @Purpose:
***************************************************... |
C | /* Bryson Goad
* Parallel Quicksort
* Implementation of a parallel quicksort using OpenMP
* uses in place recursive quicksort algorithm
* parallel sort reverts to sequential at cutoff partition size to eliminate unnecessary overhead and improve performance
* optimal cutoff point may vary, in my testing around 4400... |
C | #include <sys/types.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <unistd.h>
#include <errno.h>
#include <stdio.h>
#include <arpa/inet.h>
#include <strings.h>
#include <string.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
#include <pthread.h>
#d... |
C | /*
Solve AX = b, where A is a lower triungular matrix
*/
#include <stdio.h>
#include <stdlib.h>
//X[i] = (b[i] - sum) / A[i][i]
#define N 2
int main(void)
{
int **A, *b;
float *X;
int lin = N;
int col = 1;
int i, j;
float sum;
A = (int**) malloc(lin * sizeof(in... |
C | #include <stdio.h>
#include "minunit.h"
#include "../src/nlk_array.h"
int tests_run = 0;
int tests_passed = 0;
/**
* Test writing an array to a text file and loading from it
*/
static char *
test_array_text()
{
FILE *fp;
size_t rows = 20;
size_t cols = 31;
/* create, init */
NLK_ARRAY *origin ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
#include <gsl/gsl_statistics.h>
#include <gsl/gsl_permutation.h>
int main(int argc, char* argv[]){
const gsl_rng_type *T;
gsl_rng *r;
gsl_rng_env_setup();
... |
C | #include <stdio.h>
#include <stdlib.h>
struct data{
int nim;
char nama[20];
};
typedef struct data data;
void swap (struct data *a,struct data *b){
data tmp;
tmp = *a;
*a = *b;
*b = tmp;
}
void cetak(data mhs[100],int n){
for (int i = 0; i < n; ++i)
{
... |
C | /*
Name 1: Duc Tran
Name 2: Brandon Wong
UTEID 1: dmt735
UTEID 2: blw868
*/
#include <stdio.h> /* standard input/output library */
#include <stdlib.h> /* Standard C Library */
#include <string.h> /* String operations library */
#include <ctype.h> /* Library for useful character operations */
#include <limits.h> /*... |
C | /***************************************************************************
* Copyright (c) Date: Mon Nov 24 16:25:59 CST 2008 Qualcomm Technologies INCORPORATED
* All Rights Reserved
* Modified by Qualcomm Technologies INCORPORATED on Mon Nov 24 16:25:59 CST 2008
***************************************************... |
C | #include "types.h"
#include "user.h"
#include "syscall.h"
#define NUM_ELEMENTS 100
int mutex;
void producer(void *arg){
int *buffer = (int*) arg;
int i;
for(i=0; i < NUM_ELEMENTS; i++){
mtx_lock(mutex);
buffer[i]= i*5;
printf(1,"Producer put %d\n", buffer[i]);
mtx_unlock(... |
C | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
int main(){
int file_des[2];
int n;
scanf("%d", &n);
if(pipe(file_des) == -1){// handles file error
perror("pipe()");
exit("EXIT_FAILURE");
}
switch(fork()){
case -1: // jamd;es fprl errpr
perror("fork()");
case 0: // child
if(close(file... |
C | #include <stdio.h>
#define S(a,b,c) (a+b+c)/2
#define area(a,b,c) { double ss = S(a,b,c) ; double r = sqrt(ss*(ss-a)*(ss-b)*(ss-c)) ; printf("%.3f",r) ; }
int main(){
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
area(a,b,c);
return 0;
}
|
C | /*
Copyright (C) 2017, 2018 Andrew Sveikauskas
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
*/
#include <common/error.h>
#include <common/logger.h>
#in... |
C | #include"pch.h"
#include<stdio.h>
#if(1)
void pojie(int num[9][9]);
int pojie_p(int num[9][9], int i, int j);
int jiancha(int num[9][9]);
int panduan(int num[9][9], int i, int j);
int panduan_xie(int num[9][9], int i, int j);
int panduan_hang(int num[9][9], int i, int j);
int panduan_shu(int num[9][9], int i... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils_libft.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
void getArr(int arr[], int n){
unsigned sr = time(NULL);
srand(sr);
for(int i = 0; i < n; i++){
arr[i] = 20 + rand()%10;
}
printf("随机生成的数组\n");
}
void printArr(int arr[], int n){
for(int i = 0; i < n; i++){
printf("%d\t", arr[i]);
}
printf("\n");
}
... |
C | #include <stdio.h>
int main()
{
int arr[10];
int i;
int index;
int max;
int max_i;
i = 1;
while (i <= 9)
{
scanf("%d", &index);
arr[i] = index;
i++;
}
max = arr[1];
max_i = 1;
i = 1;
while (i <= 9)
{
if (arr[i] > max)
{
max = arr[i];
... |
C | /*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
#include <sys/param.h>
#include <sys/dir.h>
/*
* seek to an entry in a directory.
* Only values returned by "telldir" shoul... |
C |
/* STEPS
Create a normal process (Parent process)
Create a child process from within the above parent process
The process hierarchy at this stage looks like : TERMINAL -> PARENT PROCESS -> CHILD PROCESS
Terminate the the parent process.
The child process now becomes orphan and is taken over by the init process.
Call... |
C | #include <stdio.h>
#include <stdlib.h>
int maior(int x, int y){
if (x>y){
return x;
} else {
return y;
}
}
int is_Triangulo(int x, int y, int z){
if (x+y<z) return 0;
if (x+z<y) return 0;
if (z+y<x) return 0;
return 1;
}
void main()
{
printf("%d\n",maior(7,9));
pri... |
C | //Data Structure Program 20
// Various sorting techniques
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int a[20],n;
void create();
void display();
void bubblesort();
void insertionsort();
void quicksort(int number[20],int first,int last);
void heapup(int n,int i);
void heapsort();
void ... |
C | /**
* @file circular_buff.h
* @author Konrad Sikora
* @date Jan 2021
*/
#ifndef circular_buff_h
#define circular_buff_h
#include "MKL05Z4.h"
#define CB_MAX_LEN 50
typedef struct circular_buff
{
uint8_t *head;
uint8_t *tail;
uint8_t *data;
uint8_t *buffor;
uint16_t new_len;
} circular_buff;
... |
C | //Faça um programa que leia um número inteiro e o imprima
#include <stdio.h>
#include <stdlib.h>
int q1 (){
int num;
printf("Digite um número inteiro: ");
scanf("%i", &num);
printf("Número digitado: %i\n", num);
return 0;
} |
C | //Program to print natural numbers from 1 to n using for loop
#include<conio.h>
#include<stdio.h>
int main()
{
int n,i;
Printf("Enter the Number till u wanna Print");
scanf("%d",&n);
while(i<=n)
{
printf("%d\n",i);
i++;
}
getch();
return 0;
}
|
C | /*
preencher um vetor de inteiros com dimenso 20 e depois mover todos
os nmeros mpares do vetor para o final e os pares para o incio.
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(){
int v[20], i, j, aux;
srand(time(NULL));
i = 0;
while(i < 20){
v[i] = rand() / 100 + 1;
i = i + 1;
}
p... |
C | #include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
typedef struct color {
int r;
int g;
int b;
} color;
typedef struct point {
float x;
float y;
} point;
float pi = 3.14159265358079323846264338;
color **blank(int widh) {
color **pixels = malloc(widh * sizeof(color *));
for(in... |
C | #include "hash_table.h"
#include <stdlib.h>
#include <string.h>
int tests_run = 0;
#define mu_assert(message,test) do{if(!(test)) return message;} while(0)
#define mu_run_test(test) do {char * message = test();tests_run++;\
if(message) return message;}while(0)
static char * test_insert() {
ht_hash_ta... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* readCommand(char* currentInput, char* lastInput){
char current[1000];
char past[1000];
char cmd[6];
char value[980];
int exitNum;
char toReturn[1000];
strcpy(current, currentInput);
strcpy(past, lastInput);
strncpy(... |
C | //EEPROM emulation library for STM32F1XX with HAL-Driver
//V2.0
//define to prevent recursive inclusion
#ifndef __EEPROM_H
#define __EEPROM_H
//includes
#include "stm32f1xx_hal.h"
//-------------------------------------------library configuration-------------------------------------------
//number of variables (ma... |
C | // This program sets up GPIO pin 24 as an input pin, and sets it to generate
// an interrupt whenever a rising edge is detected. The pin is assumed to
// be connected to a push button switch on a breadboard. When the button is
// pushed, a 3.3V level will be applied to the pin. The pin should otherwise
// be pulled low... |
C | #include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "arm_general.h"
void setBit(word32* word, int index) {
*word |= 1 << index;
}
// inclusive start_index, exclusive end_index, indices start from LSB to MSB
word32 getBits(word32 word, int start_index, int end_index) {
word32 m... |
C | #include "common.h"
#include "config.h"
#include "options.h"
#include "flashlog.h"
uint32_t FlashLogFreeAddress = 0;
FLASHLOG_IBG_RECORD FlashLogIBGRecord;
FLASHLOG_GPS_RECORD FlashLogGPSRecord;
SemaphoreHandle_t FlashLogMutex = NULL;
#define TAG "flashlog"
void flashlog_erase(uint32_t untilAddress) {... |
C | /*
* Honors project for CS241 by Ellis Hoag
*
* To compile on mac:
* gcc main.c cl_fluid_sim.c sdl_window.c -framework OpenCL -framework OpenGL -framework SDL2 -ofluid
*/
#include <unistd.h>
#include "sdl_window.h"
#include "cl_fluid_sim.h"
#define WINDOW_WIDTH 600
#define WINDOW_HEIGHT 600
#define MAX_FPS 30
... |
C | /**
* Rewrite the routines day_of_year and month_day with pointers instead of indexing
*/
#include <stdio.h>
static char daytab[2][13] = {
{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, // non-leap
{0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, // leap
};
int day_of_year(int, int, int);
v... |
C | #include "estudiantes.h"
Alumno aprendiz;
/** Guardar nombre **/
void guardarNombreCompleto(char *n, char *a){
aprendiz.nombre = (char *) malloc(strlen(n)*sizeof(char));
aprendiz.nombre = strcpy(aprendiz.nombre, n);
aprendiz.apellidos = (char *) malloc(strlen(a)*sizeof(char));
aprendiz.apellidos = strcpy(aprendi... |
C | /******************************************************************************
* Pwarp.c
*
* MEX file to do projective warp
* Fast version for contiguous image based on first differences
* Same functionality as Pwarp.m (but about 8 times faster for 640*320 warp)
*
* Copyright (c) 1998 Frank Dellaert
* All righ... |
C | #include "globals.h"
char * getHomeDirectory()
{
size_t size=40000;
char * tempdir=(char*)malloc(size);
tempdir=getcwd(tempdir,size);
return tempdir;
}
char* giveDirectory(char* home)
{
size_t size=40000;
char * tempdir=(char*)malloc(size);
tempdir=getcwd(tempdir,size);
int i=0;
char* currdir=(char*)malloc(siz... |
C | #include<stdio.h>
int main(){
int i,j,count=0;
i=1; j=7;
while(i!=11){
printf("I=%d J=%d\n", i,j); j--;
printf("I=%d J=%d\n", i,j); j--;
printf("I=%d J=%d\n", i,j); j--;
i += 2;
j += 5;
}
return 0;
}
|
C | /*
FILE NAME: daifugo_client.c
DESCRIPTION:
クライアントの処理
*/
#include "daifugo.h"
int main(int argc, char *argv[])
{
CARD_DATA field[MAX_PLAYER_CARD+1] = { EMPTY };
CARD_DATA select[MAX_PLAYER_CARD+1] = { EMPTY };
PLAYER_DATA all_player_data[PLAYER_NUM];
int turn;
int select_card_num;
int field_statu... |
C | #include "strlib.h"
char *
_strcpy(dst, src)
char *dst;
char *src;
{
int i;
i = 0;
while (src[i])
{
dst[i] = src[i];
i += 1;
}
dst[i] = '\0';
return (dst);
}
|
C | /**
* \file
*
* \brief Empty user application template
*
*/
#include <asf.h>
#include "PID.h"
#include "HMI.h"
#include "matlabcomm.h"
#include <math.h>
#include "timer_delay.h"
#include "my_adc.h"
#include "lcd_shield.h"
#include "global_variables.h"
/* Define a variable of the type xSemaphoreHandle */
xSemaph... |
C | #include<stdio.h> //vladimir drob 312964844
int main()
{
char a, b, c;
int diff;
printf("plese enter two chars with space between them\n");
scanf_s("%c", &a);
scanf_s("%c", &b);
scanf_s("%c", &c);
if (b !=' ')
{
printf("error! type space between the chars\n");
return 1;
}
diff = a... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* input_wordmove.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
int quit = 0;
getstring(FILE *f, char *s, long len)
{
long i;
for (i=0; i<len; i++)
if ((s[i] = fgetc(f))==EOF) quit = 1;
s[len] = '\0';
}
char name[9];
char blockname[5];
char sizebuf[5];
main(int argc, char **argv)
{
FILE *fp;
long blocksize;... |
C | #include<stdio.h>
int length(char *str)
{
int l=0;
while(*str != '\0')
{
l++;
str++;
}
return l;
}
int compare(char *str1,char *str2)
{
int flag=1;
if(length(str1)==length(str2))
return 0;
while(*str1 != '\0')
{
if(*str1 != *str2)
{
str1++;
str2++;
flag=0;
}
else
str1++;
... |
C | #include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/sleep.h>
#include <util/delay.h>
enum {
DELAY_MS_DEBOUCE = 50,
DELAY_MS_MOVE = 300,
LED_MIN = 0,
LED_MAX = 11,
NUM_LEDS = 12,
PLAYER_0 = 0,
PLAYER_1 = 1,
};
uint8_t direction[] = {
0b0011,
0b0011,
0b0101,
0b0101... |
C | //Ŀ
//ʱ临ӶΪO(N)
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* struct TreeNode *left;
* struct TreeNode *right;
* };
*/
typedef struct TreeNode* STDataType;
typedef struct Stack
{
STDataType* _a;
int _top;//ջ
int _capacity;
}Stack;
void StackInit(Stack* ps, int n)
{
assert(... |
C | #include<stdio.h>
int log(int n);
int main(void){
int i,vezes;
int n,x;
scanf("%d", &vezes);
for(i=0;i<vezes;i++)
{
scanf("%d",&n);
printf("%d\n",log(n));
}
return 0;
}
int log(int n){
static int i=0;
int aux;
if(n == 1)
{
aux = i;
i = 0;
return aux;
} ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "db.h"
typedef struct treenode {
char *key;
char *value;
struct treenode *left;
struct treenode *right;
} *TreeNode;
void printIntro(void){
puts("Welcome to");
puts(" ____ ____ ");
puts("/\\ _`\\ /\\ _`\\ ");
puts("\\ ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.