language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> int main(void) { int i, j,k; int n1,n2,n3,cnt=0; scanf("%d %d %d", &n1,&n2,&n3); for(i=0; i< n1; i++){ for(j=0; j< n2; j++){ for(k=0; k< n3; k++) { printf("%d %d %d\n",i,j,k); cnt++; } } } printf("%d",cnt); return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_printf.c :+: :+: :+: ...
C
#include <stdio.h> int main() { int sum = 0; for(int i = 0; i < 10; i++){ if(i % 2) continue; /*相当于if(i%2 != 0),跳过所有奇数*/ sum += i; /*迭代,加上所有偶数*/ } printf("%d\n", sum); } /*c中,0表示False,所有非0的数表示True*/
C
#include <stdio.h> #include <stdlib.h> #define N 27 int numPassengers = 3; int numCars = 6; struct Graph { struct Node* head[N]; }; struct Node { int dest, weight1,weight2,weight3; int passenger; struct Node* next; }; struct Edge { int src, dest, weight1,weight2,weight3; }; struct Graph* cr...
C
#include <stdio.h> int Ackermann(int m, int n){ if(m == 0) return n + 1; else if(n == 0) return Ackermann(m - 1, 1); else return Ackermann(m - 1, Ackermann(m, n - 1)); } int main(){ int m, n; scanf("%d %d", &m, &n); printf("%d", Ackermann(m, n)); return 0; }
C
#include <stdio.h> void ft_ultimate_ft(int *********nbr); int main() { int n; void *ps[9]; ps[0] = &n; for (int i = 1; i < 9; ++i) ps[i] = &ps[i-1]; ft_ultimate_ft(ps[8]); printf("%i\n", n); }
C
#include<stdio.h> void main() { int a,i,j,k; scanf("%d",&a); for(i=a;i>=1;i--) { k=1; for(j=1;j<=a;j++) { if (i<=j) printf("%d",k++); else printf(" "); } printf("\n"); } }
C
/*Implementa un programa que imprima un saludo simple para el usuario, como se muestra abajo. $ ./hello hello, world*/ #include "stdio.h" int main(void){ printf("hello, world\n"); }
C
#ifndef _HASHTABLE_H #define _HASHTABLE_H /*Definitions for abstract hashtable */ struct htable_data; typedef int boolean_t; typedef struct htable_data* htable_t; extern unsigned htable_num_eles(htable_t ht); /* create and return new hashtable else return null*/ extern htable_t htable_create(); /*destroy the ta...
C
#include <stdio.h> #include <stdint.h> #include <NDL.h> // extern int NDL_Init(uint32_t flags); // extern void NDL_Quit(); // extern uint32_t NDL_GetTicks(); int main() { NDL_Init(0); uint32_t start = NDL_GetTicks() / 1000; uint32_t now = NDL_GetTicks() / 1000; while(now - start < 1) { now = NDL_GetTi...
C
#include <GL/gl.h> #include <GL/glext.h> #include <H:/glut.h> #include <math.h> /* This program illustrates the use of the Idle Callback, in this case to carry out some animation. It draws a rotating square. */ float theta = M_PI/4; GLfloat x1,x2,yy1,yy2; void display(void) { glClearColor(0.0,0.0,1...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_rounding.c :+: :+: :+: ...
C
#include <msp430.h> #include "rand.h" #include "dice.h" #include "dual7_seg.h" #include "lcd.h" /* Function prototypes */ void gpio_init(void); #define ROLL_SEM 0x01 #define PRINT_SEM 0x02 /* Indices in string that indicate how many faces we're rolling */ #define STR_DIG_1 10 #define STR_DIG_2 11 unsigned sem; in...
C
#include<stdio.h> #include<string.h> int i,j,n,m; int p[1000],check[1000];//判断刚刚进来的是等着还是晒着。 char s[500]; int main() { while(scanf("%d",&n),n) { memset(p,0,sizeof(p)); memset(check,0,sizeof(check)); scanf("%s",s); m=0; for (i=0;i<strlen(s);i++) { if (p[s[i]]) { p[...
C
/* * This file is part of the id3v2lib library * * Copyright (c) 2013, Lorenzo Ruiz * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "header.h" #include "utils.h"...
C
#include <stdio.h> #include <stdlib.h> int Sequential_Search(int *a, int n, int key){ int i; for(i = 0; i < n; i++){ if(a[i] == key){ return i; } } return 0; } int Sequential_Search2(int *a, int n, int key){ int i; a[0] = key; i = n; while(a[i] != key){ ...
C
/* Startup and setup */ #include "main.h" /* Size of buffer for reading lines from input file */ #define MAXLINELENGTH 128 /* Read points from input file to array in memory */ void input(char *path) { FILE *f; char inputLine[MAXLINELENGTH]; float x, y, e, maxe = 0.0; int i, pointsSoFar = 0; f =...
C
#include "timer.h" #include "../drivers/screen.h" #include "../libc/function.h" #include "isr.h" #include "ports.h" int tick = 0; //timer_callback is of type *isr_t // static void timer_handler(registers_t* r){ ++tick; (void)r; } void init_timer(int freq){ //PIT0 couples to IRQ0 register_interrupt_ha...
C
#include <stdio.h> float avg(float a, float b, float c, float d, float e); int main(void) { printf("%f", avg(1.0, 2.0, 3.0, 4.0, 6.0)); return 0; } float avg(float a, float b, float c, float d, float e) { return ((a+b+c+d+e) / 5.0); }
C
#include <stdlib.h> //#include<time.h> #include <string.h> //#include <stdint.h> #include <stdio.h> int tlb_queue[10]; int tlb_queue_size=0; int head=-1; int tail=-1; int size=0; int page_size = 4096; void swap(int total_number_of_bytes,char *buffer,char **page_table){ int total_number_of_pages = total_numbe...
C
#include <stdio.h> #include <stdlib.h> #include "hashtable.h" int main(int argc, char **argv) { hashtable *ht = init(1); const char *x = "abhinav"; int age = 22; const char *y = "abcd"; put(&ht, "name", (void *) x); printf("size: %d, maxsize: %d\n", ht->size, ht->max_size); put(&ht, "age", ...
C
/************************************************************** * Name : ex1-4.c * Author : Bronze Lee * Version : 0.1 * Date : 2017年2月13日 **************************************************************/ #include <stdio.h> /*print Celsius-Fahrenheit table for celsius = -20, -10, ...,100 */ /*---...
C
#include "myLib.H" namespace Foam { myLib::myLib() : name_("none"), ID_(0) { } myLib::myLib(word name, label ID) : name_(name), ID_(ID) {} myLib::myLib(dictionary dict) : name_(dict.lookup("name")), ID_(readScalar(dict.lookup("ID"))) {} myLib::~myLib() { Info << "I'm killed " << endl; } cons...
C
#include <stdio.h> #include <stdlib.h> int main(void) { int num[3]; int i, j, a; printf("Enter three intergers, and I will tell you\n"); printf("the biggest and the smallest integer"); scanf_s("%d %d %d", &num[0], &num[1], &num[2]); for (i = 0; i <= 3; i++) { for (j = 0; j <= 1; j++) { if (num[i] < num...
C
#include <bfd.h> #include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "section.h" #include "general.h" void print_ascii(char character) { printf("%c", character >= ' ' && character <= '~' ? character : '.'); } void print_padding(int64_t size) { if (s...
C
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * File: main.c * Author: apacot * * Created on 29 septembre 2020, 10:44 */ #include <stdio.h> #include <stdlib.h> /* * ...
C
#include<stdio.h> #include <conio.h> char board[3][3] = {{'1','2','3'}, {'4','5','6'}, {'7','8','9'}}; int player=0,choice=0; int CheckForWin(); void drawboard(); void markboard( char mark); int main(void) { int gamestatus=0; char mark; player=1; ...
C
// // Created by Horvath on 2021. 05. 25.. // #include "array.h" Array createArray(int size){ Array res; res.size=size; res.count=0; res.names=(Name*)malloc((res.size+1)*sizeof(Name)); return res; } void addName(Array *res,Name name){ res->names[res->count]=name; res->count++; } bool find...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_julia_event.c :+: :+: :+: ...
C
/* Codegenerator for CRC32 as used in RFC1951 (GZip 4.3) This is the same CRC32 as specified in ISO 3309 and ITU-T V.42 */ /* Copyright (c) 2018, Thomas Spielauer All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following condit...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <pthread.h> #define NUM_THREADS 3 #define LIMIT 12 #define TCOUNT 10 #define ADD_COUNT 125 pthread_t thrd[NUM_THREADS]; pthread_mutex_t mutex; pthread_cond_t cond; int count; /* a thread function for accumulating count */ void *inc_count(void *args);...
C
#include<stdio.h> int main() { int ara[15]; int i; for(i=0; i<15; i++) ara[i] = i; ara[9] = ara[9] + 500; for(i=0; i<15; i++) printf("%d ",ara[i]); }
C
#include <stdio.h> void ssort(double *v, int tam){ int i, j; double aux; for ( i = 0; i < tam; ++i) { for ( j = i; j < tam; ++j) { if (v[j] > v[i]) { aux = v[j]; v[j] = v[i]; v[i] = aux; } } } }
C
#include "buttons.h" // PMW instance APP_PWM_INSTANCE(PWM2, 2); // Setup a PWM instance with TIMER 2 static volatile int ready_flag = true; void button_handler(uint8_t pin_no, uint8_t button_action) { NRF_LOG_INFO("Button press detected \r\n"); if(pin_no == BUTTON_1 && button_action == APP_BUTTON_PUSH) ...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <assert.h> #include "dynamicArray.h" #define PI 3.14159 #define E 2.71828 /* param: s the string param: num a pointer to double returns: true (1) if s is a number else 0 or false. postcondition: if it is a number, num will hold the value...
C
#define ANSI_COLOR_RED "\x1b[31m" #define ANSI_COLOR_GREEN "\x1b[32m" #define ANSI_COLOR_YELLOW "\x1b[33m" #define ANSI_COLOR_BLUE "\x1b[34m" #define ANSI_COLOR_MAGENTA "\x1b[35m" #define ANSI_COLOR_CYAN "\x1b[36m" #define ANSI_COLOR_RESET "\x1b[0m" #define printf_color(color, ...) \ do { ...
C
#ifndef GRAPH_H #define GRAPH_H // Definizione della struttura "grafo". // E' rappresentato con 2 liste, una per i nodi ed una per gli archi. // In ogni nodo c'è una lista dei suoi archi(ovvero gli archi di cui è from/to). // Le liste in questione sono doppiamente concatenate. typedef struct node_list node_li...
C
#include <stdlib.h> #include <stdio.h> #include "../include/babak_lib.h" void swapByteOrder(char *in, int4 N) { char *dum; if(N<=0) { printf("\n\nWarning swapByteOrder(): Non-positive array dimension argument.\n\n"); return; } if(in==NULL) { printf("\n\nWarning swapByteOrder(): NU...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <ctype.h> int isSafe(char s[]) { int i = 0; int length = strlen(s); int u = 0; int l = 0; int d = 0; for(i =0; i < length; i++) { if(isupper(s[i])) u++; if(islower(s[i])) ...
C
#include <stdio.h> #include <string.h> struct std { char name[20], idno[25], station[25]; float cgpa; }; void main () { int n, i; char ele[100]; scanf ("%d", &n); struct std s[n]; for (i = 0; i < n; i++) { scanf ("%f", &s[i].cgpa); gets (s[i].name); gets (s[i].idno); gets (s[...
C
/* Database "company_1" contains tables: department department_locations dependent employee project works_on */ #ifndef COMPANY_1 #define COMPANY_1 struct T_department { char department_name[15]; double department_number; double manager_ssn; char manager_start_date[11]; }; struct T_department_locations { ...
C
#include <stdio.h> int main () { char characters[7]; char *ptr=characters; printf("Enter 7 characters: "); for(int i=0;i<7;i++){ scanf("%s", ptr+i); } printf("The characters you entered is %s\n", characters); return 0; }
C
//Memory-Management-Simulator---Best-Fit-Algorithm //Simulator for the memory management portion of an operating system with fixed partition scheme using best-fit algorithm /* Memory: 32 KB Scheme: Fixed Algorithm: Best-Fit No. of Partitions: Partition 1: 4 KB Partition 1: 4 ...
C
#include <stdio.h> void pre_order_traverse(node_t *tree) { if (tree == NULL) return; /* you can change printf to any operations you want */ printf("%d\n", tree->data); pre_order_traverse(tree->lchild); pre_order_traverse(tree->rchild); }
C
//Write the program to print "Hello World !" #include <stdio.h> #define MAX_SIZE 100 int main() { char name[MAX_SIZE]; printf("Enter your name: "); scanf("%s",name); printf("Your name: %s\n",name); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <limits.h> struct Object { int *nums_lhs; int len_lhs; int *nums_rhs; int len_rhs; }; struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; }; struct TreeNode *make_tree(int *nums, int pos, int size) ...
C
#include <stdio.h> #include <conio.h> int main() { int i=0; while(i<=5) { printf("\n INDIA" "\n I LOVE INDIA"); i++; } printf("\n Thanks"); return 0; }
C
#include <stdio.h> #include <stdlib.h> int count_words(char* text) { if (text[0] == '\0') { return 0; } int yy = 1; for (int ii = 0; text[ii] != '\0'; ++ii) { if (text[ii] == ' ') { yy += 1; } } return yy; } char** alloc_stra(int nn) { char** yy...
C
//***************************************************************************** // main.c // Author: jkrachey@wisc.edu //***************************************************************************** #include <stdio.h> #include <stdint.h> #include <string.h> #include "TM4C123.h" #include "driver_defines.h" #include "va...
C
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]){ if(argc != 2) return -1; int s=atoi(argv[1]); if(!s){ puts("Division by zero detected -- aborting"); s=1/s; } printf("The entered number was %d\n", s); return 0; }
C
/************************************************************************* > File Name: httpd.c > Author: fx > Mail: 1007160080qq.com > Created Time: Fri 18 Aug 2017 07:50:06 AM PDT ************************************************************************/ #include"httpd.h" void print_log(const char* str,int err...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #ifndef RED_BLACK_CODE_H_ #define RED_BLACK_CODE_H_ typedef struct Red_black red_black; typedef struct root_rb root; //Creates an empty tree and sets it as root root_rb *create_root_tree (); //Creates a new node of the tree red_black *add_red_black (int da...
C
/** * Hash chain functions for packet authentication and * packet signatures * * Description: * * Authors: * - Tobias Heer <heer@tobobox.de> 2006 * - Rene Hummen <rene.hummen@rwth-aachen.de> 2008 * * Licence: GNU/GPL * */ #ifndef HASH_CHAIN_H #define HASH_CHAIN_H #include <openssl/rand.h> #include <op...
C
#include <stdio.h> #include <string.h> #include <lua.h> #include <lauxlib.h> #include <lualib.h> /* // 27.1: Compile and run the simple stand-alone interpreter (Figure 27.1, “A bare-bones stand-alone Lua interpreter”). int main(void) { char buff[256]; int error; lua_State *L = luaL_newstate(); luaL_openlibs(L); ...
C
/** Составьте программу, которая принимает с клавиатуры целое число, соответствующее порядковому номеру месяца. В случае, если полученное значение равно порядковому номеру одного из месяцев, следует вывести сезон (лето, осень, зима, весна), к которому относится месяц. В случае, если введенное значение не...
C
#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> //ֲ̬ void Test()//һTest { static int i = 0; i++; printf("%d\n",i); } int main(){ int i = 0; for (; i < 10; i++) { Test();//Testĵ } return 0; }
C
#include <string.h> #include <stdlib.h> #include "../stack/stack.h" #include "tree.h" /* From leetcode 208 */ /** Initialize your data structure here. */ Trie* trieCreate() { Trie *t = (Trie*) malloc(sizeof(Trie)); memset(t, 0, sizeof(Trie)); t->end = 0; return t; } /** Inserts a word into the trie. */ ...
C
#include <stdio.h> #include <stdlib.h> #include <strings.h> #include <string.h> #include <unistd.h> #include <sysexits.h> #include <ctype.h> #include <wordexp.h> #include <time.h> #include <sys/types.h> #include <sys/socket.h> #include <arpa/inet.h> #include <netdb.h> /* * Autores: * * Barata...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <dirent.h> #include <sys/defs.h> #include <sys/syscall.h> DIR *opendir(const char *name) { int fd = -1; if (-1 == (fd = open(name, O_DIRECTORY))) { printf("open : %s failed.", name); return NULL; } DIR *dir = (DIR *...
C
#include <stdlib.h> int main(void) { /* Valgrind can detect that this allocates memory that is never freed: */ int *arr = (int *)malloc(sizeof(int) * 4); return *arr; }
C
#include "os.h" #include "draw3.h" #include "imgtools.h" void drawellipse(Image *dst, Rect dstr, intcoord *a, intcoord *b, intcoord rad, int pscl, uchar *color) { u32int *dstp, *dst_end, *dst_ustart, *dst_uend; u32int color32; int dst_stride; int u, v; intcoord ab[2]; intcoord tmp; /* todo: do the bounding b...
C
void p(char *buf, char *s) { char big_buffer[4104]; char *ptr; puts(s); read(0, big_buffer, 4096); ptr = strchr(big_buffer, '\n'); *ptr = 0; strncpy(buf, big_buffer, 20); } void pp(char *buff) { char s1[20]; char s2[20]; p(s1, " - "); p(s2, " - "); strcpy(buff, s1); buff[strlen(s1)] = ' '; strcat(buff...
C
// // main.c // ReadWAVHeader // // Created by Mathias Lyngklip Kjeldgaard on 03/03/2017. // Copyright © 2017 Mathias Lyngklip Kjeldgaard. All rights reserved. // #include <stdio.h> // #define DEBUG_Mine 1 // #define WAVE_FILEN "kick.wav" // const char WAVE_FILEN[] = "kick.txt"; #ifdef DEBUG_Mine const char ...
C
/* Huffman Code */ #include <cstdio> #include <cstdlib> #include <string> #include <iostream> #include <bitset> #include <fstream> #include <ctime> #define CharCount 256 using namespace std; /*Huffman Tree's Node*/ struct TreeNode{ int value; int alpha; string code; TreeNode * lChild; TreeNode * ...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/wait.h> #include <fcntl.h> #include <sys/stat.h> #include <sys/types.h> #include <mqueue.h> #include <sys/mman.h> #include <semaphore.h> #define BSIZE 4 // Rozmiar bufora #define LSIZE 80 // Dlugosc linii typedef struct { char bu...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> struct person { char name[30]; int age; }; void bubbleSortint(struct person *p, int n) { int temp_age; char temp_name[30]; for (int i = 0; i < n-1; i++){ for (int j = 0; j < n-i-1; j++){ if ((p+i)->age > (p+i+1)->age){ ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <limits.h> #include <stdlib.h> #define MAX_LINE_LENGTH 255 enum { DONE, OK, EMPTY_LINE }; struct lable{ int location; char* lable; }; int main(int argc, char* argv[]) { int isOpcode(char * lPtr){ ...
C
#include <stdio.h> int main () { int b[20][20]; int maxmul = 0; // read in buffer FILE *fp; fp = fopen("b.txt", "r"); for (int i = 0; i < 20; i++) { for (int j = 0; j < 20; j++) { fscanf(fp, "%d", &b[i][j]); } } fclose(fp); for (int i = 0; i <= 20 - 4; ...
C
#include <stdio.h> int main () { system("color 74"); int v1,v2,aux; printf("Por favor, Ingresa el valor de la variable Uno: \n"); scanf("%i", &v1); printf("Por favor, Ingresa el valor de la variable Dos: \n"); scanf(" %i", &v2); //en la siguiente linea estamos imprimiendo integerA printf("Tu valor ...
C
/* Lee cadenas de caracteres hasta n-1 caracteres O hasta que lea un salto de linea "\n" o el final del archivo EOF char *fgets(char *buffer, int tamanio, FILE *archivo); */ #include <stdio.h> #include <stdlib.h> int main(void){ FILE *archivo; char sCaracteres[100]; archivo = fopen("gente.txt","r"); if(ar...
C
#include <stdio.h> int main(void) { char str[100]; char comment[100]; int flag = 0; int i = 0; int j = 0; printf("Enter your line of code: \n"); scanf("%s", str); // main loop reads characters until we find '/' for (i = 0; i < sizeof(str); i++) { if (str[i] == '*' && str[i+1] == '/' && flag == 1) bre...
C
//Program to calculate the factorial of a number #include<stdio.h> int i,n; unsigned long long f=1; int itr_fact(int); int rec_fact(int); int main() { // int i,n; // unsigned long long f=1; printf("Enter an integer =\t"); scanf("%d",&n); printf("\n Factorial using iterative funct...
C
/* 1- Variaveis 2- Substituio de variaveis 3- Leitura de dados digitados */ #include <stdio.h> int main(void) { int numero = 46,altura; float valor = 8.37,comprimento; char letra = 'X',nome[50],sobrenome[50]; printf("Variavel numero: %d \n",numero); numero+=10; printf("Variavel nu...
C
// // MultiplicityRatio - // // M. H. Wood, Canisius College //-------------------------------------------------------------------------------------------- #include <stdio.h> #include <stdlib.h> #include <iostream.h> gROOT->Reset(); Int_t lcol[10] = {1,2,4,6,7,8,9,12,14,15}; Int_t mkr[10] = {20,21,22,24,23,25,26,27...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> int funkzia_proverki_vvoda() { int k; while(system("pause"),fflush(stdin),system("cls"),printf(" : "),scanf("%i",&k)!=1||k>20||k<=0) printf("! \n"); return k; } void funkzia_vvoda_mass(int a[],int n) { int i; for (i=0;i<n;i++) while(print...
C
//C Program to find the simple interest #include<stdio.h> int main() { int p,t,r; //p-principal t-time r-rate float interest; printf("enter the value of p,t,r"); scanf("%d %d %d",&p,&t,&r); interest=(p*t*r)/100; printf("interest: %f",interest); return 0; }
C
// run with below command on terminal // gcc -o call.out blocking-call.c #include "stdio.h" #include <unistd.h> void fp() { printf("3\n"); } void fp_call(void (*fp)(void)) { fp(); } int main() { printf("1\n"); printf("2\n"); usleep(1000 * 2000); fp_call(&fp); return 0; }
C
#include <stdio.h> int main(int argc, char** argv) { FILE* file; file = fopen(argv[1],"w"); if(file == NULL){ printf("Something went wrong. Too few arguments?"); } fprintf(file,"Some text %s\n", "THIS IS A TESTFILE, PLEASE IGNORE"); fclose(file); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <math.h> /* Use of pow function */ #include <complex.h> /* Makes the use of complex numbers much easier */ #include <fftw3.h> /* Used for FFTs */ #include "multislice.h" /* Contains definitions and some function declarations */ int main() { /* Gets the required...
C
/* * motores.c * * Created on: Mar 14, 2020 * Author: augusto */ #include <motores.h> #include <HPL_GPIO.h> #define MOTORES_USE_PWM #define MOTORES_AMOUNT 2 #define MOTORES_PIN_AMOUNT 2 #define MOTORES_OPEN_IDX 0 #define MOTORES_CLOSE_IDX 1 #define MOTORES_PWM_MAX 20 #define MOTORES_PWM_OP...
C
#include <cs50.h> #include <stdio.h> #include <ctype.h> #include <string.h> #include <stdlib.h> int main(int argc, string argv[]) { if (argc == 2) { //validate string input argv[1] consists of digits only for (int i = 0, len = strlen(argv[1]); i < len; i++) { if (isdigit(a...
C
#ifndef INC_chacks_btree_H #define INC_chacks_btree_H struct btree_node { void *data; struct btree_node *l; struct btree_node *r; }; typedef int (*BTREE_NODE_EQUALS) (const void *a, const void *b); /* * Find node which matches data. */ extern int btree_find(const struct btree_node *n, const void *data, ...
C
// oscbndlsend.c - test program to send OSC bundles // // this test is designed to run with either oscbndlrecv.c or lo_bndlrecv.c // We'll send 5 bundles: // at NOW+2.9: [/xyz/msg1 1009 "an arbitrary string at 2.9"], // [/abcdefg/msg2 2009 "another arbitrary string at 2.9"] // at NOW+2.8: [/xyz/msg...
C
#include<stdio.h> #include<stdlib.h> struct aluno{ int ra; char nome[20]; }; main(){ struct aluno al[3]; //ra printf("Digite um primeiro RA: "); scanf("%d", &al[0].ra); printf("Digite um segundo RA: "); scanf("%d", &al[1].ra); printf("Digite um terceiro RA: "); scanf("%d", &al[2].ra); printf...
C
#include <stdio.h> int main() { int i, n, f; f=0; scanf("%d", &n); if(n % 2 == 0) for(i=0;i<=n;i++) f += i; else for(i=1;i<=n;i+=2) f += i; printf("%d", f); return 0; }
C
// Voltage Reading program for FFL Dewey Robot // Author Ken Samuelson // Date started 6/18/2017 // Last update by Ken Samuelson 8/19/2017 // Copyright Unpublished work Ken Samuelson 2017 all rights reserved. #include "Arduino.h" #include "def.h" unsigned long voltageMillis = millis(); // voltagePin voltRead = ELE...
C
/* ** my_putstr.c for my_putstr in /home/JB.Melet/CPool_Day04 ** ** Made by JeanBaptiste Melet ** Login <JB.Melet@epitech.net> ** ** Started on Thu Mar 2 09:36:28 2017 JeanBaptiste Melet ** Last update Sun Apr 16 20:30:32 2017 JeanBaptiste Melet */ #include "printf.h" int my_putstr(char *str) { int i; i = 0;...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <time.h> #include <string.h> /* Prototype */ int bingoGenerator(int length, int width, char randChoices[30][30], char bingoBoard[length][width][30]); int randomizer(char choices[30][30], char randChoices[30][30]); void bingoPrinter(int length, ...
C
#include <sys/types.h> #include <sys/wait.h> #include <errno.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char *argv[]) { char usrInput[256], *prog_argv[64]; int i, status; pid_t sxpid; //gethostname(hostn, sizeof(hostn)); //user = (char *)getenv("USER"); /...
C
#include <stdio.h> #include <string.h> #include "lisp_def.c" //prototype definitions int __fn_main_0(); int __fn_main_1(); int __fn_main_print_hello_world_0(); void print_hello_world_0 (); int __fn_main_hello_name_0(); void hello_name_0 (char* name); int __fn_main_sum_up_to_n_0(); int __fn_main_sum_up_to_n_1(); int su...
C
//Nome do programa: deithel.c //Nome do Autor: Eduardo Felizardo Cândido //Data de Criação: 29/06/2019 //Descrição ou Finalidade: /*5.9 Tarifa de estacionamento. Um estacionamento cobra uma tarifa mínima de R$ 2,00 por uma permanência de até três horas, e R$ 0,50 adicionais por hora para cada hora, ou parte dela, p...
C
/********************** debugput.h ************************ * * Display debug output on host via ARM DCC * * A low priority thread empties the debugOutput queue to the * host debugger communication port * * Data printed to the queue when full are discarded * (Never blocks waiting for the host) * * Does not supp...
C
/* Copyright (c) 1993 Association of Universities for Research * in Astronomy. All rights reserved. Produced under National * Aeronautics and Space Administration Contract No. NAS5-26555. * * hdecompress: decompress image using hcompress algorithm */ #include <stdio.h> #include <stdlib.h> #include <math.h> #i...
C
#include<stdio.h> void subset(int arr[], int subarray[], int start, int arraysize, int index, int sub){ int i, j; if(index == sub){ for(j = 0; j < sub; j++){ printf("%d", subarray[j]); } printf("\n"); return; } //&& arraysize - i + 1 >= sub - index for(i = start; i <= arraysize ; i++){ //i+1 is t...
C
#include<stdio.h> main() { int i; char a[10],b[10]; printf("enter the string..."); scanf("%s",a); printf("%s\n",a); for(i=0;a[i];i++) printf("%c ",a[i]); printf("\n"); for(i=0;a[i];i++) b[i]=a[i]; b[i]=a[i]; for(i=0;b[i];i++) printf("%c ",b[i]); printf("\n"); for(i=0;a[i];i++) if(a[i]>='a' && a[i]<=...
C
#include <arpa/inet.h> #include <stdlib.h> #include <stdio.h> #include <errno.h> #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <string.h> #include <netdb.h> int hostname_to_ip(char* domain, struct sockaddr_in *_addr); void get_domain(char *address, char **domain, char **destination, c...
C
/** @file */ #ifdef _MSC_VER #define _CRT_SECURE_NO_WARNINGS #endif #include <stdio.h> #include <stdbool.h> #include "functions.h" Table* AddTable(Table** pHead, int number) { bool exists = false; //istnienie stolika Table* p; //dodawanie na poczatek if (*pHead == NULL || (*pHead)->number >= num...
C
/* Trabalho 1 Parte 2 Gabriel Carvalho Silva */ #include <stdio.h> #include <stdlib.h> #include <time.h> int main() { srand(time(0)); /*Generates the seed for the random number*/ int secretNumber = rand() % 101; /*Secret Number Declaration and Generation*/ int usrGuess, usrAttempts = 1; /*...
C
/* Creating of Test Data Version 0.1 from 12.11.01 12:15 Uhr */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <time.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include "kbs_RandomStringFile.h" #include "kbs_RandomString.h" #include "...
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(int argc, char *argv[]) { float r,h,g,A,V; const float Pi=3.1416; printf("Ingresar el radio y la altura \n"); scanf("%f,",&r); scanf("%f,",&h); g=sqrt(r*r+h*h); A...