language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* backround.c :+: :+: :+: ...
C
#include <stdio.h> int strrem(char *palabra, char target); int main() { char palabra[]={'v','a','l','e','r','i','a','\0'}; char target='a'; int resultado=strrem(palabra,target); printf("%s\n",palabra); printf("se eliminaron %d letras\n",resultado); return 0; } int strrem(char *palabra, char target) { int bor...
C
/* * Rewrite the function lower, which converts upper case letter to lower case, with a conditional expression instead of if-else . */ #include <stdio.h> char lower(char c); int main() { printf("%c\n", lower('B')); printf("%c\n", lower('A')); return 0; } char lower(char c) { return c >= 'A' &&...
C
#include <sys/terminal.h> #include <sys/utils.h> #include <sys/kprintf.h> #include <sys/kb.h> terminal_t terminal; char data_buffer[TERMINAL_BUFFER_SIZE]; uint8_t data_buffer_ready = 0; void init_terminal() { memset(&terminal, 0, sizeof(terminal)); terminal.buffer[0] = '>'; terminal.buffer[1] = ' '; terminal...
C
#include <stdio.h> // Header File int main() // starting { int a = 10; printf("Hello There!\nThis is my Value: %d\n", a); return 0; // end }
C
#include <fcntl.h> #include <sys/mman.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <stdint.h> #include <stdio.h> #define PRINT_VALUE(XXX) \ printf(#XXX ": 0x%0llx\n", (unsigned long long) XXX); int main() { PRINT_VALUE(MAP_SHARED) PRINT_VALUE(MAP_PRIVATE) PRINT_VALUE(MA...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <errno.h> #define is_edgeExist(a, b) schdl[i].trans_num != schdl[j].trans_num && \ !strcmp(schdl[i].cmd, a) && \ !strcmp(schdl[j].cmd, b) && ...
C
#include <passion.h> #include <math.h> enum ps_status ps_matrix_4_set_identity(struct ps_matrix_4 *this) { PS_CHECK(this, PS_STATUS_INVALID_ARGUMENT); memset(&this->data, 0, sizeof(float) * PS_MATRIX_4_SIZE); this->data[0] = 1.0f; this->data[5] = 1.0f; this->data[10] = 1.0f; ...
C
/* ** my_malloc.c for in /home/courne_l/rendu/synthese/FASTAtools/srcs ** ** Made by courneil lucasc ** Login <courne_l@epitech.net> ** ** Started on Mon Jun 20 09:43:34 2016 courneil lucasc ** Last update Mon Jun 20 09:43:36 2016 courneil lucasc */ #include <stdlib.h> void *my_malloc(unsigned int t) { char *...
C
/* Write a program to copy one string into another and count the number of characters copied*/ #include<stdio.h> int main(){ char o[1000],d[1000]; int i; printf("Enter a string:\t"); gets(o); for(i=0;o[i]!='\0';i++){ d[i]=o[i]; } printf("Length of string: %d\n",i); printf("Cop...
C
/* * vdsp_abs.c * AccelerateTest * * Created by sonson on 10/08/15. * Copyright 2010 __MyCompanyName__. All rights reserved. * */ #include "vdsp_abs.h" static void check_absolute_value(float *a, float *b, int size) { for (int i = 0; i < size; i++) { if (*(b + i) != fabsf(*(a + i))) { printf("check_ab...
C
#include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <memory.h> #include <sys/stat.h> #ifdef _MSC_VER #define snprintf _snprintf #endif static void* memdup(void* ptr, int size) { void* ret = malloc(size); memcpy(ret, ptr, size); return ret; } static int fsize(char* filename) { ...
C
#include <stdio.h> int main () { char ao=162, ai=161; //Salto de linea printf ("Ejemplo salto de l%cnea\n",ai); printf ("Holaa\n"); printf ("Adi%cs\n\n",ao); //Tab horizontal printf ("Ejemplo tabulador\n"); printf ("Holaa\t"); printf ("Adi%cs\n\n",ao); //Alarma printf ("Ejemplo alarma\n"); printf ("Hola...
C
#include <stdio.h> #include <stdlib.h> #include "aloca.h" #include "leitura.h" #include "processamento.h" #include "saida.h" int main(int argc, char* argv[]){ /*Abre os arquivos com caminho em argv*/ FILE* in = fopen(argv[1],"r"); FILE* out = fopen(argv[2],"w"); int n, m; fscanf(in,"%d %d",&...
C
/* Operadores de pre- o post-incremento(decremento) */ #include <stdio.h> main() { int w, x, y, z, resultado; w = x = y = z = 1; /* inicializamos x e y */ printf("Dado un w = %d, x = %d, y = %d, and z = %d,\n", w, x, y, z); resultado = ++w; printf("++w tiene el valor de : %d\n", resultado); resulta...
C
/*---- I can do it ----*/ #include <stdio.h> #include <string.h> #include <math.h> int main(void) { long unsigned int n, j, i, a; int arr[20], sum1, sum2, temp, sum; while(1) { scanf("%lu", &n); j = pow(10, 15); i = n/j; if(i>=1 && i<=9) // condition for fixing the input to 16 digits only break; } ...
C
#ifndef SHARED_SOCKET_H_ #define SHARED_SOCKET_H_ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <stdarg.h> #include <sys/socket.h> #include <netdb.h> #include <unistd.h> #include <commons/collections/list.h> #include "_common_includes.h" #include "protocol.h" #define BACKLOG 100 t...
C
#include<tm_stack.h> #include<stdio.h> int main() { int succ; int x1,x2,x3,x4; int *x; x1=100; x2=200; x3=300; x4=400; Stack *stack; stack=createStack(&succ); if(stack==false) { printf("Unable to create Stack\n"); return 0; } pushOnStack(stack,&x1,&succ); if(succ) printf("%d pushed on stack\n",x1); else printf("%d u...
C
#include <stdio.h> int main(){ int c, q; float total; scanf("%d %d", &c, &q); if(c == 1){ total = q*4; }else if(c == 2){ total = q*4.5; }else if(c == 3){ total = q*5; }else if(c == 4){ total = q*2; }else if(c == 5){ total = q*1.5; } pr...
C
void main(){ unsigned cnt; // Define variable cnt void interrupt() { cnt++; // Interrupt causes cnt to be incremented by 1 TRISB_bit = 0x01; // PORTB is returned its initial value } void main() { ANSEL = 0; // All I/O pins are configured as digital ...
C
#include <pthread.h> #include <stdio.h> #include <stdlib.h> typedef struct { int res; int is_wait; pthread_cond_t cond; //条件变量 pthread_mutex_t mutex; //互斥锁 }Result; //定义计算结果的线程 void *set_fn(void *arg) { sleep(5); int i = 1, sum = 0; for(; i <= 100; i++){ sum += i; } R...
C
#include <stdio.h> struct distance { int meters; int kilo; }d1, d2, sum; int main() { printf("Enter value of d1 in meters\n"); scanf("%d", &d1.meters); printf("Enter value of d1 in kilometers\n"); scanf("%d", &d1.kilo); printf("Enter value of d2 in meters\n"); scanf("%d", &d2.meters); printf("Enter the value ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> void shift(char, int **); void changeByte(char, int *); void jumpForward(char **); void jumpBackward(char **); void loadInput(int *); void output(int); void processCommand(char **, int **); void runCode(char *); int main(void) { char code[] = "++++++++++...
C
struct studentdetails{ char *stdname; char *stddept; char sec; int stdid; } testcases[2]={ {"Jagadeesh","cse",'A',28765}, {"anil","cse",'A',28766} }; void print(int); void main() { int i; printf("Enter Studentid to print details"); scanf("%d",&i); print(i); } void print(int i) { int j,c=0; for(j=0;j<1;j+...
C
/* ucc --- compile a C program, Unix style */ /* flags for c1 */ int a_flag = FALSE; /* abort after errors */ int f_flag = FALSE; /* do not include =cdefs= */ int u_flag = FALSE; /* be more UNIX compatible */ int y_flag = FALSE; /* run "lint" */ int I_flag = FALSE; ...
C
#include<stdio.h> #include<stdlib.h> #include<time.h> int main() { int a=5; float f=((float)a)/4; printf("%f\n",f); srand(time(0)); for(int i=0;i<10;i++) { printf("%d\n",rand()%15); } return 0; }
C
/* ** EPITECH PROJECT, 2019 ** sticky_bit.c ** File description: ** manage special case */ #include "my.h" void sticky_2(t_ls *ls, struct stat fs) { if (!(fs.st_mode & S_IXGRP) && !(fs.st_mode & S_ISGID)) ls->x_oth = '-'; if ((fs.st_mode & S_IXOTH) && (fs.st_mode & S_ISVTX)) ls->x_oth = 't'; ...
C
/******************************************************************************* * Application: Demo code for Temp sensor using ADC1 Channel-16 * Edition: Version:1.0 * Company: * Time: September 2015 *******************************************************************************/ #include "hhd32f1xx.h" #include...
C
#include "otp.h" #include "hmac.h" #ifdef REGULAR #include <time.h> #else #include "time.h" #endif uint32_t hotp(uint8_t* key, size_t keylen, uint32_t count, size_t digits) { uint8_t digest[20]; // Convert bytes to an array of bytes uint8_t bytes[8] = {0}; /* bytes[0] = (count >> 56) & 0xFF; */ ...
C
#include "mssv.h" pthread_mutex_t mutex; // Mutex pthread_cond_t use; // condition for if the global variable is in use int **buff1, *buff2, *counter, maxDelay, inUse; Region *regions; int main (int argc, char* argv[]) { // Validate command line parameters validateUse(argc, argv); // Rename command lin...
C
#ifndef STEPPERMOTOR_H #define STEPPERMOTOR_H //If OCR0A is set to 1, how many interrupts would there be in one second? #define TIMER_FREQUENCY 250000 typedef struct StepperMotor { volatile long stepCount; volatile double totalCount; volatile float currentStepDelay; volatile float delayCounter;...
C
#include<stdio.h> #define ERROR -1 #define OK 0 int main(int argc, char* argv[]){ int cant_nums = 0, acum = 0, counter = 0, num = 0; while(cant_nums <= 0){ printf("enter a number of numbers: "); scanf("%d", &cant_nums); } printf("enter a secuence of nu...
C
/* ** ia_mode.c for ia_mode in /home/renard_e/progElem/CPE_2015_Allum1 ** ** Made by gregoire renard ** Login <renard_e@epitech.net> ** ** Started on Tue Feb 9 08:31:52 2016 gregoire renard ** Last update Wed Feb 10 15:12:17 2016 gregoire renard */ #include <stdlib.h> #include "include/my.h" void aff...
C
//Program for Queue implementation through Linked List #include<stdio.h> #include<conio.h> struct node { int data; struct node *link; } ; struct node *front, *rear; void main() { int wish,will,a,num; void add(int); wish=1; front=rear=NULL; printf("\tProgram for Queue as Linked List demo.. "); while(wish == 1)...
C
/* * ===================================================================== * NAME : Main.c * * Descriptions : Main routine for S3C2440 * * IDE : CodeWarrior 2.0 or Later * * Modification * Modified by MDS Tech. NT Div.(2Gr) (2007.3.1~4) * ==================================================...
C
#include <stdlib.h> #include "bsd-win-sock.h" #include "bsd-win-sock-types.h" #include "debug.h" #define T Socket_T /* Stol... I mean adapted from Beej's Guide: http://beej.us/guide/bgnet/output/html/singlepage/bgnet.html#sendall */ extern int Socket_send(T* sock, const char* msg, int len) { int total = 0; int byte...
C
/** * An implementation of a stack based on a doubly linked list. * The API is almost exacly identical to that of the linked list. * * initStack(Stack* stack) - Initialize the provided stack. * isStackEmpty - Checks if the stack is empty. * pushStack - Push a new item to the stack. * popStack(Stack* stack) - Po...
C
#if CFACTS_PATCH void getfacts(Monitor *m, int msize, int ssize, float *mf, float *sf, int *mr, int *sr) { unsigned int n; float mfacts = 0, sfacts = 0; int mtotal = 0, stotal = 0; Client *c; for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++) if (n < m->nmaster) mfacts += c->cfact; else...
C
#include<stdio.h> #include<string.h> #include<stdlib.h> #include<stdbool.h> int main(int argc, char const *argv[]) { int i=0,j=0; bool done=0,prob=0; char ch,word[40]; if(argc==1){printf("Minimal argument encountered! Please provide file name.\n"); return 0;} FILE *fileptr = fopen(argv[1],"r"); ...
C
/***************************************************************************** * プログラム名 : sample0201.c * 作成 : 2019/06/17 小山 * 内容 : 読み込んだ二つの整数値の和・差・積・商・除算を表示 ****************************************************************************/ #include <stdio.h> void main() { int value_x, value_y; puts("二つの整数を入力してください。"...
C
#include<stdio.h> int main(){ float fahrenheit, celcius; printf("%4s%21s\n","celcius", "fahrenheit"); for (celcius =30; celcius<=75; ++celcius ){ fahrenheit = celcius*(9.0f/5.0f) + 32.0f; printf("%4.1f%21.2f\n", celcius, fahrenheit); } return 0; }
C
#ifndef ML_TIME_H_HEADER #define ML_TIME_H_HEADER #include "common.h" // For internal use: 1 unit of time is a microsecond. // For convenience, when timing things: #define ML_START_TIMING(x) \ unsigned long long x = ml_time(); #define ML_STOP_TIMING(x,...) \ do { \ x = ml_time() - x; \ static unsigned lo...
C
#include "holberton.h" int getNumArgs(const char *copy) { int iterate; int counter = 0; for (iterate = 0; copy[iterate] != '\0'; iterate++) { if (copy[iterate] == '%') counter = counter + 1; } return (counter); }
C
#include <stdio.h> #include <math.h> int generate(char * inPath, char* outPath, int dataRows, double(*method)(int x)); double generator1(); int main(char* argv[], int argc){ generate("in.txt", "out.txt", 1000, &generator1); return 0; } int generate(char * inPath, char* outPath, int dataRows, double(*method)...
C
#include <stdio.h> #include <string.h> int main(void) { int cnt; scanf("%d", &cnt); char file_name[51]; int len; char result_file_name[51]; scanf("%s", file_name); len = strlen(file_name); memcpy(result_file_name, file_name, len); result_file_name[len] = '\0'; cnt--; while (cnt--) { scanf("%s", file_na...
C
/* * udp_recv.c * * Description: This file implement recvResult(), used to send results back to departments. * Reused Code: In this file, I used some pieces of code from "Beej's Guide to C Programming and Network Programming" from page 27 to page 34 * Created on: Jul 31, 2015 * Author: guangzhz */ #includ...
C
#include<stdio.h> #define M 3.0e-23 #define QUOTA 950 int main (void) { double quotas; double number; printf("please enter the quotas:\n"); scanf("%lf", &quotas); number = quotas * QUOTA * M; printf("there are %e etoms in the water!\n", number); return 0; }
C
#include <stdio.h> #include <math.h> int main() { double A, B, C, pi; double tri, cir, tra, qua, ret; scanf("%lf", &A); scanf("%lf", &B); scanf("%lf", &C); pi = 3.14159; tri = (A * C) / 2; cir = pi * pow(C, 2); tra = ((A + B) * C) / 2; qua = B * B; ret = A * B; printf("TRIANGULO: %.3lf\n",...
C
#include <stdio.h> #include <stdlib.h> #define MAX 10 int Add(int a, int b); int main() { /* + REPL - read - evaluate - present - loop */ // var { char c = 'a'; short s = 32; int i = 42; long l = 1234L; ...
C
#include <stdio.h> /*/ Foi elaborada uma prova objetiva contendo 200 (duzentas)questes para um concurso pblico. Escreva um programa, em C, para ler a matrcula (valor inteiro), a quantidade de acertos, quantidade de erros e a quantidade de questes no respondidas de cada um dos 4000 (quatro mil)(10) candidatos que fizera...
C
#include "expression.h" #include "statement.h" #include "alloc.h" #include <stdio.h> #include <assert.h> #include <stdlib.h> static expression_t __expression_new__(expression_type_t expr_type, long line, long column) { expression_t expr = mem_alloc(sizeof(struct expression_s)); if (!expr) { ...
C
#include "mini.h" static int valid_exit2(int i, char *command, int *res) { char *tmp; if (i > 1 && ft_isnumber(command)) { ft_error("exit: ", "too many arguments", 1); *res = 1; } else { if (ft_isnumber(command) || (command[0] == '-' && ft_isnumber(&command[1]))) ft_atoi(command, &g_exit); else ...
C
#include <sys/ioctl.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <pthread.h> #include <time.h> #include "graphics_lib.h" int buffer_changed = 0; void init() { get_screen_size(); old_w.ws_row = 0; old_w.ws_col = 0; } void init_buffer() { srand(time(NULL)); for (int i ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* print_char.c :+: :+: :+: ...
C
/* ------------------------------------------------------------------------ * hello.c: hello, kernel world * * Mark P. Jones, February 2008 */ /*------------------------------------------------------------------------- * Video RAM: */ #define COLUMNS 80 #define LINES 25 #define ATTRIBUTE ...
C
/* Contains the interface for the weather storage module, which takes care of bringing weather data in and out of persistent storage. */ #ifndef WEATHER_STORAGE_H #define WEATHER_STORAGE_H /* Included files */ // Boolean type #include <stdbool.h> /* Constants */ // Key to read and write the temperature in persistent...
C
#include<stdio.h> void input(); void process(); void output(); long int arr[100000]; int n,max,lastIndex,t,testCases; int main() { scanf("%d",&testCases); for(int j=0; j<testCases; j++) { input(); process(); output(); } } void input() { scanf("%d",&n); for(int i=0; i<n;...
C
#include <stdlib.h> #include "IncreasinglySortedArrayPQ.h" struct _IncreasinglySortedArrayPQ{ int maxLength; int length; int* body; }; IncreasinglySortedArrayPQ * IncreasinglySortedArrayPQ_new (int maxsize) { IncreasinglySortedArrayPQ* temp=NewObject(IncreasinglySortedArrayPQ);//ο Ʈ int i=0; temp->maxLength=...
C
// APS105 Assignment 3 Starter Code // Jonathan Deber (deberjon) 991234567 // A letter frequency counter. #include <stdio.h> #include "histogram.h" /* The list of possible letters. Note that although this is a char[], it is not a string, since it is not null terminated. */ const char LETTERS[] = {'a', 'b...
C
#include<stdio.h> int main(){ int A,B,D; int s=0; int min=0; scanf("%d", &A); scanf("%d", &B); scanf("%d", &D); while(1){ D-=A; min++; if(D<=0) break; D+=B; } printf("Answer : %d\n", min); return 0; }
C
#include <stdio.h> #include <stdlib.h> int main() { int n; int wynik = 1; printf("Powdaj liczbe wieksza od 2: \n"); scanf("%d", &n); if(n<2) { printf("Podales zla liczbe :("); } else { for(int i=2; i<=n; i = i+2) { wynik *= i; } ...
C
#include "sandslhash.h" struct sandslhash { int N; int M; //size of linear probing table Key *keys; Val *vals; }; hash_table create_hash_table(int size) { hash_table h = malloc(sizeof(struct sandslhash)); h->M = size; //?????????????????? h->N = 0; h->keys = malloc(sizeof(void *) * siz...
C
#define _CRT_SECURE_NO_WARNINGS 1 //int main() //{ //// int arr[3][4] = { { 1, 2 }, { 2, 3, 4}, {3,4,5,6} }; // //// arr[1][2] = 1; // // //int arr[3][4] = {1,2,3,4,5,6,7,8,9}; // return 0; //} #include <stdio.h> // //int main() //{ // int a[2][3] = {1,2,3,4,5,6}; // int b[3][2] = { 0 }; // // int i = 0; // int j = ...
C
#include<stdio.h> #include<stdlib.h> float num1, tmp; int main(void) { while(1) { printf("\nEnter sales in dollars (-1 to end):"); scanf("%f", &tmp); if (tmp ==EOF ) break; else num1 = tmp; num1 = 200 + num1*0.09; printf("Salary is: $%.2lf\n ", num1); } printf("Program Endded.\n"); system(...
C
#include <stdio.h> #include <stdlib.h> int main() { printf("%d",sumsquare()-squaresum()); } int squaresum() { int result=0; for (int i=1;i<101;i++) { result=result+(i*i); } return result; } int sumsquare() { int result=0; for (int i=1;i<101;i++) { result=result+i; ...
C
#include "sdl2_pixels.h" #include "mruby/array.h" #include "mruby/class.h" #include "mruby/data.h" static struct RClass *class_PixelFormat = NULL; static struct RClass *class_Palette = NULL; typedef struct mrb_sdl2_pixels_palette_data_t { bool is_associated; SDL_Palette *palette; } mrb_sdl2_pixels_palett...
C
/* * Generic map implementation. */ #include "hashmap.h" #include <stdlib.h> #include <stdio.h> #include <string.h> #define INITIAL_SIZE (256) #define MAX_CHAIN_LENGTH (8) /* We need to keep keys and values */ typedef struct _hashmap_element { char *key; int in_use; any_t data; } hashmap_element; /* A h...
C
#include<stdio.h> int memoizedcutrod(int price[],int n,int r[]); int max(int a,int b); int main(){ int n; scanf("%d\n",&n); /*int arr[n]; for(int i=0;i<n;i++){ scanf("%d ",&arr[i]); }*/ int price[n]; for(int i=0;i<n;i++){ scanf("%d ",&price[i]); } int r[n+1]; int s[n+1]; int q; for(int i=0;i<n...
C
#include "push_swap.h" #include "ft_dlist.h" #include <stdio.h> static t_clist_it *ft_ps_get_info_and_min(t_clist *l) { t_clist_it *min; ssize_t max; t_clist_it *current; current = l->current; min = current; max = ((ssize_t)current->value); ((t_lstinfo *)l->data)->min = max; ((t_lstinfo *)l->data)->max = ma...
C
/* * Find the maximum total from top to bottom in triangle.txt, a 15K text file * containing a triangle with one-hundred rows. */ #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <assert.h> #define NUM_ROWS 100 int max(int a, int b) { return (a > b) ? a : b; } int triangle_size(int row...
C
#include <stdio.h> #include <stdint.h> #include <stddef.h> #include <string.h> #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/timers.h" #include "driver/gpio.h" #include "esp_system.h" #include "esp_log.h" #include "fr_dig_out.h" static const char *TAG = "DIG_OUT"; #define NUM_DIGOUTS 1...
C
#include <stdio.h> #include <stdlib.h> #include <sys/socket.h> #include <sys/types.h> #include <netinet/in.h> #include <arpa/inet.h> #include <errno.h> #include <signal.h> #include <sys/wait.h> #include <fcntl.h> #include <string.h> #include <unistd.h> #include <time.h> #include <sys/un.h> #include <sys/poll.h> // use...
C
#include <cs50.h> #include <stdio.h> #include <string.h> #include <ctype.h> int validateKey(string key); string makeCiphertext(string plainText, string key); int main(int argc, string argv[]) { // Check if user input too less or too many arguments in command line if (argc < 2 || argc > 2) { ...
C
#include <stdint.h> #include <stdbool.h> #include <util/delay.h> #include "lcd/lcd.h" #include "input/input.h" #include "jui.h" #include "gridview.h" #include "util.h" static void draw_select_line(gridview_t* view, uint16_t color); static uint8_t find_component(gridview_t* view, uint8_t x, uint8_t y); gridview_t grid...
C
#include <stdio.h> #include <stdbool.h> #include <stdlib.h> #include <sys/stat.h> #include <string.h> #include <stdint.h> #include <ftw.h> #define MAX_FTW_DEPTH 16 static int num_dirs, num_files; static int callback(const char *fpath, const struct stat *sb, int typeflag){ // if we found a file if (typeflag == FTW...
C
#include <stdio.h> #include <stdlib.h> #include "bitree.h" int main() { int num; init_bitree(&bt); system("clear"); //for linux // system("cls"); //for windows printf("\n"); printf("*****************************************************************\n"); printf("* This progrom is an operation for bitree. *\n"); ...
C
/** * decide-range.c * Project Euler Prbl 127 * Created by Zhiming Wang on 02/21/2014. * -------------------------------------- * */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <assert.h> #include "read-rad.h" int main(int argc, const char *argv[]) { read_rad();...
C
#include<stdio.h> #include<math.h> int main() { int test,num,i,count,i2; scanf("%d",&test); while(test--) { scanf("%d",&num); count=1; for(i=2;i<=sqrt(num);i++) { if(num%i==0) { i2=num/i; if(i2==i) count=count+i; else count=count+i+i2; } } printf("%d\n",coun...
C
/* CH-230-A a6p1.c Erlisa Kulla e.kulla@jacobs-university.de */ #include <stdio.h> //Defining macro to swap two numbers #define SWAP1(x, y, int) int t; t = x; x = y; y = t; #define SWAP2(x, y, double) double a; a = x; x = y; y = a; int main(){ int num1, num2; double num3, num4; //Input two numbers from user...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <string.h> #include <netdb.h> #include <sys/types.h> #include <netinet/in.h> #include <arpa/inet.h> #include <sys/socket.h> #include <sys/wait.h> #define PORT 23517 //Static TCP port number of server 3 //Making use of Trime...
C
/************************************************** *- Author : aゞ小波 *- CreateTime : 2019-09-23 00:09 *- Email : 465728296@qq.com *- Filename : main.c *- Description : ***************************************************/ #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include "bintree....
C
///Structure inside Structure or ///Nested Structure #include<stdio.h> struct nametype { char first[20]; char last[20]; }; struct student { int id; struct nametype name; }; int main() { struct student st; printf("Enter the Student ID: "); scanf("%d",&st.id); printf("Enter the Stud...
C
#include <stdio.h> int main() { unsigned long long int num,count=0,size=0; scanf("%lld",&num); size = sqrt(num); int arr[size],k=0; for(int i=2;i<=size;i++){ for(int j=1;j<=i;j++){ if(i%j==0){ count++; if(count>2){ break; ...
C
#ifndef SGREP_H #define SGREP_H #include <stdio.h> typedef char* string; typedef unsigned char byte; /* Option flags to be stored in a unsigned char / byte Example: options = 0000 0101 |||| |||+- OPT_CASE_SENSITIVE is set ||...
C
/************************************************************************* > File Name: signalblock.c > Author: > Mail: > Created Time: 2017年09月02日 星期六 19时27分59秒 ************************************************************************/ #include<stdio.h> #include <unistd.h> #include <sys/stat.h> #include <sys/wa...
C
/* * my_ssh_api.c * * Created on: 15 Jan 2018 * Author: lqy */ #include "my_ssh_api.h" ssize_t ssh_read(struct ssh* ssh, u_char* type, const u_char** datap, size_t* len) { int ret = ssh_packet_next(ssh, type); /*printf("ssh_read: ssh_packet_next returned %d, type: %u\n", ret, *type);*/ if (ret < 0) { ...
C
/*22-III-2011 Ejercicio 11. Fig 1 Apartado a) *Asignar a Personas un trabajo test de fracaso: No se puede asignar a una persona un trabajo ya asignado. generación de descendientes: una persona puede realizar cualquier trabajo libre[] si el trabajo ha sido asignado (true/false) */ tsolucion coste persona[N] ...
C
#include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <arpa/inet.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <wordexp.h> #include <ctype.h> #include <openssl/ssl.h> #include <openssl/bio.h> #include <openssl/err.h> #include <openssl/rand.h> #define MAX_...
C
#include "shell.h" void readcmd(char *buffer) { char ch = ' '; int cur = 0; while (1) { read(0, &ch, 1); if (ch == '\n' || ch == '\0') { buffer[0] = '\0'; return; } else if (ch != ' ' && ch != '\v' && ch != '\t') break; } ...
C
/* * Usage: * gcc hello_word.c -o hello_word_c.bin * ./hello_world_c.bin */ #include <stdio.h> int main(int argc, char const *argv[]) { printf("%s\n", "Hello World"); return 0; }
C
///////////////////////////////////////////////////////////////////////// //// EX_DMA_PING_PONG.C //// //// //// //// This program reads 100 A/D samples captured from channel //// //// AN8 and stores the...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #define L 30 #define N 20 #define NITER 30 int chain[L]; /* Array, which contains the cain sites. */ int position[N]; /* Array, which contains particles' positions */ int head; int tail; const double p = 0.5; const double p_tilde = 1.0; double drand(); ...
C
#include<stdlib.h> #include<stdio.h> int main() { float nota,mediaapro=0,mediarepro=0; int apro=0,repro=0; const int flag=-1; do{ printf("\n\tDigite a nota do aluno,caso desejar sair digite -1: "); scanf("%f",&nota); }while(nota<flag);//fim do do while while(nota...
C
#include<stdio.h> #include<conio.h> void main() { int t; printf("\n enter the number"); scanf("%d",&t); if(t%2!=0) printf("the value of t is odd"); else printf("the value of t is even"); }
C
/* Program to count number of characters, words and lines in a given file. */ #include<stdio.h> #include<conio.h> #include<ctype.h> main(int argc, char *argv[]){ FILE *f; char ch; int character=0, line=0,word=0; f=fopen(argv[1],"r"); if(f==NULL){ printf("404: FILE NOT FOUND\n"); printf("HINT: PASS VALID FIL...
C
#include<stdio.h> int main() { int i; while(scanf("%d",&i)!=EOF) { if(i==0) printf("vai ter copa!\n"); else printf("vai ter duas!\n"); } return 0; }
C
/* Construa um programa com duas variáveis, uma inteira e um ponteiro de inteiro. Atribua valores para as variáveis e imprima na tela os seus valores e a soma de seus valores. [fixacao4.c] */ #include <stdio.h> #include <stdlib.h> int main() { int a; int *p; a = 10; p = (int *)malloc(sizeof(int)); ...
C
#include<ulk.h> #include"macros.h" #include <ulk_base_types.h> #include <ulk_fpga_uart.h> #include<ulk_fpga_char_lcd.h> int main(void) PROGRAM_ENTRY; int main() { ulk_proc_gpio_init(); ulk_proc_sys_pad_set_mux_mode (140, 4); ulk_proc_sys_pad_set_mux_mode (141, 4); ulk_proc_sys_pad_set_mux_mode (142, 4); ...
C
#include <stdio.h> #define INFINITY 100 #define MAX_VERTEX_NUM 20 #define OK 1 typedef struct { int vex[MAX_VERTEX_NUM]; int arcs[MAX_VERTEX_NUM][MAX_VERTEX_NUM]; int vexnum,arcnum; }MGraph; int p[20][20][20]; int a[20]; int LocateVex(MGraph *G,int v) { int i,j; for(i=0;i<=G->vexnum;i++) { if(G->vex[i]==v) ...
C
// list/list.c // // Implementation for linked list. // // Akosua Wordie //Colllab: Dr. Burge and Izzac Ballard #include <stdio.h> #include <stdlib.h> //#include <string.h> #include "list.h" list_t *list_alloc() { list_t *l = malloc(sizeof(list_t)); l->head = NULL; return l; } node_t *node_alloc(elem val){...