language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
// Date: 18.4.2008 // Author: Janez Puhan // Warning: Real time clock works properly for years from 1901 to 2099. #include "rtc.h" char check_time(int *hour, int *min, int *sec) { char changed = 0; if(*hour < 0 || *hour > 23) { *hour = 0; changed = 1; } if(*min < 0 || *min > 59) { *min = 0; changed = ...
C
#include <stdio.h> #include <stdlib.h> int main() { int i,a,b=0; int size; i=a=0; char filepath[256]; char *p; tryagain: printf("Enter filepath to filefinding.\n"); scanf("%s",filepath); FILE *checking; if(fopen(filepath,"r")!=NULL) //check if file exists { checking=fo...
C
/* See LICENSE file for copyright and license details. */ #include <xcb/xcb.h> #include <stdlib.h> #include <stdio.h> #include <err.h> #include "arg.h" #include "util.h" enum { ABSOLUTE = 0, RELATIVE = 1 }; static xcb_connection_t *conn; static xcb_screen_t *scr; static void usage (char *); static void warp_...
C
/* gcc -o beamformer beamformer.c -I/usr/local/include -L/usr/local/lib -lm -g -O2 -L/usr/lib/gcc/x86_64-linux-gnu/5 -lgfortran python beamformer was too slow, decided to use python to write up header etc but do actual beamforming in C. This code should take 5 parameters: * data file name * calibration file name * star...
C
#include "Timeout.h" #include "SystemTime.h" #define TIME_OUT_SENSI_MIL 1 #define TIME_OUT_SENSI_MIC 2 uint32_t timeout_getTimeBySensi(Timeout timeout); uint32_t timeout_calDeltaBySensi(Timeout timeout); void timeout_initMillis(Timeout *timeout,uint32_t duration){ timeout_initMicros(timeout,duration*1000);...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_str_pos_ins.c :+: :+: :+: ...
C
#include "header.h" /** * new_path_str - new string with format "variable" + '=' + "value" * * @envvar: environment variable name * @envval: environment variable value * * Return: the new PATH string. */ char *new_path_str(char *envvar, char *envval) { int envvar_len, envval_len, path_len = 0; char *path_str;...
C
#include "sort.h" /** * bubble_sort - Use bubble sort method to sort an array * * @array: The array to be sorted * @size: The size of the array */ void bubble_sort(int *array, size_t size) { size_t i; size_t j; int tmp; for (i = 0; i < size; i++) { for (j = 0; j < (size - i - 1); j++) { if (array[j] ...
C
#include <stdio.h> #include <math.h> /* Returns a value for the mathmatical function f(x), given x */ double f(double x) { return 2*x*x; } /* Returns a value for the derivative of the function f(x), given x */ double fPrime (double x) { return 4*x; } int main() { double x0, x1; char approxType; ...
C
// 8장 배열 도전 실전 예제 3번 #include <stdio.h> int main(void) { int ary[6]; int inp; int c = 0; int i; int dup; c = 0; while(c < 6) { printf("로또번호 입력 : "); scanf("%d", &inp); dup = 0; for(i=0; i<c; i++) { if(inp == ary[i]) { dup = 1; break; } } if(dup == 0) ...
C
#include <math.h> #include <stdio.h> int divisors(int x) { int divs = 0; int y = sqrt(x); for (int i = 1; i <= y; i++) { if (!(x % i)) { divs += 2; } } return divs + 1; } int main() { int tri = 0; for (int i = 1; divisors(tri) <= 500; i++) { tri += i; } printf("%d\n", tri); }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> int is_sum (int arr[], int sum, int n) { int l = 0; int r = 0; int i = 0; for (i = 0; i < (n - 1); i++) { if (arr[i + 1] < arr[i]) { break; } } l = (i + 1) % n; r = i; while (l != r) { if (arr[l] + arr[r] == sum) return 1; if ((arr[l] + arr[r] < s...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* cub3d_bitmap_write.c :+: :+: :+: ...
C
// // I pledge my honor that I have abided by the Stevens Honor System - Brereton Conway // #include <stdio.h> int cs392_strcmp(char *s1, char *s2){ int i = 0; while(1) { if (s1[i] == s2[i]) { if(s1[i] == '\0') return 0; } else if(s1[i] > s2[i]){ return 1; ...
C
#include<stdio.h> #define R 4.0 #define PI 3.1415926 #define L 2*PI*R //#undef R #define S PI*R*R //在宏定义中引用已定义的宏名。 int main() { printf("\n半径:%lf\n圆周长:%lf\n圆面积:%lf\n\n", R, L, S); return 0; }
C
#define _CRT_SECURE_NO_WARNINGS //ַ⣺д4ַɵַ滻ܷΪģ //мܹǣԭĸĸĵ3ĸ滻ע⣬3ַǰ3滻xa滻 #include <stdio.h> void change(char* a); int main() { char a, b, c, d; printf("Ҫַܵ:"); scanf("%c%c%c%c", &a, &b, &c, &d); change(&a); change(&b); change(&c); change(&d); return 0; } void change(char* a) { if (*a >= 65 && *a <= 87 || *a...
C
/* * Created: 2021/02/01 */ #include "../../../header/minishell.h" int ft_mb2(char *str, int i, int k) { if (str[i] == '.' && str[i + 1] == '/' && \ str[i + 2] == ' ' && str[i + 3] == '\0') k = 1; else if (str[i] == '/' && str[i + 1] == '.' && \ str[i + 2] == '\0') k = 1; else if (str[i] == '/' && str[i +...
C
/** * Example 02 - Allegro 5 * Display image based on keyboard events. * * Juraj Michalek - http://georgik.sinusgear.com */ #include <allegro5/allegro5.h> #include <allegro5/allegro_image.h> #include <stdio.h> int main() { bool isStopSignal = false; ALLEGRO_EVENT_QUEUE *event_queue; ALLEGRO_DISPLAY *display;...
C
/// Author: Damian Chanko 394127 #include "List.h" elemL* elInit() { elemL *l= malloc(sizeof(elemL)); if(l==NULL)return NULL; l->S=malloc(sizeof(Single)); if(l->S==NULL) { free(l); return NULL; } l->S->c=NULL; l->next=NULL; l->prev=NULL; return ...
C
/* * ENSICAEN * 6 Boulevard Maréchal Juin * F-14050 Caen Cedex * * This file is owned by ENSICAEN. * No portion of this document may be reproduced, copied * or revised without written permission of the authors. */ /** * @author Julien LE PECHEUR <jlepecheur@ecole.ensicaen.fr> * @version 1.0 27/10/2018 */ /...
C
#include "bubble_sort.h" void bubble_sort(int *arr, int size){ int aux; for (int i = 0; i < size - 1; i++) { for (int j = 0; j < size - i - 1; j++) { if( arr[j] > arr[j + 1]){ aux = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = aux; ...
C
#include <stdio.h> #include <conio.h> void printstr(char ** strarr,int arrsize); void main(void){ char ** strarr; int strnum; int i; clrscr(); printf("please enter number of strings:"); scanf("%d",&strnum); strarr=(char **) malloc(strnum * sizeof(char *)); for(i=0;i<strnum;i++){ int strsize; printf("plea...
C
#include "Plane.h" #include <stdio.h> #include <stdlib.h> #include <string.h> struct Plane { int ID; int wingspan; char brand[50]; }; struct Plane *mallocPlane(int ID, int wingspan, char *brand) { struct Plane *plane = malloc(sizeof(struct Plane)); plane->ID = ID; plane->wingspan = wingspan; strcpy(plan...
C
/* ************************************************************************** */ /* LE - / */ /* / */ /* ft_env_utils.c .:: .:/ . .:: ...
C
/* * ===================================================================================== * * Filename: Huffman.c * * Description: * * Version: 1.0 * Created: 2013年11月04日 19时35分34秒 * Revision: none * Compiler: gcc * * Author: gaoyuan, 690892695@qq.com * ...
C
#include "corewar.h" //ocp_chunk valeur du morceaux recup par le mask int arg_available(int ocp_chunk, int opcode, int num_arg)//est appelé pour chaque argument, check la value { if (ocp_chunk < 1 || ocp_chunk > 3) //si ce n'est pas entre 2 et 3 arguments, error return (0); if (ocp_chunk == 3) //permet d'utiliser...
C
#include "stm32_gpio.h" // STM32F10x peripherals definitions /** * @brief Sets the selected data port bits. * @param GPIOx: where x can be (A..G) to select the GPIO peripheral. * @param GPIO_Pin: specifies the port bits to be written. * This parameter can be any combination of GPIO_Pin_x where ...
C
#include "config.h" config* load_config(char * path){ char *buffer = malloc(CONFIG_BUFFER_SIZE); FILE *f; config *conf = malloc(sizeof(config)); conf->poly_path = NULL; conf->frag_shader_path =NULL; conf->vert_shader_path =NULL; conf->window_w = 800; conf->window_h = 600; f = fopen("config.txt","r"); ...
C
// fork.c #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <unistd.h> // Add your paint function here int main(int argc, char** argv){ int numberOfArtists = 8; pid_t wpid; int status; int *arr = (int*)malloc(sizeof(int) * numberOfArtists); for(int i =0; i < numberOfArtists; i++){ int ...
C
#include<stdio.h> int main(){ char x = 355; int y ='z'; printf("%d\n",x); printf("%c\n",y); return 0; }
C
/* ============================================================================ Name : TP1_2.c Author : Version : Copyright : Your copyright notice Description : TP1_2 ============================================================================ */ #include <stdio.h> #include <stdlib.h> #incl...
C
/* ** loi.c for 203hotline in /home/belia-_r/afs/epitech_perso/Tech_2/Math/203 ** ** Made by romain belia-bourgeois ** Login <belia-_r@epitech.net> ** ** Started on Wed Mar 20 21:48:43 2013 romain belia-bourgeois ** Last update Wed Mar 20 21:48:52 2013 romain belia-bourgeois */ #include <stdio.h> #include <math.h> ...
C
#include <stdio.h> #include <stdlib.h> #include "LinkedList.h" #include "Venta.h" #include <string.h> int generarArchivoInformes(char* fileName,LinkedList* listaVentas) { FILE* pArchivo = fopen(fileName, "w"); int retorno = -1; int cantVendidasTotales = 0; int cantidadMayorA10000 = 0; int cant...
C
#include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> int main(void) { mode_t mode = S_IRUSR | S_IWUSR; int fd, val; char *file_read; char contents[] = "123456789"; char test[] = "hi"; file_read = malloc(20); fd = open("lseek_test.txt", O_RDWR | O_APPEND | O_CREAT, mode); writ...
C
/** * @description: 1047 编程团体赛 * @param {type} * @return: */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> int main(void) { int testnum; int resultbuf[1003] = {0}; char tempbuf[20] = {0}; int temp; int fuzhu1,fuzhu2; scanf("%d", &testnum); for(int i = 0...
C
#include<stdio.h> #include<stdlib.h> struct node{ struct node* next; char fingerprint; }; typedef struct node node; int insertLL(node **, char); int removeLL(node **, char); int searchLL(node *, char);
C
//Program to find the octal equivalent of the entered number. #include<stdio.h> int main() { int num,i=0,j=1,k=0,n; printf("Enter the number: \n"); scanf("%d",&num); n=num; while(n!=0) { i=(n%8)*j; n=n/8; j=j*10; k=k+i; } printf("Octal...
C
#include <stdio.h> int main(){ int num_1 = 0, num_2 = 0, num_3 = 0; scanf("%d %d %d", &num_1, &num_2, &num_3); if(num_1 == num_2 && num_2 == num_3){ puts("3"); }else if(num_1 == num_2 || num_1 == num_3 || num_2 == num_3){ puts("2"); }else{ puts("0"); } return 0; ...
C
#include "config.h" #include "debug.h" #include "thread.h" #include "list.h" #include "log.h" #include <stdlib.h> #include <string.h> #include <errno.h> static struct List *sg_threadList; #include <pthread.h> #include <signal.h> static pthread_attr_t g_attr; static pthread_once_t g_once_control = PTHREAD_ONCE_INIT...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct cliente{ //Define o tipo cliente. char nome[50]; int cpf; }CLIENTE; typedef struct lista LISTA; void criaLista(LISTA *L); //Inicializa void inserirEncadeada(LISTA *l, LISTA *c, int posicao); //l = cabea da lista. c ...
C
/* ** EPITECH PROJECT, 2018 ** my_put_nbr ** File description: ** Display an int */ void my_putchar(char c); void disp_buggy_number(void) { my_putchar('-'); my_putchar('2'); my_putchar('1'); my_putchar('4'); my_putchar('7'); my_putchar('4'); my_putchar('8'); my_putchar('3'); my_put...
C
/* HASH API functions tests - by Ido Naveh */ # include <stdio.h> # include <stdlib.h> # include "hash.h" #define MAGIC 7377175 #define SIZE 10 void IsCreate(){ Hash* testHash = HashCreate(SIZE); printf("Is Create:"); if (testHash != NULL){ printf("PASS\n"); HashDestroy(testHash...
C
#include "sort.h" /** * bubble_sort - sorts an array of integers using bubble sort * array is sorted in ascending order * @array: given array to sort * @size: size of array to sort * */ void bubble_sort(int *array, size_t size) { /* bubble sort: */ /* checks pair at a time, swapping if needed; repeats til sorted...
C
#pragma once #include"Member.h" void grade() { // , //, Ƚ system("cls"); int no = 0; int jum = 0; int grade = 0; int count = 0; for (int i = 0; i < index; i++) { printf("-----------------------\n"); printf("%3d %5s : ", stu[i].no, stu[i].name); scanf("%d", &jum); printf...
C
// // File: ahentafel.c // @author Connor Egbert <cje5361> // // // // // // // // // // // // // // // // // // // // // // // #include <string.h> #include <stdlib.h> #include <stdio.h> #include <stdbool.h> #include "ahentafellib.h" #define MAXLINE 200 // Max input size /** * Main user interface for my ahentafe...
C
#include<stdio.h> #include<ctype.h> #include<string.h> void findproduct(char string1[],char string2[]); void main() { char product[5][100]={"TV127 31 inch Television","CD057 CD Player","TA877 Answering Machine","CS409 Car Stereo","PC655 Personal Computer"}; char find[100]; printf("TV127 31 inch Televi...
C
#include <stddef.h> extern void free(void *p); extern void *malloc(size_t size); typedef union sslval { int ssl_int; void *ssl_ptr; } *loc; #define READ_LOC(x,y) (*(x+y)).ssl_ptr #define READ_INT(x,y) (*(x+y)).ssl_int #define WRITE_LOC(x,y,z) (*(x+y)).ssl_ptr = z #define WRITE_INT(x,y,z) (*(x+y)).ssl_int = z ...
C
#include <stdio.h> #include <time.h> char daybuf[30]; struct tm time_str; int datum (int year, int month, int day) //funkce pro zjisteni dnu v tydnu { time_str.tm_year = year - 1900; time_str.tm_mon = month - 1; time_str.tm_mday = day; time_str.tm_hour = 0; time_str.tm_min = 0; time_str.tm_se...
C
#include <cs50.h> #include <stdio.h> #include <string.h> char* concat(const char *s1, const char *s2) { char *result = malloc(strlen(s1)+strlen(s2)+1);//+1 for the zero-terminator //in real code you would check for errors in malloc here strcpy(result, s1); strcat(result, s2); return result; } char...
C
/** *************************************************************************** * @file spi.h * @brief spi.h is the header file of spi.c which is for interfacing the SPI interface * * Fetches received data form SPI. * A FSM checks if the received data is valid. * If data is valid, it's saved in the internal storr...
C
#include "../../utilities/aeol.h" void sequence1() { int n = 100; int m = 30; for (int i = 0; i < n; i++) { for (int d = 0; d < m; d++) { access(d, i); } } return; } void sequence2() { int n = 100; int m = 30; for (int i = 0; i < n; i++) { for (int d = 0; d < m; d++) { if (i % 2 == 0) { access...
C
// Exercise 1-2 #include <stdio.h> main() { printf("Escape character: a: \a.\n"); printf("Escape character: b: \b.\n"); printf("Escape character: e: \e.\n"); printf("Escape character: f: \f.\n"); printf("Escape character: r: \r.\n"); printf("Escape character: v: \v.\n"); }
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include"morse.h" #pragma warning (disable: 4996) #define THREE_UNIT 3 // 3 spaces #define SEVEN_UNIT 7 // 7 spaces #define LENG_BUFFER 2000 //buffer leng struct morse_code morse_translate[N] = { {"* ---", 'A'},{"--- * * *",'B'},{"---...
C
/* Napisati funkciju float zbir_pozitivnih(float a[], int n, int k) koja izračunava zbir prvih k pozitivnih elemenata realnog niza a dužine n. Napisati i program koji testira rad funkcije. Pretpostaviti da dužina niza neće biti veća od 100.*/ #include <stdio.h> #define MAX 100 float zbir_pozitivnih(float a[], int n,...
C
#include "makespl.h" #include <stdio.h> #include <stdlib.h> #include <float.h> #include <math.h> void make_spl (points_t * pts, spline_t * spl){ int i, j, m; int n = pts->n; double *x = pts->x; double *y = pts->y; double k = 0.0; if (n % 2 == 1) m = (n-1)/2; else m = n/2; if (alloc_spl(spl, n) == 0){ ...
C
#include <avr/io.h> #include <avr/interrupt.h> #include <util/delay.h> #include <stdlib.h> #define MrLCDsCrib PORTB #define DataDir_MrLCDsCrib DDRB #define MrLCDsControl PORTD #define DataDir_MrLCDsControl DDRD #define LightSwitch 5 #define ReadWrite 7 #define BiPolarMood 2 char firstColumnPositionsFor...
C
#include <stdio.h> #include <plugin.h> #include <string.h> #include <malloc.h> #include "rotate.h" void __init_rotate(int* result, plugin_action_info_t *init_data) { if(init_data == NULL || result == NULL) { *result = 1; return; } init_data->name = (char*)malloc(3*sizeof(char)); strcpy(init_data->name, "-r")...
C
#include <stdio.h> #include<conio.h> void main() { int a,b,i,d; clrscr(); printf("Enter two numbers(intervals): "); scanf("%d %d",&a,&b); printf("Prime numbers between %d and %d are:",a,b); while(a<b) { d=0; for(i=2;i<=a/2;++i) { if(a%i==0) { d=1; break; } } if(d==0) printf("%d",a); ++a; } getch()...
C
/** * Programa que recibe a traves de un socket de Flujos de datos un mensaje de un cliente. * Redes de Computadoras I * Universidad Industrial de Santander * ENTRADA: NA * SALIDA: el mensaje que viene del cliente * PROCESO: Este programa se queda esperando (Listen) por alguna conexion por parte de * un cliente. Cuando...
C
#include <stdio.h> #include <assert.h> __attribute__((naked)) int bcc1(int a){ __asm volatile("mov sp,r0"); __asm volatile("sub r0,sp,#0x04"); __asm volatile("bx lr"); } __attribute__((naked)) int bcc2(int a){ __asm volatile("mov sp,r0"); __asm volatile("sub sp,sp,#0b0000100"); __asm volatile("mov r...
C
/* * event.c * * Created on: 17-08-2013 * Author: Polprzewodnikowy */ #include "stm32f4xx.h" #include "event.h" event_t event[EVENT_BUF]; event_t *ievent = event, *oevent = event; volatile uint8_t cntevent = 0; uint8_t event_any(void) { if(cntevent == 0) return 0; else return 1; } void event_put(ev...
C
#include "stm32xxxx.h" #include "logins.h" #include "flash_memory.h" LoginTypeDef logins[LOGINS]; __attribute__((__section__(".user_data"))) const uint8_t flash_data[LOGINS][(ENTRY_LEN*2 + 2)]; uint8_t usernames[LOGINS][ENTRY_LEN]; uint8_t passwords[LOGINS][ENTRY_LEN]; uint8_t en_usernames[LOGINS]; uint8_t en_passw...
C
/* * Exercício 5: Usando a estrutura Retangulo do exercício anterior, faça um programa que declare e leia uma estrutura Retangulo * e um Ponto, e informe se esse ponto está ou não dentro do retângulo. * finalizar este exercicio */ #include <stdio.h> #include <stdlib.h> #include <math.h> int main() { return 0; }
C
#include <stdio.h> int fibo(int); int main() { int n,i; printf("Please enter nth term: "); scanf("%d",&n); printf("First %d terms of fibonacci series is:\n",n); for(i=0;i<n;i++) { printf("%d\t",fibo(i)); } } int fibo(int n) { if(n<=1) return n; else return (fibo(n-1) + fibo(n-2)); ...
C
/* * cirbuf2.c * * Created on: Dec 6, 2017 * Author: USER */ #include<stdint.h> #include "cirbuf2.h" /***************************************************************************************************************************************** *@file:cirbuf.c *@brief:this file contains all the fu...
C
#include "binary_trees.h" int binary_tree_not_full(const binary_tree_t *tree); size_t binary_tree_h(const binary_tree_t *tree); int binary_tree_balance(const binary_tree_t *tree); int binary_tree_is_full(const binary_tree_t *tree); /** * binary_tree_is_perfect - checks if a binary tree is perfect * @tree: root node...
C
#ifndef BOX_H #define BOX_H #include "graphics.h" /* BOUNDING BOX : delineates an object and defines its position */ typedef struct boundingbox { float minX, minY; float maxX, maxY; } BoundingBox; /* -----INITIALIZATION----- */ /* initializes a bounding box object */ void initBoundingBox(BoundingBox* bb, float pos...
C
#include <reg52.h> #include <intrins.h> #include "LM016L.h" #include "main.h" //Ŷ sbit RS=P2^0; sbit RW=P2^1; sbit E=P2^2; sbit BF=P0^7; void delay1ms() { unsigned char i,j; for(i=0;i<10;i++) for(j=0;j<33;j++); } /***************************************************** ܣʱɺ ڲ n *****************...
C
#include "mainfunction.h" #include "stdinutils.h" #include <stdio.h> #include <stdlib.h> #include <string.h> /*Funzione d'azione per l'utente, viene chiamata una volta che le operazioni di login hanno successo*/ void login(Graph G, Customers Utenti, char *Username, Nomi_Luoghi NM) { int choice; do ...
C
int change(int a[5][5],int n, int m) { int i,x; if(n>4||n<0||m>4||m<0) return 0; else { for(i=0;i<5;i++) { x=a[n][i]; a[n][i]=a[m][i]; a[m][i]=x; } return 1; } } int main() { int i,j,m,n,a[5][5]={0},y; for(i=0;i<5;i++) { for(j=0;j<5;j++) { scanf("%d",&a[i][j]); }...
C
#include<stdio.h> /* * Get the age of the user, calculate the number of seconds. */ int main(void) { float seconds_for_a_year = 3.156e7f; short age; printf("How old are you: "); scanf("%hd", &age); printf("You are %hd years old and it has %e seconds.\n", age, seconds_for_a_year * age); return 0; }
C
//program to reverse the odd bits in an integer #include<stdio.h> int main(){ int n,m=1,i=1; printf("Enter the number to toggle odd bits:"); scanf("%d",&n); while((i*=2)<=16) if((m|(m<<i))<=n) m|=(m<<i); else break; printf("\n The result is: %d\n",n^m); return 0; }
C
#include <stdio.h> int main() { int i,j,n,x; printf("\n========================================\n"); printf("les valeurs de tableau"); printf("\n========================================\n"); printf("donner la taille de tableau "); scanf("%i",&n); int tab[n]; i = 0; while(i < n) ...
C
//#include <stdio.h> //#include <stdlib.h> // //int main() //{ // printf("Hello world!\n"); // return 0; //} //#include<stdio.h> //#include<iostream.h> // //int main() //{ // cout<<"1"<<endl; // return 0; //} //#include<stdio.h> //int main() //{ // printf("%+d",1); // return 0; //} //#include<stdio.h>...
C
/* * arch/arm/include/asm/fncpy.h - helper macros for function body copying * * Copyright (C) 2011 Linaro Limited * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This pr...
C
/* Program To Implement Structure To Read Write And Compute Average Marks And The Students Scoring Average And Below Average Marks For A Class Of N Students Ashutosh Khanal Upadhyay 1CR20CS033 24 August 2021 */ #include <stdio.h> struct student { int std_id; char name [50]; float eng; float sci; float soc; float ...
C
#include <stdlib.h> #include "wq.h" #include "kvconstants.h" #include "utlist.h" /* Initializes a work queue WQ. Sets up any necessary synchronization constructs. */ void wq_init(wq_t *wq) { wq->head = NULL; pthread_mutex_init(&(wq->mutex), NULL); pthread_cond_init(&(wq->cond), NULL); } /* Remove an item from t...
C
#include "../defs.h" status main(string str, object gob, object player) { int key; string *validshapes; validshapes = ({ "main", "boots", "helmet", "neckguard", "greaves", "cloak", "bracers", "earring", "gloves", "belt", "amulet", "necklace", "ring", "chestplate", "all", }...
C
/** * @file built_in.h * @author Roman Bartl (xbartl06) * @author Petr Sopf (xsopfp00) * @brief Built in functions of IFJ17 language */ #ifndef IFJ_BUILTIN_H #define IFJ_BUILTIN_H /** * * @param stringsToPrint * * Function prints out given strings in array of string 'stringsToPrint' next to each other in appr...
C
#include <mpi.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/time.h> #define DEFAULT_THREAD_COUNT 12 #define MAX_BATCH_SIZE 120000 #define MAX_LINE_LENGTH 3000 int thread_count; char lines[MAX_BATCH_SIZE][MAX_LINE_LENGTH] = {{'0'}}; size_t line_sizes[MAX_BATCH_SIZE]; ssize_t line_lens[M...
C
#include "file_parser.h" /* Parse the current line which is space delimited and create a * movie struct with the data in this line */ struct movie *create_movie(char *currLine) { struct movie *currMovie = malloc(sizeof(struct movie)); // For use with strtok_r char *saveptr; char *langptr; // Get...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <stdbool.h> #include <getopt.h> #define VERSION "1.0.0" //option elements static bool success_flag = false; static bool verbose_flag = false; static bool keep_flag = false; static bool brief_flag = false; static struct option long...
C
#include "bpt.h" // MAIN int main( int argc, char ** argv ) { char * input_file; FILE * fp; int input, range2; char input2[120]; char instruction; char license_part; char pathname[150]; int result; license_notice(); usage_1(); usage_2(); if (argc > 1) { if ...
C
#include "doctest.h" #include <string> #include "NumberWithUnits.hpp" using namespace std; using namespace doctest; using namespace ariel; const std::string test_file = "./units.txt"; TEST_CASE("OPERTOR +"){ ifstream units_file{test_file}; NumberWithUnits::read_units(units_file); CHECK((NumberWithUnits(9...
C
#include "stdio.h" int main(void) { char a[40],c; printf("enter the number"); scanf("%c",&c); if(isdigit(c)==0) { printf("%c is not numeric"); } else { printf("%c is numeric"); } return 0; }
C
//program to find compound interest #include<stdio.h> #include<math.h> int main() { float principle , rate , time , compound ; printf("Enter principle amount : "); scanf("%f",&principle); printf("Enter rate per year : "); scanf("%f",&rate); printf("Enter time period : "); scanf("%f",&time);...
C
#include "include/ceural.h" /** * @brief calculates element wise ReLu function output * * @param[out] out pointer to the output matrix - must be initiliazed but size can be incorrect * @param[in] z pointer to the input matrix */ void ceural_relu(matrix_t* out, const matrix_t* z) { //matrix_t * out = matrix_new(...
C
//Frecuencia #include <stdio.h> #include <stdlib.h> int main (){ int a=0,e=0,i=0,o=0,u=0,consonante=0,j; char arr[200], res; res == 's'; do{ printf("Escribe la oracion\n"); scanf("%[^\n]",&arr); for(j=0; j<sizeof(arr);j++) { if(arr[j]=='a' || arr[j]=='A') a++...
C
/* separate number ip:a[]={1,0,0,1} op:a[]={0,0,1,1} */ #include<stdio.h> int main() { int number; scanf("%d",&number); int a[10],i,j,k; for(i=0;i<number;i++) { scanf("%d",&a[i]); } for(j=0;j<number;j++) { if(a[j]==0) printf("0"); } for(k=0;k<number;k++) { if(a[k]==1) printf("1"); } return 0; }
C
#ifndef GNM_MAT3X3_TYPE_H_ #define GNM_MAT3X3_TYPE_H_ #include "vec3_type.h" GNM_NAMESPACE_BEGIN struct mat3x3 { mat3x3() {} mat3x3(const float f) { _r[0] = f; _r[1] = f; _r[2] = f; } mat3x3(const float f00, const float f10, const float f20, const float f01, const float f11, const float f21, co...
C
/* LIBRERIA: Cabecera de el TAD PILA DINÁMICA */ //DEFINICIONES DE CONSTANTES #define TRUE 1 #define FALSE 0 //DEFINICIONES DE TIPOS DE DATO //Definir un boolean (Se modela con un "char") typedef unsigned char boolean; //Definir un aut (Se modela con una estructura "aut") typedef struct aut { //Var...
C
/* #include <stdio.h> #include <string.h> #include <ctype.h> int longWordLength(char *s); int main() { char str[80], *p; printf("Enter a string: \n"); fgets(str, 80, stdin); if (p=strchr(str,'\n')) *p = '\0'; printf("longWordLength(): %d\n", longWordLength(str)); return 0; } // Find the longest word, no space no pu...
C
#include <stdio.h> int soma (int x, int y){ return x+y; } int soma2(int(*p)(int,int),int x,int y){ return p(x,y); } int main() { int x,y,z,z2; /* Um ponteiro para função é um ponteiro que aponta para a função e facilita na chamada * e alteração da mesma */ int (*p)(int,int); ...
C
#include <stdio.h> #include "UsefulHeap.h" #include "QuickSort.h" #include "RadixSort.h" int ds_ch10_c(void) { //bubble_test(); ////selection_test(); //insertion_test(); //heap_test(); //merge_test(); //quick_test(); //radix_test(); inter_test(); return 0; } void BubbleSort(int arr[], int n) { int i, j; in...
C
#include <stdio.h> int main(){ /* Calculate delta for a quadratic equation */ int delta; int a = 1, b = -5, c = 4; // i.e. x^2 -5*x + 4 = 0 delta = b * b - 4 * a * c; return delta; // 9 }
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> //Ž //ڻ10Ԫ,10% //10Ԫ,Сڵ20Ԫ,10Ԫְ10%,10Ԫ20Ԫְ7.5% //20Ԫ,Сڵ40ԪIJ5% //40Ԫ60Ԫְ3% //60Ԫ100Ԫְ1.5% //100Ԫְ1% int main(){ double i; double max1, max2, max4, max6, max10; double bonus; max1 = 100000 * 0.1; max2 = max1 + 100000 * 0.075; max4 = max2 + 20000...
C
#include <stdio.h> #include <stdbool.h> #include <stdlib.h> typedef struct BSTNode { int key; struct BSTNode *left, *right; } BSTNode; typedef struct BSTree { BSTNode *root; int maxDepth; } BSTree; int currNodeDepth; bool min, once, last; // Main Function void init(BSTree *tree); void insert(BSTree ...
C
#include <stdio.h> #include <string.h> int main(void) { char str1[80], str2[80]; char temp[80]; printf(" ڿ Է : "); scanf("%s %s", str1, str2); printf("ٲٱ : %s, %s\n", str1, str2); strcpy(temp, str1); strcpy(str1, str2); strcpy(str2, temp); printf("ٲ : %s, %s\n", str1, str2); return 0; }
C
#include <stdio.h> #include <string.h> #include <regex.h> #include <pthread.h> #include <stdlib.h> #include <dirent.h> #include <unistd.h> #include "processamento.h" #include "bufsaida.h" struct arquivo { char *path; buffer_saida *buff; struct arquivo *prox; }; struct arquivo *lista_arquivos, *proximo_ar...