language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include<stdio.h> int main() { float units,cost=0; printf("Enter number of units consumed: "); scanf("%f",&units); if(units>0 && units<=100){ cost=units*5; } else if(units>100 && units<=130){ cost=(100*5)+(units-100)*5.5; } else if(units>130 && units<=150){ cost=(100*5)+(30*5.5)+(units-13...
C
/* ISC license. */ #include <skalibs/nonposix.h> #include <sys/socket.h> #include <netinet/in.h> #include <skalibs/uint16.h> #include <skalibs/bytestr.h> #include <skalibs/socket.h> int socket_bind4 (int s, char const *ip, uint16 port) { struct sockaddr_in sa ; byte_zero(&sa, sizeof sa) ; sa.sin_family = AF_INE...
C
#include <iostream> #include <string> #include <array> using std::string; using std::size_t; using std::cout; using std::endl; string make_plural(size_t ctr, const string &word, const string &ending = "s") { return (ctr > 1) ? word + ending : word; } int main() { cout << make_plural(1, "success","es") << end...
C
#include <signal.h> static void sig_child(int); int main(void) { pid_t pid; int i; printf("before signal\n"); signal(SIGCHLD, sig_child); printf("task\n"); pid = fork(); printf("bye!\n"); if (pid == 0) { sleep(1); exit(0); } while(1) { i = i; } } static void sig_child(int signo){ pid_t pid; int ...
C
/*Program 9 Design, develop, and execute a program in C to read a sparse matrix of integer values and to search the sparse matrix for an element specified by the user. Print the result of the search appropriately. Use the triple <row, column, value> to represent an element in the sparse matrix. */ #include<stdio.h...
C
#include "dz2.h" #include "dz3.h" #include "dz5.h" #include <stdio.h> void shellSortArray(TrapezeArray *theArray,FILE *file) { Trapeze *tmp; int in = 0; int out = 0; int h = 1; // start h = 1 //1. Calculate start value of h while (h <= theArray->count/2) { h = h*2 + 1; } //2. Seq...
C
#include <sys/types.h> #include <sys/socket.h> #include <arpa/inet.h> #include <netinet/in.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <netdb.h> char* deal(char*); int main(){ //设置服务器ip(点分十进制或者域名都可以) const char *host = "127.0.0.1"; //选择要打开的端口或者服务 const int server =...
C
#include <stdint.h> #include "data.h" #include "deepfreeze.h" #include "dfserv.h" #include "shared.h" #pragma pack(push,1) typedef struct { uint32_t id; uint32_t offset; uint32_t size; uint32_t size_2; uint32_t unknown[4]; } tail_entry_t; #pragma pack(pop) #pragma pack(push,1) typedef struct { uint32_t hea...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_hooks.c :+: :+: :+: ...
C
// // Created by Jost Luebbe on 2019-09-02. // #include <stdio.h> #include <string.h> #include <sys/socket.h> #include <arpa/inet.h> #include <unistd.h> #include <stdlib.h> #define PORT 5555 int main() { int sock; struct sockaddr_in server; char server_reply[2000]; if ((sock = socket(AF_INET, SOCK...
C
/* ** EPITECH PROJECT, 2017 ** navy ** File description: ** navy */ #include "../include/my.h" #include "../include/navy.h" char **create_my_board(char *pos, int a, int c, int b) { int k = 2; char **enemy = create_enemy_board(); while (k != 6) { b = find_the_letter(pos[a], enemy, 1); a = a + 1; c = find_the...
C
#include <stdio.h> int queue[100005]; int b=0; int f=0; void push (int a) { queue[f++]=a; } int pop (void) { if(empty()) return -1; else { return queue[b++]; } } int size (void) { return f-b; } int empty (void) { if(b==f) return 1; else return 0; } int front_func (voi...
C
#include <stdio.h> #include <stdlib.h> typedef struct Friend_{ char name; struct Friend_ *next; }Friend; typedef struct Node_{ char name; struct Friend_ *friend; struct Node_ *next; }Node; Node* addNode(char name){ Node* new = malloc(sizeof(Node*)); new->name = name; new->friend = N...
C
#include <unistd.h> #include <fcntl.h> #define TAM 1000 void main(int argc, char* argv[]){ int r, fd = open(argv[1], O_RDONLY), i; char buff[TAM]; r = read(fd, buff, TAM); for(i=0; i<r && buff[i] != '\n'; i++); write(1, buff, i+1); }
C
#include<stdio.h> typedef unsigned short u_int; typedef unsigned short u_short; typedef unsigned char u_char; u_char little_endian() { u_short word=0x1234; u_char * p = (u_char *) &word; return (p[0] == 0x12) ? 0 : 1; } int count_bits(u_int data) { int cnt=0; while(data != 0) { print...
C
#include<stdio.h> #include<malloc.h> int mean(int num[], int n); int avg(int num[], int n); void sort(int num[], int n); int cen(int num[], int n); void min(int num[], int t); int main() { int n; int *num; scanf("%d", &n); num = (int*)malloc(sizeof(int)*n); for (int t = 0; t < n; t++) { scanf("%d", &num[t]); }...
C
/* Copyright 2012-2014 Scianta Analytics LLC All Rights Reserved. Reproduction or unauthorized use is prohibited. Unauthorized use is illegal. Violators will be prosecuted. This software contains proprietary trade and business secrets. Module: saListDir Description: Write a list of files cont...
C
// 40个3和30个2凑100 #include <stdio.h> int main(int argc, char *argv[]) { int arr[][2] = {4,7,5,5,4,3,2,2}; int target = 70; int kinds = sizeof(arr)/sizeof(int)/2; int i, j; for (i = 0; i < kinds; ++i) { for (j = 0; j< arr[i][0]; j++) { if (target < arr[i][1]) break; ...
C
/* ** A word guess game that gives the player three tries to guess ** a word (pulled randomly from a file) -- a hint is given before ** each guess */ #include <stdio.h> #include <stdlib.h> #include <string.h> char *word1 = "lobster"; char *word2 = "teddybear"; char *word3 = "smartphone"; char *word4 = "purse"; cha...
C
#include <stdlib.h> #include <stdio.h> main(int argc, char* argv[]) { int i; pid_t parentpid = getpid(); printf("Proces macierzysty %d exit:\n", getpid()); for (i = 0; i < argc; i++){ pid_t pid; if((pid = fork()) == 0) { int j; for(j=0; j<(int)strtol(argv[i+2], NULL, 10); j++) { printf("Potomn...
C
/* * ===================================================================================== * Description: solution for practice 9.2 * Version: 1.0 * Created: 08/08/2018 03:58:47 PM * Author: xiaochen.jiang (kl), jiangxch.hn@gmail.com * =================================================...
C
#include<stdio.h> int main() { int i=0; double k,s=0; while(scanf("%lf",&k) != EOF){ i++; s += k; } printf("%.3lf",s/i); } /************************************************************** Problem: 1417 User: 201901060610 Language: C Result: Accepted Time:0 ms Memory:...
C
// https://www.hackerrank.com/challenges/the-hurdle-race #include <stdio.h> int findMax(int n, int A[n]); int main() { int n, k, max, magic; scanf("%d %d",&n,&k); int H[n]; for(int i = 0; i < n; i++) scanf("%d",&H[i]); max = findMax(n, H); magic = max - k; if (magic < 0) ...
C
#include <std.h> inherit ARMOUR; void create(){ ::create(); set_name("spiked boots"); set_id(({ "boots", "boot", "shoe", "shoes", "spiked boots" })); set_short("%^RESET%^%^ORANGE%^S%^WHITE%^p%^ORANGE%^i%^WHITE%^k%^ORANGE%^e%^WHITE%^d %^ORANGE%^Boots%^RESET%^"); set_obvious_short("%^RESET%^%^ORANGE%^hiking boots%^...
C
#include <stdio.h> #include "fileManager.h" int main(int argc,char * argv[]){ int matrix[10][10]; int distance=0; int i=0; openFile("distances_10.txt",matrix); distance+=matrix[0][atoi(argv[1])]; //printf("%d\t%d\n",0,atoi(argv[1])); for (i=1;i<(argc-1);i++){ distance+=matrix[atoi(ar...
C
#include <stdio.h> int interpolationSearch(int arr[], int lo, int hi, int x) { int pos; if (lo <= hi && x >= arr[lo] && x <= arr[hi]) { pos = lo + (((double)(hi - lo) / (arr[hi] - arr[lo])) * (x - arr[lo])); if (arr[pos] == x) return pos; if (arr[pos] < x) ...
C
#include <darknet.h> void fill_image_f32(image* im, int w, int h, int c, float* data) { int i; for (i = 0; i < w*h*c; i++) { im->data[i] = data[i]; } } void set_data_f32_val(float* data, int index, float value) { data[index] = value; }
C
#include <stdbool.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <png.h> #include "quadtree.h" #include "diskcache.h" #include "png.h" #include "pngloader.h" #define HEAP_SIZE 100000 #define TILESIZE 256 // rgb pixels per side #ifndef __BIGGEST_ALI...
C
#include <stdio.h> int main(void) { printf("First off, this part is about how the Raspberry Pi boots.\n"); stage1_of_boot(); endSoFar(); } int stage1_of_boot(void) { printf("The Pi cannot boot from the SD card yet, because the CPU\n"); printf("hasn't been started yet.\n"); printf("The Pi uses the GPU to s...
C
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]){ int i,j,k; double thres; FILE *outfile; int NumFADC[8]; for(i=0;i<8;i++) NumFADC[i]=0; if (argc<2){ printf("few argument...\n"); exit(-1); } for(i=1;i<argc;i++){ sscanf(argv[i],"%d",&(NumFADC[i-1])); } printf("Th...
C
// program odf sorting using bubble sort*/ // Author udhayamoorthi // the bubble sort scanning the list and excange the adjacent if they are out of order with respect to each other. #include<stdio.h> #define MAX 100// all lines that start with # are prepocessed by preprocessor int main() { int arr[MAX],i,k,j,n,temp,...
C
#include <stdio.h> #include <stdlib.h> int main() { char a,b,c; printf("es de maniana?\n"); a=getche(); printf("\nEl llamado es de tu casa?\n"); b=getche(); printf("\nEstas en clase?\n"); c=getche(); if(c=='s'||c=='S') { printf("\nno debe atender"); } else { ...
C
/*this is a module in DomU to create a Grant Reference, * and this will pass manaully to the Dom0,then dom0 * can access the page in DomU by the GR * */ #include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> #include <asm/pgtable.h> #include <xen/page.h> #include <asm/sync_bitops.h> #include...
C
/* * A procfs tic-tac-toe game and general playground for developing kernel * loadable modules in Linux 3.10 and later. * * - Uses the procfs API in 3.10+ * - Implements read and write. */ #ifndef __KERNEL__ #define __KERNEL__ #define MODULE #endif #include <asm/uaccess.h> #include <linux/delay.h> #include ...
C
#include<stdio.h> #include"../headers/errno.h" #include"../headers/nheaders.h" #include"../headers/lheaders.h" #define start (*_list)->lstart /**************************************************** DELETION FUNCTIONS ********************************************************/ /*Always deletes the first element in the qu...
C
//////////////////////////////////////////////////////////////////////////////// // File: trapezoidal_method.c // // Routines: // // Trapezoidal_Method ...
C
#ifndef _HWE_COMMON_H_ #define _HWE_COMMON_H_ #include <stdint.h> #include <stdbool.h> /* * Common definition for all events */ /* * version of trace (present in HWE_INFO event) */ #define HWE_VERSION_MAJOR 1 #define HWE_VERSION_MINOR 3 #define HWE_VERSION (256*HWE_VERSION_MAJOR + HWE_VERSION_MINOR) /**********...
C
#ifndef _PARSE_EXP_H #define _PARSE_EXP_H #include "stack.h" #include "token.h" #include "ast.h" #include "hashtable.h" #define AST_STACK 0 #define OP_STACK 1 typedef uint32_t parse_exp_disallow_t; // A bit mask #define PARSE_EXP_ALLOWALL 0x00000000 #define PARSE_EXP_NOCOMMA 0x00000001 // Do not allow outermost '...
C
#include <stdio.h> #include <stdlib.h> int main(int argc, char const *argv[]) { int n, capacity, current, summation = 0, i = 0; scanf("%d %d", &n, &capacity); while(n--) { scanf("%d", &current); summation += current; if(summation > capacity) break; else i++; } printf("%d\n", i); return 0; }
C
#include<stdio.h> void f(int *p) { *p = 100; return; } int main(void) { int i = 99; f(&i); printf("i = %d\n", i); return 0; }
C
#include<stdio.h> #include<string.h> int main() { int n; scanf("%d ", &n); char words[n][20]; char ch; for(int i = 0; i < n; i++) scanf("%s ", &words[i]); scanf("%c", &ch); for(int i = 0; i < n; i++) for(int j = 0; j < strlen(words[i]); j++) if(words[i][j] == ch) { printf("%s\n", words[i]); b...
C
// // Created by Administrator on 9/12/19. // #include "Ejercicio8.h" char ** eliminar_mrt(char * pal) { char *ei = "MU_TEST("; char *ef = ")"; int longitudei = (int)(strlen(ei)); char *pi,*pf; pi = pal; char *result = malloc(sizeof(char)); int tmp,c; c = 1; while((pi = strstr(pi,...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include "md4.h" #include "ed2k.h" #include <sys/stat.h> long get_filesize(char *FileName) { struct stat file; if(!stat(FileName,&file))return file.st_size; return 0; } int main(int argc, char *argv[]) { int i; uchar o1[16],o2[32]; FILE *...
C
#ifndef _SINGLETON_H_ #define _SINGLETON_H_ #define DECLARE_SINGLETON(theClass) \ public: \ static theClass *Instance() \ { \ static theClass *m_pInstance = 0; \ if (0 == m_pInstance) \ { \ static theClass inst;\ m_pInstance = &inst...
C
// // Sim3D2DConverter.c // chenSDLtest1 // // Created by Chen Sokolovsky on 7/7/16. // Copyright © 2016 chen. All rights reserved. // /* LICENSE 5dv - Five Dimensional Vision - File/Stream protocol, Encoder & Decoder @copywrite Chen Sokolovsky 2012-2017 This software is not open source. You may not use it...
C
#include<stdio.h> int power_1(int a,int b); void main(){ power_1(5,5); } int power_1(int base,int n){ int p; for(p=1;n>0;--n){ p = p*base; } printf("%d\n",p); }
C
#include "common.h" #include "graph.h" #include "list.h" void help (char *cmd); int da (ugraph_struct *graph); int main (int argc, char **argv) { int opt; unsigned int nodenr = 0, linknr = 0; ugraph_struct g; char name[32]; if (argc <= 1) { help (argv[0]); ...
C
#include<conio.h> #include<stdio.h> #include<stdlib.h> #include<locale.h> int main(){ setlocale(LC_ALL,""); float vetorA [20]; float vetorB [20]; int i, j; for ( i = 0; i < 20; i++) { printf ("\nDigite os valores do vetor: "); scanf ("%f", &vetorA [i]); } for ( i = 19; i >= 0; i--) { ...
C
// rank 6 #include <std.h> inherit "/d/magic/mon/naturesally/natureally.c"; void create() { ::create(); set_id(({"natures ally","elephant","lumbering elephant"})); set_short("%^BOLD%^%^BLACK%^hu%^RESET%^l%^BOLD%^%^BLACK%^ki%^RESET%^n%^BOLD%^%^BLACK%^g %^RESET%^el%^BOLD%^%^BLACK%^e%^RESET%^pha%^BOLD%^%^B...
C
// UNSUPPORTED: armv6m-target-arch // RUN: %clang_builtins %s %librt -o %t && %run %t // REQUIRES: librt_has_bswapsi2 #include <math.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> extern uint32_t __bswapsi2(uint32_t); int test__bswapsi2(uint32_t a, uint32_t expected) { uint32_t actual = __bswapsi2(a...
C
//给定一个存放整数的数组,重新对数组排序使得数组的左边为奇数,右边为偶数,要求空间复杂度为O(1)。 //void sort(int* arr, int len); //有快排的影子 #include <stdio.h> #include <string.h> void sort(int* arr, int len) { int l = 0, r = len - 1; while (l < r) { int t = arr[l]; while (l < r && arr[r] % 2 == 0) r--; arr[l] = arr[r]; while (l < r && arr[l] % 2 == 1) l+...
C
/* * @lc app=leetcode id=62 lang=c * * [62] Unique Paths */ // @lc code=start // Solution 2: DP int uniquePaths(int m, int n) { int dp[m + 1][n + 1]; memset(dp, 0, (m + 1) * (n + 1) * sizeof(int)); dp[0][1] = 1; for (int i = 1; i <= m; i++) { for (int j = 1; j <= n; j++) dp[...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define BUFFER_LIMIT 256 void* reader() { char *str; char aux[BUFFER_LIMIT]; printf("Enter a string : "); fgets(aux, BUFFER_LIMIT, stdin); printf("You entered: %s", aux); str = malloc(sizeof(char) * strlen(aux)); strcpy(str, aux); return ...
C
#include "nn.h" void fc(int m, int n, const float *x, const float *A, const float *b, float *y) { int i,j,k; k = 0; for(i=0; i<m; i++) { float z = 0; for(j=0; j<n; j++) { z += *(A+j+k) * *(x+j); } *(y+i) = z + *(b+i); k += n; } } void relu(int n, const float *x, float *y) { int i; ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: ...
C
/* ======================================== * * Copyright YOUR COMPANY, THE YEAR * All Rights Reserved * UNPUBLISHED, LICENSED SOFTWARE. * * CONFIDENTIAL AND PROPRIETARY INFORMATION * WHICH IS THE PROPERTY OF your company. * * ======================================== */ #include "project.h" #include "USBCom.h"...
C
/* * Olexandr Matveyev * Programm 1, CSCI 112 * 2/14/2017 */ //Including derectivs #include <stdio.h> #include <math.h> #include <float.h> //Declaration of the functions int is_valid(int); int get_input(void); void print_pattern(int); //The definition of functions int main(void) { //Declaration of the va...
C
/* The request reply BLE packet structure for the Eir watch app. This uses the * watch_service for the transport mechanism. Well formed packets consist are * 1 to 20 bytes inclusive in length. A well formed packet will always begin * with a byte containing the PACKET_TYPE in the bits 0-6 and bit 7 as a flag * indic...
C
#include <stdio.h> int main ( void ) { int matrixA[4][5] = { {1, 2, 3, 4, 5 }, {6, 7, 8, 9, 10}, {11,12,13,14,15}, {16,17,18,19,20}, }; int matrixB[5][4]; void transposeMatrix (int matrixA[][5], int matrixB[][4]); void displayMatrix (int matrixB[][4]); transposeMatrix ( matrixA, matrixB); displayMat...
C
#include "_bpt.h" // Delete page_t * remove_entry_from_node(int table_id, page_t * page, int64_t key) { int i; int num_pointers; // Remove the pointer and shift other pointers accordingly. // First determine number of pointers. num_pointers = page->is_leaf ? page->num_keys : page->num_keys + 1; i = 0; // Cas...
C
#include "toplista.h" #include "egyeb.h" #include <stdio.h> #include <string.h> #include <stdlib.h> /*! @file toplista.c * \brief A toplista betltst s szerkesztst ler fggvnyeket tartlmaz modul. * */ /** * Fjlbl betlti a lementett toplistt. * Ha nem tallja, akkor ltrehozza. * Ha nem tudja megynitni a fjlt, vagy...
C
#include <zlib.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include "kseq.h" #include "khash.h" KSEQ_INIT(gzFile, gzread); KHASH_SET_INIT_STR(s) #define BUF_SIZE 2048 char *strstrip(char *s) // function for striping lines { size_t size; char *end; size = strlen(s); if (!size) ...
C
/********************* cp.c file ****************/ #include "ucode.c" int main(int argc, char* argv[]) { int fd, gd, n; char buf[1024]; // 1. fd = open src for READ; fd = open(argv[1], O_RDONLY); if (fd < 0) { printf("FAILED TO OPEN SRC\n"); exit(1); } // 2. gd = open dst for WR | CREAT; g...
C
// // Created by 王勇椿 on 2020/12/16. // /** * (不正确地)使用select得到TCP带外数据通知的接收程序 * 不正确的地方:select一直指示一个异常条件,直到进程的读入越过带外数据。同一个带外数据不能读入多次,因为首次读入之后,内核就清空这个单字节的缓冲区。 * 再次指定MSG_OOB标志调用recv时,它就返回EINVAL * 解决办法:读入普通数据后才select异常条件 */ #include "../lib/unp.h" #include <stdbool.h> int main(int argc, char *argv[]){ int listen...
C
#ifndef _NEWRAPH_H #define _NEWRAPH_H #include <stdio.h> #include "funcoes.h" #define JMAX 4000000 /*definido o número máximo de iterações.*/ /* Função que através do método de Newton-Raphson retorna a raíz da função desejada. Recebe como parâmetros um valor chute de raiz e o erro absoluto epsilon (er...
C
/** * @file main.c * @brief Description * @date 2018-1-1 * @author name of author */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <string.h> #include <sys/types.h> #include <sys/wait.h> #include <signal.h> #include "debug.h" #include "memory.h" #include "args.h" struct genge...
C
#include<cs50.h> #include <stdio.h> #include <stdlib.h> #include "bmp.h" int main(int argc, char* argv[]) { if (argc != 3) { printf("Invalid input, please provide all data \n"); return 1; } FILE* clue_picture = fopen(argv[1], "r"); if (clue_picture == NULL) { print...
C
#include "tools.h" #include "tools.c" //============================================================================= #define MAXREAD "255" #define MAXSIZE 256 char INPUT[MAXSIZE]; char OUTPUT[MAXSIZE]; char KEYWORD[MAXSIZE]; char REPLACE[MAXSIZE]; char HOLD[MAXSIZE]; //================================================...
C
// Problem: // Given an array of n positive integers and a positive integer s, find the // minimal length of a contiguous subarray of which the sum ≥ s. If there isn't // one, return 0 instead. // // Example: // Input: [2,3,1,2,4,3], s = 7 // Output: 2 ([4,3]) // // Solution: // Use a "sums" array where sums[i] = num...
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: Hp * * Created on Ngày 02 tháng 3 năm 2020, 19:11 */ #include <stdio.h> #include <stdlib.h> /* ...
C
/* * Universidade Federal do Rio de Janeiro * Escola Politecnica * Departamento de Eletronica e de Computacao * EEL270 - Computacao II - Turma 2019/2 * Prof. Marcelo Luiz Drumond Lanza * * Autor: Luiz Fernando Loureiro Leitao * Descricao: implementacao do programa de testes da funcao GerarPisPasep. * * $Autho...
C
#ifndef INDEX_IMPL_H #define INDEX_IMPL_H #include "DataStructures/linkedList.h" #include "index.h" struct indexNode; struct Entry; struct EntryList; #ifdef __cplusplus extern "C" { #endif struct EntryList { LinkedList<Entry>* list; Node<Entry> * current; }; typedef struct EntryList EntryList; struct Ind...
C
/* Source: https://github.com/miloyip/itoa-benchmark/blob/master/src/branchlut.cpp License: https://github.com/miloyip/itoa-benchmark/blob/master/license.txt Code is modified for benchmark. */ #if defined(__clang__) # define clang_attribute __has_attribute #else # define clang_attribute(x) 0 #endif #if !de...
C
/* ** name: mradius ** ** author: bjr ** created: 30 mar 2017 ** last modified: 16 apr 2017 ** */ #include<stdio.h> #include<stdlib.h> #include<errno.h> #include<string.h> #include<fcntl.h> #include<sys/types.h> #include<sys/socket.h> #include<netinet/in.h> #include<arpa/inet.h> #include<netdb.h> #include<assert.h> #i...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* do_type.c :+: :+: :+: ...
C
/* * For license: see LICENSE file at top-level */ #include "collect.h" #include <stdio.h> #include <string.h> #include <stdlib.h> #include "util/util.h" #include "util/debug.h" #define CSV #include "util/run.h" #define VERIFYx #define PRINTx #define WARMUP #define EQUAL typedef void (*collect_impl)(void *, cons...
C
#include <stdio.h> int to_upper(int character) { return character -= 32; }
C
#include <stdio.h> main () { int Num, Nums, rest; printf("Insert an odd number \n"); Nums = -1; rest = 0; do { scanf("%d", &Num); rest = Num % 2; Nums++; } while (rest == 0); printf("You insert %d even numbers.", Nums); return 0; }
C
/************************************************************************* > File Name: read大数据.c > Author: > Mail: > Created Time: Wed 26 Apr 2017 09:30:54 PM PDT ************************************************************************/ #include<stdio.h> #include<stdlib.h> #include<string.h> //定义文件最大有MAX_SIZE...
C
/* Software systems mini project : Railway ticket booking system * */ #include<stdio.h> #include<fcntl.h> #include <stdlib.h> #include<unistd.h> #include<string.h> #include "../include/dataStructs.h" #include "../include/admin.h" #include "../include/normal.h" /* Modules of admin */ int loginVerify(struct login us...
C
//Alocacao Dinam 1 //Operador sizeof #include <stdio.h> typedef struct ponto { float x, y; }Ponto; int main() { int x, f, d, c; x = sizeof(int); f = sizeof(float); d = sizeof(double); c = sizeof(char); printf("Tamanho do int = %d bytes\n", x); printf("Tamanho do float = %d bytes\n", f);...
C
#include <stdio.h> int main() { char c; int n; c=getchar(); if(c!='\n') { n = c-'0'; printf("%d",n); } }
C
#include <stdio.h> void format_float() { float f; printf("Enter a number \n"); scanf("%f", &f); printf("value = %f \n", f); } void getchar_putchar() { int c; printf("Enter value: \n"); c = getchar(); printf("\n You entered:\n"); putchar(c); printf("\n"); } void gets_puts() { char str[100]; printf("Enter...
C
#include <stdio.h> int main(int argc, char *argv[]) { char buffer [256]; /* Initialize file_name */ FILE *file = fopen("test1", "rb"); /* The file position indicator needs to be set to 1 before you call ungetc() else there is unpredictable behavior. */ //fseek(file, 1, SEEK_SET); p...
C
#include <stdio.h> int price[1001], m[1001]; int makeMax(int x); int main() { int n; scanf("%d", &n); getchar(); for(int i=1; i<=n; i++) { scanf("%d", &price[i]); getchar(); } for(int i=1; i<=n; i++) m[i] = -1; m[1] = price[1]; printf("%d\n", makeMax(n)); // n 만드는 최대 가격 return 0; } int makeMax(int x)...
C
//Print half Pyramid pattern in c /* 1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 */ #include <stdio.h> int main() { int i,j,rows = 5; for(i=1;i<=rows;i++) { for(j=1;j<=i;j++) { //printf("%d ",j); //output number after space //we change the number to other pattern like * printf("* ");//* after space } ...
C
#include "funciones.h" int power(int base,int potencia){ int i,resultado = 1; for (i=0;i<potencia;i++){ resultado *= base; } return resultado; } char **split(char *phrase, const size_t length, const char delimiter, size_t *n_tokens) { int words = 1; size_t n; for (n = 0; n < length; n++) wo...
C
#include <stdio.h> unsigned int ft_strlcat(char* dest, char* src, unsigned int size); int main(int argc, char const *argv[]) { char test[256] = "\0zxcvzxcvzxcvxzcvzxcv"; printf("%d-", ft_strlcat(test, "asdf", 16)); printf("%s\n", test); printf("%d-", ft_strlcat(test, "asdf", 6)); printf("%s\n", test); printf("%d...
C
/* ** EPITECH PROJECT, 2018 ** rpg ** File description: ** init_pause */ #include <stdlib.h> #include "rpg.h" #include "struct.h" #include "menu.h" #include "free.h" #include "init.h" #define BUTTON_NB 3 #define RESUME "./asset/Resume.png" #define QUIT_GAME "./asset/QuitGame.png" #define STATS "./asset/Stats.png" #def...
C
/* Copyright (c) 2013 MIT License by 6.172 Staff * * DON'T USE THE FOLLOWING SOFTWARE, IT HAS KNOWN BUGS, AND POSSIBLY * UNKNOWN BUGS AS WELL. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A ...
C
//*************************************************WINDOW WATCHDOG TIMER PRACTISE***************************************************************************// #include "stm32f4xx.h" // Device header #define CLK 8000000UL // Function prototype // void RCC_Config(void); void GPIO_Init(void); void WWD...
C
#include <stdlib.h> #include <string.h> #include <cell.h> static int bit_at_index(char byte, int index); static void free_subtape(cell *current, cell *previous); /* * We assume index is between 0 & 7, and create a bit mask to extract only that * bit from byte. Finally, we double negate it to convert it to 0 or 1, ...
C
#include <stdlib.h> typedef int ElemType; #define maxsize 50//数组,栈等最大空间 //!!以下为顺序结构!! // 顺序表的结构定义 typedef struct { int data[maxsize]; // 存放数组的数组 int length; // 顺序表的实际长度 }SeqList; // 顺序表类型名为SeqList // 单链表的类型定义 typedef struct node { int data; // 数据域 struct node *next; // 指针域 }Nod...
C
#include <stdio.h> int main() { int s,m,h,q; //* s is seconds, m is minutes, q is quantity of seconds and h for hours printf("recieve a quantity of seconds and show its equivalence in format hours,:minutes,:seconds \n") printf("which is the quantity of seconds?") scanf("%d",&q); h=(q/3600); m=((q-h*3600)/60); ...
C
#include<stdio.h> main() { int a[6][6],d[6][6],b,c; printf("Enter the elements of matrix 1\n"); for(b=0;b<=5;b++) { for(c=0;c<=5;c++) { scanf("%d\t",&a[b][c]); } } printf("Enter the elements of matrix 2\n"); for(b=0;b<=5;b++) { for(c=0;c<=5;c++) { scanf("%d\t",&d[b][c]); } } printf("...
C
#define INCL_DOSPROCESS /* Process and thread values */ #define INCL_DOSERRORS /* DOS error values */ #include <os2.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(USHORT argc, PCHAR argv[] ) { APIRET rc = NO_ERROR; /* Return code ...
C
#include <string.h> #include <time.h> #include "helpers.h" #include "shared.h" #ifndef OPTIONS_H #define OPTIONS_H /** * the index of the cash register array that is occupied by each denomination, *if there are any of that denomination **/ enum denom_ind { FIVE_CENTS_IND, TEN_CENTS_IND, TWE...
C
/* alloc.c -- memory allocation code. * * Memory is initialized at the beginning of execution and at the end of * each resource (spec, body, or combined). No attempt is made to reclaim * space at any other time. */ #include "compiler.h" typedef struct hunk { /* layout of a hunk of allocated memory */ ...
C
#include <stdio.h> #include <poll.h> int main(void) { struct pollfd pfds[1]; // More if you want to monitor more pfds[0].fd = 0; // Standard input pfds[0].events = POLLIN; // Tell me when ready to read // If you needed to monitor other things, as well: //pfds[1].fd = some_socket; // Some socket descrip...