language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
//Exercicio 15 #include <stdio.h> int main() { float valor, rendimento, novoValor; int tipo; printf("\nTipo de investimento: "); printf("\nAperte 1 para 'Poupança' "); printf("\nAperte 2 para 'Fundos de renda fixa'. \n\n"); scanf("%d", &tipo); printf("\nValor: "); scanf("%f", &valor); switch (tipo) { c...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* process_width.c :+: :+: :+: ...
C
/* KallistiOS ##version## ucs.c Copyright (C) 2019 Lawrence Sebald */ #ifndef FAT_NO_WCTYPE #include <wctype.h> #else #include <ctype.h> #endif #include "ucs.h" int fat_utf8_to_ucs2(uint16_t *out, const uint8_t *in, size_t olen, size_t ilen) { size_t i, j; for(i = 0, j = 0; i < i...
C
#include <stdio.h> int x,y; int main() { scanf("%d %d", &x, &y); double a = x*1.0; double b = y*1.0; double n = a/b; printf("%.10f",n); return 0; }
C
/* Simple Pthread Program to illustrate the create/join threads by passing a structure as an argument to pthread_create. Author: Purushotham Bangalore Date: Jan 25, 2009 To Compile: gcc -O -Wall pthread3.c -lpthread To Run: ./a.out 4 */ #include <stdio.h> #include <stdlib.h> #include <pthread.h> t...
C
#include <stdio.h> #include <math.h> #include <cs50.h> int change_owed(void); int coins(void); int a; int total; //Print amount owed in cents, and number of coins required to repay customer int main(void) { int coint_count = coins(); printf("Total amount owed in cents: %i\n", a); printf("Total coins neede...
C
#include <stdio.h> #include <netinet/in.h> #include <sys/types.h> #include <sys/socket.h> #include <string.h> #include <unistd.h> #include <arpa/inet.h> #include <stdlib.h> #define PORT 21714 /* server_or port number */ const char IP[] = "127.0.0.1"; /* localhost IP */ int main(){ int s=socket(AF_INET,SOCK_DGRAM...
C
// Vec2.h By Zsroskenyr Team 2013.10.10 #pragma once struct Vec2 { Vec2 operator - (const Vec2& p) const; Vec2 operator + (const Vec2& p) const; Vec2 operator / (const Vec2& p) const; Vec2 operator * (const Vec2& p) const; Vec2 operator - () const; Vec2& operator *= (float s); Vec2& operator /= (float s); ...
C
#include <stdlib.h> #include <stdio.h> #include <pthread.h> #include "def.h" int atomic_pop_impl(struct list_d *self){ int index; pthread_mutex_lock(&(self->mutex)); index = self->listIndex; self->listIndex ++; pthread_mutex_unlock(&(self->mutex)); return (self->array)[index]; } void listInit(struct list_d ...
C
#include "mex.h" #include "matrix.h" #include <math.h> #include <string.h> #include "pthread.h" #include <stdint.h> #define NUM_THREADS 16 struct thread_data { mwIndex start; mwIndex finish; mwSize R; mwIndex* V_ir; mwIndex* V_jc; double* V_pr; double* H_pr; double* WT_pr; double* result; double b; }; mxAr...
C
/* * This file is subject to the terms and conditions defined in * file 'LICENSE.txt', which is part of this source code package. */ #include <string.h> int memcmp(const void* aptr, const void* bptr, unsigned int size) { const unsigned char* a = (const unsigned char*) aptr; const unsigned char* b = (const unsign...
C
#ifndef __UTILITIES_H__ #define __UTILITIES_H__ #include <stdio.h> #define UNUSED(var) (void)var #define RED "\033[31m" #define GREEN "\033[32m" #define WHITE "\033[0m" #define TEST(test, errMsg) if (test)\ {\ printf(GREEN);\ printf("%s\n", "SUCCESS");\ }\ else\ ...
C
#include <wiringPi.h> #include <stdio.h> #include <stdint.h> #include <sys/types.h> #include <unistd.h> #include <stdlib.h> #include <signal.h> #include "get_temperature.h" #define PUMP 21 void sig_handler(int signo) { digitalWrite(PUMP, 0); exit(0); } int main (void) { int temp; signal(SIGINT, (void *)sig_handle...
C
static int g() { #if ONLINE_JUDGE int i; scanf("%d", &i); return i; #else static int a[] = {6, 5, 3, 1, 3, 1, 5, 3, 6, 5, 5, 5, 7, 2}; static int i = 0; return a[i++]; #endif } int main() { int n = g(); int s = g() - 2; while (n-- > 0) { s += g(); s -= g(); s -= 2; } if (s >= 0) { ...
C
/*---------------------------------------------------------------------------- * * minimum_subsequence_in_non-increasing_order.c * Given the array `nums`, obtain a subsequence of the array whose sum of * elements is strictly greater than the sum of the non included elements * in such subsequence. * * If ...
C
/***************************************************** You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. Input: (2 -> 4 -> 3) + (5 -> 6 -> 4) Output: 7 -> 0 ...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> char file_name[1000]; void file_rename(char *new_name) { strcpy(file_name,new_name); strcat(file_name,".txt"); } FILE *create(char *mode) { FILE *fp; fp=fopen(file_name,mode); return fp; } void file_input(FILE *fp) { fprintf(fp,"%s\n",file_...
C
#include<stdio.h> #include<time.h> void main() { int i; for (i=0; i<5; i++) { fflush(stdout); sleep(5); printf("DELAY"); } }
C
#include<stdio.h> void delcharfun(char str[],char ch) { int i=0,j=0; for(i,j;str[i]!='\0';i++) { if(str[i]!=ch) { str[j++]=str[i]; } } str[j]='\0'; } int main(void) { char str[100],ch; gets(str); fflush(stdin); scanf("%c",&ch); delcharfun(str,ch); if(str[0]!='\0') { for(int i=0;str[i]!='\0';i++) ...
C
#ifndef __TINY_TIMER_H__ #define __TINY_TIMER_H__ #include "cmsis_os.h" #ifdef __cplusplus #define TINY_TIMER_BEGIN extern "C" { #define TINY_TIMER_END } #else #define TINY_TIMER_BEGIN #define TINY_TIMER_END #endif TINY_TIMER_BEGIN /** @brief 定时器定义*/ typedef struct { uint8_t dir; /**< 定时器增长方向*/ u...
C
/* ** EPITECH PROJECT, 2019 ** minishell2 ** File description: ** handle cd built-in */ #include "mysh.h" #include <stddef.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> static void move(shell_t *shell, char **args) { int r_value = chdir(args[1]); struct stat sb; if (r_value == -1) ...
C
#include <stdio.h> #include <string.h> #include <time.h> #include <errno.h> #include <math.h> #include <grace_np.h> #include <unistd.h> #include <float.h> #include <limits.h> #include <signal.h> #include <cash2003.h> #include <cash2.h> #include <mersenne.h> #include <cash2-s.h> static TYPE2** Life; void Initial(void)...
C
/** * FastCGI protocol implementation * @author: xusong.lie */ #include <unistd.h> #include <sys/socket.h> #include <arpa/inet.h> #include <netinet/in.h> #include <errno.h> #include <string.h> #include <stdio.h> #include "fcgi.h" #define PARAMS_BUFF_MAX_LEN 5120 static char _paramsbuf[PARAMS_BUFF_MAX_LEN]; int f...
C
#include "reminder.h" void read_reminders(char *filename){ char reminder[MAX_REMINDER_LEN]; int fp = open(filename, O_RDONLY); if(fp == -1){ printf("Error opening file\n"); exit(-1); } char tmp_buffer[2]; int i = 0; int reminder_index = 0; //************************************ //* Read from file 1 byte a...
C
/* Name: newline.c * Purpose: Prints a saying * Author: jodi */ #include <stdio.h> int main(void) /* Beginning of main program */ { printf("my "); /*For got to close this comment... printf("cat "); printf("has "); /*so it ends here */ printf("fleas"); return 0; }
C
/* #include <stdio.h> void aaa(); void haha(); void main() { printf("Good morning!\n"); aaa(); //aaa ȣ () } void aaa() { printf("Hello!\n"); haha(); } void haha(void) { printf("wanna go home\n"); } */ /* #include <stdio.h> void output(int x, int y); void main() { int a; int b = 20; a=input(); output(a,...
C
#include <stdio.h> int main(void) { char *p = "hello"; /* Will print 'e' */ printf("%c\n", p[1]); }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* art.c :+: :+: :+: ...
C
// // Created by Bori on 2/25/2020. // #include <stdlib.h> #include <stdio.h> #include "list.h" list createList() { list newList; newList.first = NULL; newList.last = NULL; return newList; } void addFirst(list *myList, int value) { node *newNode = createNodeWithNext(value, myList->first); myL...
C
#include "holberton.h" /** * jack_bauer - detemine the absolute value of a character */ void jack_bauer(void) { int a; int b; for (a = 0; a <= 99; a++) { for (b = 0; b <= 99; b++) { if ((a / 10) >= 3) { ; } else { if ((a / 10) == 2 && (a % 10) >= 4) { ; } else { ...
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[]) { int x; int a,b,c,d,e,n; printf("һ5λ\n"); scanf("%d",&x); if(x>9999) n=5; else if(x>999) n=4; else if(x>99) n=3; ...
C
#include <string.h> #include <stdio.h> #include "InputGenerator.h" #include "ProfileTimer.h" int strstrv2(char const* tgt, size_t tgt_len, char const* pat, const size_t pat_len); _noinline_ void Run_strstr_NOPString_test() { printf("Starting test %s ...", __FUNCTION__); StartTimer(); size_t searchesMade = ...
C
#include<stdio.h> #include<math.h> int primeFactors(int n) { int times=0; while (n%2 == 0) { int forl(); n = n/2; times++; if(n%2!=0){ printf("%d %d\n", 2, times); forl(n); break; } } //if(times!=0) //printf("...
C
#include"headers.h" int input_isalnum(void) { char *str1 = NULL; int j; int i; printf("enter the string:"); str1 = str_valid(); for(j=0 ; str1[j]!= '\n' ; j++) { i = user_isalnum(str1[j]); if( i == 1 ) printf("entered one is alphanumeric char=%c\n",str1[j]); else printf("entered one is not alphanumeri...
C
// http://www.geeksforgeeks.org/write-a-c-program-to-find-the-maximum-depth-or-height-of-a-tree/ // /* Algorithm: 1. if tree is empty then return 0. 2. else height is 1(root) + max of left subtree height and right subtree height */ #include <stdio.h> #include <stdlib.h> struct node{ int data; struct node *left; s...
C
#include <stdio.h> #include <stdlib.h> #include <sym-api.h> int f1(int x) { printf("f1\n"); return x + 2; } int f2(int x) { printf("f2\n"); return x * 2; } int f3(int x) { printf("f3\n"); return x / 2; } int main() { lss_override_function_by_addr(f1, f2); int r1 = f1(42); /* calls f2 */ lss_override...
C
#include <stdio.h> #include <stdlib.h> #include "queue.h" int main(int argc, char* argv[]) { List l; Queue q; Stack s; Toy t; int cur = 0, k,aux = 1,p,n; int aux2 = 0; n = atoi(argv[1]); k = atoi(argv[2]); p = atoi(argv[3]); create_queue(&q); create_list(&l); for (int i = 0; i < 2 * n; i+=...
C
//dinosuruis rex //BY jotaGe #include <stdio.h> #include <conio.h> #include <time.h> #include <windows.h> #define f 25 #define c 117 void print_pantalla(char pantalla[f][c], int salto,int mov,int cactus_ale,int *flag_cactus, int nube_ale, int *flag_nube, int score,int score_hi,int *fin);//imprimir pantalla void contr...
C
#include"sort.h" int main() { int ar[] = { 5, 7, 9, 3, 0, 2, 4, 9, 8 }; int n = sizeof(ar) / sizeof(int); TwoWayInsertSort(); PrintArray(ar, 0, n - 1); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> FILE *fa, *fb; typedef struct ste { char lexeme[30]; int index; char type[15]; int size; } ste; typedef struct token { char token_name[100]; unsigned int row, col; } token; typedef struct localTableData { cha...
C
/************************************************************************************************* * EE344 Lab 5 * This lab create a security system with a key pad, touch sensor, temperature sensor, * and lcd interface. There are three states for the state machine: armed, disarmed and alarm. * The display wil...
C
/* * Copyright (c) 2014 Digi International Inc., * All rights not expressly granted are reserved. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. * * Digi Inte...
C
// E #include <stdio.h> int main() { int L, D, K, P, custo; scanf("%d %d", &L, &D); scanf("%d %d", &K, &P); //validacoes de entrada quant_pedagios = L / D; custo = L * K + P * quant_pedagios; printf("%d", custo); return 0; }
C
/** This file defines the functions and constants used in the 7-segment display. */ #include <stdint.h> #define SEG_A 0x01 #define SEG_B 0x02 #define SEG_C 0x04 #define SEG_D 0x08 #define SEG_E 0x10 #define SEG_F 0x20 #define SEG_G 0x40 #define ZERO (SEG_A|SEG_B|SEG_C|SEG_D|SEG_E|SEG_F) #define ONE (S...
C
#include<stdio.h> #include<string.h> int character(char a[]); char back(char a[]); int main() { char a[758]; gets(a); int count =0,backward,temp,i,j; count=character(a); printf("Number of character =%d\n",count); backward=back(a); printf("%s",a); return 0; } int characte...
C
void nhap(int *a){ int n, i printf("Nhap vao so phan tu: "); scanf("%d", n); for(i = 0; i < n; i++){ printf("Nhap phan tu thu %d: ", i + 1); scanf("%d", a + i); } } void xuat(int *a, int n){ for(i = 0; i < n; i++){ printf("%3d", *(a + i)); } }
C
#include<stdio.h> #include<iostream.h> int main () { int n, n1, rem,i; printf("first number for given range:\n"); scanf("%d",&n); printf("final number for given range:\n"); scanf("%d",&n1); printf("\n even numberbetween %d &%d are:"); for(i=f1;i<=f2;++i) rem=i/2; printf ("%d",rem); }
C
#include <lib/libc/yodalite_libc.h> #ifdef CONFIG_YODALITE_MALLOC_ENABLE #define YODALITE_MALLOC_INIT_FLAG (1) typedef struct Block Block; struct Block { void *addr; Block *next; size_t size; }; typedef struct heap { Block *free; // first free block Block *used; // first used block Bl...
C
#include <stdio.h> #include <stdlib.h> int main() { /*inialization phae */ int counter, grade, total; float average; counter = 1; // why here the counter is initialized in 1 and not in 0? total= 0; /*processing phase*/ while (counter <= 10) { printf("Please enter grade"); ...
C
# include <stdio.h> # include <stdlib.h> # include <string.h> # define SIZE 21 struct node { char data[SIZE]; size_t offset; }; void insert(struct node** head_ptr_ptr, struct node** tail_ptr_ptr, char* text) { int counter = 0; struct node* curr_ptr; struct node* prev_ptr; s...
C
#include <signal.h> #include "tlpi_hdr.h" static void handler(int sig) { sigset_t prev_mask; // UNSAFE: This handler uses non-async-signal-safe functions // (printf(), exit(); see Section 21.1.2) if (sig == SIGINT) { printf("Caught SIGINT\n"); return; } if (sig == SIGQUIT) { printf("Caught S...
C
#include "ggutils.h" #include "ggstruct.h" #include "charconversion.h" #include <string.h> #include <sys/socket.h> #include <netinet/in.h> #include <stdio.h> #include <stdlib.h> /* Proste hashowanie hasła */ static int gg_login_hash(unsigned char *password, unsigned int seed) { unsigned int x, y, z; y = seed; for...
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
/* ============================================================================ Name : 05_03.c Author : Version : Copyright : Your copyright notice Description : Simple assignment statements, Ansi-style ============================================================================ */ #include ...
C
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> void delete_space(char *p1,char *p2) { int i,j; for(i=0;i<strlen(p1);i++) { if (p1[i] != ' ') { p2[j]=p1[i]; j++; } } // p2[j] = '\0'; } void GetMemory(char *p,int num) { *p = (char *)malloc(sizeof(num)); } /*****************...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> typedef struct employee_type_tag{ char name[20]; char surname[20]; char PPS[20]; char nationality[20]; int age; int married; int children; } employee_type; typedef struct benefit_type_tag{ char PPS[20]; int salary; int pension; int hea...
C
#include <stdio.h> int main() { int n, i, t = 0; int a[24] = { 0, }; //printf("> "); scanf("%d", &n); //개수 입력 받기 for(i = 1; i <= n; i++) //개수 만큼 입력 받기 { scanf("%d", &t); //읽어서 a[t] = a[t] + 1; // 그 방에 먼저 들어있던 값에 1만큼 더해 다시 저장한다. a[t]+=1 과 같다. } for(i = 1; i <= 23; i+...
C
/* * File: task_1.10.c * Brief: task 1.10 solution * Autor: code squad 1337 * Created on 16.12.2019 * (c) MIPT 2019 */ #include "common.h" void insert(char *name, unsigned long long num) { unsigned long long old_num = 0; if (NULL == find(name)) { add(name, num); printf("OK\n"); } else { old_num ...
C
#include <stdio.h> void convertLower(char *); int main() { char string[50]; printf("Enter a string:\t"); scanf("%s", string); convertLower(string); printf("The string in lower case is:\t%s\n",string); return 0; } void convertLower(char *s) { if(*s != '\0') { if(*s>='A' && *s<='Z') *s += 'a'-'A'; s++; c...
C
#include "macho_reader.h" #include "macho_retriever.h" #include "macho_util.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <xar/xar.h> #include <libxml/parser.h> char *fname(const char *name, const char *ext) { const char *delimiter = "."; int length = strlen(name) + strlen(delimiter) + s...
C
#include <stdio.h> #include <openssl/evp.h> #include <stdlib.h> #include <string.h> char hash (char * hashType, char * message) { EVP_MD_CTX *mdctx; const EVP_MD *md; unsigned char md_value[EVP_MAX_MD_SIZE]; int md_len, i; OpenSSL_add_all_digests(); if(!message) { printf("Usage: mdtest digestname\n"); exi...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/time.h> #include "v202_protocol.h" #include "Raspduno.h" RF24 radio(RPI_V2_GPIO_P1_15, RPI_V2_GPIO_P1_26, BCM2835_SPI_SPEED_8MHZ); v202Protocol protocol; rx_values_t rxValues; bool bind_in_progress = false; unsigned long newTime; void setup(...
C
# include <stdio.h> void main() { char a[50]; gets(a); int i = 0; int count = 0; while(a[i] != '\0') { if (a[i] == ' ') count++; i++; } printf("So dau cach trong mang: %d", count); }
C
#include <stdint.h> #include <stddef.h> #include "em_core.h" #include "em_device.h" #include "em_usart.h" #include "em_gpio.h" #include "em_dma.h" #include "main.h" #include "mainctrl.h" #include "uartdrv.h" void UART_DMAConfig(void); #define UART_FRAMR_QUEUE_LEN_10 10 DMA_CB_TypeDef dma_uart_cb; /* * uart frame qu...
C
/** @file Transactions function is a function called in main and defined in nope.h*/ #include<stdio.h> #include<stdlib.h> #include<strings.h> #include"nope.h" void ViewTransactions() { FILE *x; char get; x = fopen("Transactions.txt","r"); ///Checking for Transactions.txt file in the directory if(x == NULL) { ...
C
#include <stdio.h> int main (void) { for (ch i = -128; i <= 127; i++) { printf("%d = %c\n", i, i); } return 0; }
C
/* Bounded queue implemented as fixed sized array. header file No threading support -jbs */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <stdbool.h> // A fixed sized queue as a dynamic array typedef struct { int count; // # of elements in queue int front; // index of next el...
C
#include "philo_main.h" void *death(t_philo *philo, pthread_t *live) { long delta; sem_wait(philo->params->print_sem); pthread_detach(*live); delta = delta_time(philo->params->start_time); philo->flag = 0; printf("%-8ld: Philo #%2d %s\n", delta, philo->index + 1, DEAD); return (0); } void *full(t_philo *philo...
C
//implementation of queue using functions #include<stdio.h> int enqueue(int a[], int rear,int size) { int element; if(rear==size-1) printf("queue is full\n"); else { rear++; printf("enter element: "); scanf("%d",&element); a[rear]=element; } return rear; } int dequeue(int a[],int front,int rear) { i...
C
#include <stdio.h> int main() { //Dichiaro le variabili int n1, n2, n3; //Utilizzo il tipo float poichè la variabile media potrebbe risultare un numero con la virgola float media; //L'utente ha la possibilità di inserire tre numeri printf("Ora ti verrà chiesto di inserire tre numeri\n"); printf("Inserisci il pri...
C
#include <stdio.h> int main(){ float n1,n2,media,af,mf; printf("Informe a nota 1: "); scanf("%f", &n1); printf("Informe a nota 2: "); scanf("%f", &n2); media = (n1 * 1 + n2 * 2) / 2; if(media >= 7){ printf("Aprovado\nMedia = %0.2f\n",media); } else if(media >= 4 && media < 7){ printf...
C
/** * Syspro Project 3 * Written By Vissarion Moutafis sdi1800119 **/ #include "Setup.h" #include "TTY.h" #include "TravelMonitor.h" static char *usage = "Usage: \n ~$ ./travelMonitorClient -m numMonitors " "-b socketBufferSize " "-c cyclicBufferSize " "-s sizeOfBloom " "-i input_dir " ...
C
int scf_printf(const char* fmt, ...); int sort(int* a, int m, int n) { if (m >= n) return 0; int i = m; int j = n; int t; t = a[i]; while (i < j) { while (i < j && t <= a[j]) j--; a[i] = a[j]; a[j] = t; while (i < j && a[i] <= t) i++; a[j] = a[i]; a[i] = t; } sort(a, m, i - 1); so...
C
/* =========================================================================== * Problem: * Reverse the words in a sentence, exclude punctuations(at the end of * sentence). * i.e. * i:The Irish National Liberation Army announces an end to its armed campaign. * o:campaign armed its to end an announces Army ...
C
/* Header file for bmp image utility Copyright (C) 2015 Kyle Gagner All rights reserved */ // include guard #ifndef BMP_H #define BMP_H #define BMP_RGB 1 #define BMP_ARGB 2 #define BMP_RGBA 3 #define BMP_LITTLE 4 #define BMP_BIG 8 #define BMP_FORMAT 3 #define BMP_ENDIAN 12 // writes a bitmap file // widt...
C
#include <stdio.h> #include <mpi.h> #include "mpitypes.h" #include "tree.h" //--------------------------------------------------------------------- //FUNCTIONS TO INITIALIZE MPI CUSTOM DATA TYPES: /* custom MPI Datatype for our vec3 struct */ int init_mpi_vec3(){ int err; //declare the 4 fields required to create ...
C
/** * File: recursor.h * Author: Ethan Gordon * A read-write UDP interface that broadcasts a datagram, then launches a * thread to wait on responses for a set period of time. **/ #ifndef RECURSOR_H #define RECURSOR_H /* Socket struct, holds QID-Address table and UDP information */ typedef struct recursor *Recurs...
C
#include <stdio.h> #include <string.h> /* de-comment the following line to activate the custom_instruction */ #define custom_instruction #define uchar unsigned char // 8-bit byte #define uint unsigned int // 32-bit word // DBL_INT_ADD treats two unsigned ints a and b as one 64-bit integer and adds c to it #define ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define CANT 3 typedef struct { int isEmpty; char name[51]; char lastName[51]; int sector; float salary; }eEmployee; int printMenu(char options[]); int intLoad(char message[]); float floatLoad(char message[]); char charL...
C
#include <stdio.h> #include <stdlib.h> int contarPar (int* vec, int tam); int main() { int vec[]= {6,5,10,12,11,13,21,22,8,9}; int par; par=contarPar(vec,10); printf("los numeros son %d", par); return 0; } int contarPar (int* vec, int tam){ int contador = 0; int i; ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "xget.h" #include "xlook.h" #include "xstring.h" #include "xvalidate.h" #include "xProductos.h" #include "xProveedores.h" #include "xProductos-Proveedores.h" #define LIBRE 0 #define OCUPADO 1 /** \brief Inicializa el estado de un vector de provee...
C
#include<stdio.h> #include<stdlib.h> struct node { int val; struct node * next; }; struct linkedList { struct node * head; struct node * tail; int length; }; int push(int value, struct linkedList *list){ if((*list).head == NULL){ struct node *nodePtr; nodePtr = (struct node *)...
C
#include<stdio.h> /** *main - print prime factors * *Return: 0 */ int main(void) { unsigned long int n, i; n = 612852475143; for (i = 3; i <= (n / 2); i += 2) { while (n % i == 0) { n = (n / i); } } printf("%lu\n", n); return (0); }
C
#define _CRT_SECURE_NO_WARNINGS 1 #include "game.h" void Initboard(char board[ROWS][COLS], int rows, int cols, char set) { int i = 0; for (i = 0; i < rows; i++) { int j = 0; for (j = 0; j < cols; j++) board[i][j] = set; } } void Desplayboard(char board[ROWS][COLS], int row, int col) { int i = 1; printf("...
C
#ifndef MATCHTYPE_H #define MATCHTYPE_H #include <platform.h> #include "../ast/ast.h" #include "../pass/pass.h" PONY_EXTERN_C_BEGIN /// See comment for is_matchtype() for a description of these values typedef enum { MATCHTYPE_ACCEPT, MATCHTYPE_REJECT, MATCHTYPE_DENY_CAP, MATCHTYPE_DENY_NODESC } matchtype_t; ...
C
/* Argyros Konstantinos AM: 2022202000014 dit20014@go.uop.gr Pavlos Sygrimis AM: 2022202000202 dit20202@go.uop.gr */ //processing.c #include "bmp.h" #include "processing.h" // prototypes void printattributes (struct bmp_header *h1,struct bmp_info *h2) { printf("\nFILE DETAILS\n"); printf("Type: %d\n", h1-...
C
// RUN: %clang_builtins %s %librt -o %t && %run %t // REQUIRES: librt_has_absvti2 // REQUIRES: int128 #include "int_lib.h" #include <stdio.h> #include <stdlib.h> #ifdef CRT_HAS_128BIT // Returns: absolute value // Effects: aborts if abs(x) < 0 COMPILER_RT_ABI ti_int __absvti2(ti_int a); int test__absvti2(ti_int a...
C
// Author: Jan Klinkosz, id number: 394 342 #ifndef SK_MALE_ZADANIE1920_TCP_H #define SK_MALE_ZADANIE1920_TCP_H #include <stddef.h> #include <sys/types.h> // connects to server with address:port via TCP // // returns sock number - on success, -1 - on failure int connect_with_server(char* address, char* port); // wr...
C
#include<stdio.h> #include<conio.h> void main() { int i; char c; for(i=1;i<2400;i++) { c=1; printf("%c",c); } getch(); clrscr(); }
C
/** @file * Interfejs służący do uruchamiania gry gamma w trybie wsadowym * * @author Bartłomiej Kozaryna <bk______@students.mimuw.edu.pl> * @copyright Uniwersytet Warszawski * @date 08.05.2020 */ #ifndef GAMMA_BATCH_MODE_H #define GAMMA_BATCH_MODE_H #include <stdint.h> #include "gamma.h" #include "parameter_ga...
C
//////////////////////////////////////////////////////////////////////////////////////////////////////////////// // // // BFSG Opimization algorithm ...
C
#include<stdio.h> #include<conio.h> void main() { int triangle,base,height; printf("Enter a base and height : \n"); scanf("%d %d",&base,&height); triangle=base*height; printf("area of triangle : %d",triangle); getch(); }
C
/* * main.c * * Created: 2/24/2021 9:15:21 AM * Author: Dennis Kruijt & Shinichi Hezemans & Merijn Couweleers */ #define F_CPU 8e6 #include <stdio.h> #include <avr/io.h> #include <util/delay.h> #include <avr/interrupt.h> #include "lcd/lcd.h" void setupCounter(void) { TCCR2 |= 0b00000111; DDRD &= 0b11111110; sei(...
C
#include<stdio.h> int calc(char op, int a, int b){ int m; if(op == '+') m=a+b; else if(op == '-') m=a-b; else if(op == '*') m=a*b; else if(op == '/') m=a/b; else m = a%b; return m; } int main(){ int xarg1,xarg2; char xop; scanf("%c %d %d",&xop,&xarg1,&xarg2); printf("%d\n",calc(xop,xa...
C
#include "holberton.h" #include <stdlib.h> /** * create_array - creates an array of chars * and initializes it with a specific char. * * @size: size of the array * @c : character to initialize the array * * Return: array */ char *create_array(unsigned int size, char c) { char *array; unsigned int i; if (si...
C
#ifndef __PACK_H #include "StringOperation.h" //#include "../../common/HashMap.h" #include <stdio.h> /* 较为长的时间来考虑如何来构建这样的一个结构 最终还是选用了最为简单的,可以灵活变换的一 种框架来容纳数据以及解析内容。 <package> <chain> 放置解析链,描述,映射等 </chain> <pack> 放置数据以及信息描述 </pack> </package> 希望的是在底层库文件只用实现 open(),write()方法 在传输时只用实现 sen...
C
#ifndef TLB_DATA_STRUCTURES_H #define TLB_DATA_STRUCTURES_H /* ADT for a TLB entry int logical_page_number:22; -> used to store the logical page number of process unsigned int physical_frame_number:15; -> used to corresponding physical frame number unsigned int valid:1; -> used to tell if the tlb e...
C
// 1 ~ 10 ϱ #include<stdio.h> int main(void) { int arr[10] = { 1,3,2,5,7,6,10,9,8,4 }; int i, j, index, temp; for (i = 0; i < 10; i++) { int min = 11; for (j = i; j < 10; j++) { if (arr[j] < min) { min = arr[j]; index = j; } } temp = arr[i]; arr[i] = arr[index]; arr[index] = temp; } ...
C
#ifndef RANDOM_X_Y_H #define RANDOM_X_Y_H /** * @brief generates a pseudo random interger based on rand() function from cstdlib * * @param lower the lower bound, inclusive * @param upper the upper bound, exclusive * @return int the random number between lower and upper bounds */ int random_x_y(int lower=0, int ...
C
#define _CRT_SECURE_NO_WARNINGS //鿴һ //#include <stdio.h> //#include <sys/types.h> //#include <unistd.h> //int main() //{ // while (1){ // sleep(1); // } // return 0; //} //ȡӽ̵PID͸̵PPID //#include <stdio.h> //#include <sys/types.h> //#include <unistd.h> //int main() //{ // printf("pid: %d\n", g...