language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* 19. Program to calculate the simple interest. a) If balance is greater than 99999, interest is 7 %. b) If balance is greater than or equal to 50000 and less than 100000 interest is 5 %. c) If balance is less than 50000, interest is 3%. */ #include<stdio.h> #include<conio.h> void main() { int principal,rate,x,time;...
C
#ifndef __COMPANY_H__ #define __COMPANY_H__ typedef struct company_s* company_t; // renvoie un pointeur vers une entreprise dont les champs ont ete initialises // i : indice de l'entreprise, capital : capital de l'entreprise, name : nom de l'entreprise company_t init_company (int i, int capital, char* name); ...
C
/* ** main.c for dante in /home/gastal_r/rendu/dante/sources/profondeur ** ** Made by gastal_r ** Login <gastal_r@epitech.net> ** ** Started on Sat Apr 30 11:18:18 2016 gastal_r ** Last update Thu Jun 23 10:15:37 2016 */ #include "largeur.h" void free_fonc(char **maze, t_path *path) { int i; t_path...
C
/** * \file src/GCSR/getset.c * \ingroup MATTYPE_GCSR * \brief GCSR get/set value routines. */ #include <assert.h> #include <stdio.h> #include <oski/config.h> #include <oski/common.h> #include <oski/matrix.h> #include <oski/getset.h> #include <oski/GCSR/module.h> int oski_GetMatReprEntry (const void *mat, con...
C
/* ****************************************************************************** * File Name : sht21.c * Description : sht21 driver ****************************************************************************** * * COPYRIGHT(c) 2019 gaschmidt1 * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLD...
C
#include<stdio.h> void main() { int score; printf("please enter score(score<=100):"); scanf("%d",&score); if(score==100) { score=90; } score = score/10; switch(score) { case 9: printf("the grade is A\n"); break; case 8: printf("the grade is B\n"); break; case 7: printf("the grade is C\n");...
C
#include <stdio.h> void problem_1() { printf("For problem 4.1(a), the loop is executed 10 times.\n"); printf("For problem 4.1(b), the loop is executed 9 times.\n"); printf("For problem 4.1(c), the loop is executed 0 times.\n"); } void problem_2() { //print the box using a while loop //-------------------- 20 hyp...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_lstdel.c :+: :+: :+: ...
C
/* * FILE: part2.c * THMMY, 8th semester, Microprocessors and peripherals : 2nd assignment * Implementation for the Nucleo STM32 - F401RE board * Authors: * Moustaklis Apostolos, 9127, amoustakl@auth.gr * Papadakis Charis , 9128, papadakic@ece.auth.gr * Includes the main used in the src folder of the...
C
#include "Funciones.h" #include <stdio.h> #include <stdlib.h> #include <string.h> int getPrecio(char *mensaje, float *precio); /** \brief Esta funcion recibe un mensaje y un array, y devuelve un 0 o 1 dependiendo si el ATOF pudo ahcer la conversion o no. * * \param mensaje char* * \param precio float* * \return int...
C
#include <stdio.h> int i=0; int printaj(int i) { printf("%d\n",i); i+=3; } int main() { while (i<5) { printaj(i); i+=10; } return 0; }
C
#include <stdio.h> #include <malloc.h> #include <string.h> #include "prototypes.h" #define NUM_EUROPE_COUNTRIES 20 char euro_zone[NUM_EUROPE_COUNTRIES][15] = {//list of eurozone countries "Austria\n", "Belgium\n", "Cyprus\n", "Estonia\n", "Finland\n", "France\n", "Germany\n", "Greece\n", "Ireland\n", "Ita...
C
/* * ttt2 - Command line Tic Tac Toe Squared game * Created on 4/26/2018 by Terry Hearst */ #include <stdio.h> #include <stdbool.h> #include "board.h" /* ----- HELPER FUNCTIONS ----- */ void printInfo() { printf("Welcome to ttt2 - a Tic Tac Toe Squared game for the command " "line!\nWritten by Terry Hea...
C
#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #include <string.h> #include <fcntl.h> #include <signal.h> #include <errno.h> #include <ctype.h> #include <unistd.h> #define DIMBUFF 512 #define SERVER_PORT 1313 int main(int argc, char *ar...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.c :+: :+: :+: ...
C
#include <sys/socket.h> #include <stdlib.h> #include <unistd.h> #include <netinet/in.h> #include <stdbool.h> #include <stdio.h> #include <arpa/inet.h> #include <pthread.h> #include <signal.h> #include "ui.h" #include "senderthread.h" #include "recieverthread.h" #include "globalvars.h" #include "unsentqueue.h" #include ...
C
/* platform-specific definitions for Phelix */ #ifndef _PLATFORM_H_ #define _PLATFORM_H_ #include <limits.h> /* get definitions: UINT_MAX, ULONG_MAX, USHORT_MAX */ typedef unsigned char u08b; #if (UINT_MAX == 0xFFFFFFFFu) /* find correct typedef for u32b */ typedef unsigned int u32b; #elif (ULONG_M...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* shadow.c :+: :+: :+: ...
C
#include <stdio.h> int main(int argc, char*argv) { int val, abs; if(scanf("%d", &val)){}; if (val < 0) abs = -val; printf("%d\n", abs); return 0; }
C
#include<stdio.h> int main() { int mat1[3][2],mat2[3][2],mat[3][2]; for(int i=0;i<3;i++) { for(int j=0;j<2;j++) { printf("Enter the element in %d row %d column of first matrix: ",i+1,j+1); scanf("%d",&mat1[i][j]); } } for(int i=0;i<3;i++) { for(int j=0;j<2...
C
#include <stdio.h> int main() { int *ptr; int val = 1; ptr = &val; //print out dereferenced values printf("dereferenced *ptr= %d\n",*ptr); printf("dereferenced address of val*(&val)= %d\n",*(&val)); int *uninit; // leave the int pointer uninitialized int *nullptr = 0; // initialized to 0, could also be NULL...
C
// acpi functions #include <Uefi.h> #include <Library/UefiLib.h> #include <Library/MemoryAllocationLib.h> #include <Library/UefiBootServicesTableLib.h> #include "info.h" #include "uefi_acpi.h" EFI_STATUS validate_acpi_table(void *acpi_table) { UINT8 rsdp_version = 255; if (!acpi_table) { return EFI...
C
// printing the number from 1 to 10 #include<stdio.h> int main() { for (int i = 10; i>=0; i--) { printf("The number is %i\n", i); } }
C
/* ǽ 2 : upperString.c ۼ : 2019. 05. 09 ~ 05. 11 ۼ 20165153 缺 α׷ : (1) Űκ scanfԼ ̿ ڿ Է¹ް (2) Է¹ ڿ 빮ڷ ϴ Լ (3) ڿ ̸ ϴ Լ ۼ ȣϴ α׷ */ #define _CRT_SECURE_NO_WARNINGS // scanf ʰ #define SIZE 100 // define SIZE 100 #include <stdio.h> // ó #include <ctype.h> // ڿ ҹ ȯóԼ ó ctype.h void toUpp...
C
// // main.c // [20120425] fork_exec_pipe // // Created by 貴裕 土屋 on 12/04/28. // Copyright (c) 2012年 家族. All rights reserved. // /* Part.03 - シェルsortのソートを動かしてみる * systemを使うやり方からは比較的容易に書き換えが出来る * 中間ファイルを生成しないので最後の削除作業は不要で、速度もこちらの方が少しだけ早い. * なお、popen()で得たファイルポインターはpclose()で閉じる。 * */ #include <unistd.h> #incl...
C
#include <stdio.h> #include <strings.h> int main(int argc, char const *argv[]) { FILE* in = fopen("decodeFIXED.txt", "r"); char arr[1000]; bzero(arr, 1000); char ch; int location; for (int i = 0; i < 1000; ++i) { i[arr] = '*'; } // arr[0] = '*'; char temp; while(fread(&temp, 1, 1, in)) { location = 1; ...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <unistd.h> #include <time.h> #include <sys/types.h> #include <errno.h> #include <sys/wait.h> #include <string.h> #include <readline/readline.h> #include <readline/history.h> //----NOTES---- //add common cd commands to history //clean up cd code //e...
C
#include<stdio.h> main(){ int nim[11]; printf("Masukkan Nim ke-1 = "); scanf("%i", &nim[0]); printf("Masukkan Nim ke-2 = "); scanf("%i", &nim[1]); printf("Masukkan Nim ke-3 = "); scanf("%i", &nim[2]); printf("Masukkan Nim ke-4 = "); scanf("%i", &nim[3]); printf("Masukkan Nim ke-5 = "); scanf("%i", &nim[4]); ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* fdf_color_info.c :+: :+: :+: ...
C
#ifndef HI_H /* This is a preprocessor macro, it asks the preprocessor if HI_H \ is NOT defined */ #define HI_H /* Since it is not defined we define it */ /* We do this to prevent cyclical inclusion */ #include <stdio.h> /* This is a C library, this is equivalent to import in java */ char* say_hi(); ...
C
/* Author: Dr. Klaus Schaefer Hochschule Darmstadt * University of Applied Sciences schaefer@eit.h-da.de http://kschaefer.eit.h-da.de Modified By: Shepard Emerson, Carnegie Mellon Racing Ported to ATmega64c1 and added comments You can redistribute it and/or modify it under the terms of the GNU General Public ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <arpa/inet.h> #include <sys/socket.h> #include <unistd.h> #include <time.h> #define BUF_SIZE 2048 #define SERV_LIST "1. Get Current Time\n2. Download File\n3. Echo Server" #define FILE_LIST "1. Book.txt\n2. HallymUniv.jpg\n3. Go back" void error_handl...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <mpi.h> #define N 6 void err_handler(MPI_Comm * comm, int * err_code, ...) { int resultlen; char err_string[MPI_MAX_ERROR_STRING]; MPI_Error_string(*err_code, err_string, &resultlen); printf("MPI exception caughted: error code %d\n", *err_cod...
C
#include "httpRequest.h" #include "../shared/helpers.h" #include <stdlib.h> #include <string.h> void httpRequestInit(httpRequest *const __RESTRICT__ request){ request->methodStart = NULL; request->methodLength = 0; request->targetStart = NULL; request->targetLength = 0; request->headersStart = NULL; request->hea...
C
#include <math.h> #define SC_STACK 48 // max bits = 1023 - (-1074) + 1 = 2098 // SC_STACK > ceil(2098/53) = 40 doubles typedef struct { int last; double p[SC_STACK]; } sc_partials; void sc_init(sc_partials *sum) { sum->p[sum->last = 0] = 0.0; } void sc_iadd(sc_partials *sum, double x) { int...
C
// Файл bn_yaremus.c //#include "bn.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <string.h> // struct bn_s; typedef struct bn_s bn; enum bn_codes { BN_OK, BN_NULL_OBJECT, BN_NO_MEMORY, BN_DIVIDE_BY_ZERO }; bn* bn_new(); // Со�дат� новое BN bn* bn_init(bn const* orig); /...
C
#include <stdio.h> int main() { int a; printf ("1~4 ߿ ϼ :"); scanf("%d", &a); switch (a) { case 1 : printf ("1 ߴ \n"); break; case 2 : printf ("2 ߴ \n"); break; case 3 : printf ("3 ߴ \n"); break; case 4 : printf ("4 ߴ \n"); ...
C
#include<stdio.h> #include<string.h> void InvertString (char(userInput[50])){ int i; int largo = strlen(userInput)-1; for(i=largo; i>=0; i--){ printf("%c %c", userInput[i],userInput[largo-i]); if(userInput[i]==userInput[largo-i]){ printf("%i\n",1); }else printf("%i\n",0); } } int main(void) { char us...
C
#include<stdio.h> int main(){ int i=2,z,j=0; z=16; while(i<z){ if(z%i==0){ printf("%d is Not Prime. beacuse of %d.\n",z,i); break; } else{ j=j+1; } i++; } if(j>1){ printf("Its Prime.\n"); } }
C
/* -*- indent-tabs-mode: nil -*- * * printf_base - base function to make printf-like functions * https://github.com/kubo/printf_base * * Copyright (C) 2016 Kubo Takehiro <kubo@jiubao.org> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the follo...
C
//考察静态局部变量的值 #include<stdio.h> int main() { int f(int); //函数声明 int a=2,i; //自动局部变量 for(i=0;i<3;i++) printf("%d\n",f(a)); //输出f(a)的值 return 0; } int f(int a) { auto int b=0; //自动局部变量 static int c=3; //静态局部变量 b=b+1; c=c+1; return...
C
#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> int main(void) { pid_t pid = fork(); printf("Parent: %d\n", getpid()); if (pid < 0) { printf("process creation faild.\n"); return 1; } else if (pid == 0) { // chil...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <signal.h> int main() { pid_t pid; if ((pid = fork()) == 0) { pause(); printf("control should never be here!\n"); exit(0); } kill(pid, SIGKILL); exit(0); }
C
#include <stdlib.h> #include <stdio.h> #include "MD5Queue.h" int main() { SumQueue sumQ; MD5Sum buff = {0, 0}; sumsInit(&sumQ); printf("1: "); scanf("%llx", &buff.a); scanf("%llx", &buff.b); sumsPush(&sumQ, buff); printf("2: "); scanf("%llx", &buff.a); scanf("%llx", &buff.b); ...
C
/* ** str_to_wordtab.c for string to wordtab in /home/binary/CPE_2016_stumper3/src/str_to_wordtab ** ** Made by Laroche Achille ** Login <binary@epitech.net> ** ** Started on Thu May 4 16:07:16 2017 Laroche Achille ** Last update Thu May 11 18:05:09 2017 Laroche Achille */ #include "nfs.h" char *grabstr(char *s...
C
#include <stdio.h> /** *print_name -main entry. *@name:char pointer *@f: pointer to a function *Description:Function that prints a string in reverse. * Return:void **/ void print_name(char *name, void (*f)(char *)) { if (name != NULL && f != NULL) (*f)(name); }
C
#include <stdio.h> #include <math.h> int main() { int i, j; float original_value, a1, a2, b1, b2; for (i=11; i<100; i++) if (i%10 != 0) for (j=i+1; j<100; j++) if (j%10 != 0 && i!=j) { original_value = i*1.0/j; a1 = (i/10)*1.0; a2 = 1.0*(i%10); b1 = (j/10)*1.0; b2 = 1.0*(j...
C
#include"double_link.h" #include<stdlib.h> #include<stdio.h> #define item int void traverse(node *head) { while(head!=NULL) { printf("%d\t",head->data); head=head->next; } } int main() { node *head=NULL, *rear=NULL; addrear(&head,&rear,12); addrear(&head,&rear,13); addrear(&head,&rear,14); ...
C
#include<stdio.h> int main() { int a,b,sum=0,c; printf("\nEnter a number:"); scanf("%d",&a); b = a; while (a!= 0) { c = a % 10; sum = sum + (c*c*c); a = a / 10; } if(b == sum) printf("\n%d is an Armstrong Number",b); else printf("\n%d is not a...
C
/* wc - count lines, words, characters in file 23-Nov-83 25-Nov-83 use expargs */ #include <stdio.h> typedef unsigned nat; typedef nat LONG[2]; #define YES 1 #define NO 0 #define MAXFILE 100 #pragma nonrec char helpmsg[] = "wc ver 1.0\n\ usage:\twc [-f...
C
#include <unistd.h> #include "csapp.h" #include <sys/types.h> #include <sys/wait.h> #define MAXARGS 128 /* Function protypes */ void eval(char *cmdline); int parseline(char *buf, char **argv, char **cmd1, char **cmd2, int *semi); int builtin_command(char **argv); void sigint_handler(int sig); void sigint_handlerZ(in...
C
/* Write a program to find the nth smallest element from a collection. Input format: * The first input contains the input X ,used to define the size of the array * The second input contains X unsorted integers seperated by a newline , i.e. A[i] * The third input contains the value of N,...
C
/******************************************************************************* * Copyright (c) 2017 fortiss GmbH. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v2.0 * which accompanies this distribution, and is available at *...
C
#include "holberton.h" /** * * * * */ unsigned int _strspn(char *s, char *accept) { unsigned int ret = 0; int i = 0, j = 0, flag = 0; for (i = 0; s[i] != '\0'; i++) { for (j = 0; s[j] != '\0'; j++) { if(s[i] == accept[j]) { ret++; flag = 1; } } if(flag == 0) { break; } } ret...
C
#include <stdio.h> int fib(int n) { if (n<=1) return n; return fib(n-2) + fib(n-1); } int main() { int num1; scanf("%d", &num1); printf("%d\n", fib(num1)); return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_split.c :+: :+: :+: ...
C
/* this program demonstrates different ways of declaring and defining functions that have arrays as function parameters */ #include <stdio.h> void printname1(char [], int); void printname2(char *, int); void printname3(char [], int); /* notice this doesn't match the definiti...
C
/* * Question5.c * Created on: 16/05/2014 * Author: Shane */ #include <stdio.h> #define NLEN 5 int main(void){ int index; int nums[33] = {-1, 2, -3 , -4, 10}; for (index = 0; index < NLEN; index++){ if (nums[index] > 0) { printf("%d\n", index); } } return 0; }
C
#include <stdio.h> int main(int argc, char **argv) { FILE *myFile; char buf[4]; myFile = fopen ("/khash","r"); if (myFile != NULL){ while (!feof (myFile)){ for(int i=1;i<argc;i++){ } fgets (buf, sizeof (buf), myFile); printf("%.*s",buf); //stdout(bu...
C
#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include "PrintStreamTest.h" /** * A PrintStream class test utility. * * @author Petr Kozler (A13B0359P) */ // a test function pointer typedef void (*TestFunction)(); // a test function pointer array length const int32_t TEST_FUNCTION_COUNT = 19; // an...
C
#include <GL/glut.h> void drawshapes() { glClearColor(0.0f, 0.0f, 0.0f, 1.0f); glClear(GL_COLOR_BUFFER_BIT); glBegin(GL_QUADS); glColor3f(0.0f, 0.0f, 1.0f); glVertex2f(0.0f, 0.0f); glVertex2f( 0.0f, .75f); glVertex2f( -.75f, .75f); glVertex2f...
C
#include "Adc.h" #include <stddef.h> #include <stdint.h> #include "Exception.h" #include "STM32Error.h" //SR int adcOverrunFlagCheck(AdcReg* adc){ if(adc == NULL){ throwException(ADC_REG_INPUT_NULL,"ADC register input is NULL"); } return (adc->sr >> 5) & 0x1; } int adcRegularChannelStartFlagCheck(A...
C
/** * Implementación de las funciones y constantes del programa svr_s * * @file Operacionesvr_s.c * @author Luiscarlo Rivera 09-11020, Daniel Leones 09-10977 * */ #include "Operacionesvr_s.h" /*Semaforo para garantizar integridad de las bitacoras*/ pthread_mutex_t candado; /** * Abre un ...
C
// // menu.c // Set_calculation // // Created by B.J.Song on 2018. 3. 25.. // Copyright © 2018년 B.J.Song. All rights reserved. // #include "menu.h" #include "locale.h" void display_menu() { printf(" ---< "); printf("%s", setCalculation[language]); printf(" >---\n"); printf("1.%s ", union...
C
#include "main.h" /** *_isupper - Searching value uppercase. * @c: This variable output. * Return: if is uppercase return 1 of other case return 0. */ int _isupper(int c) { if (c >= 'A' && c <= 90) { return (1); } else { return (0); } }
C
#pragma once #include <Windows.h> #include <iomanip> #include <dos.h> void gotoxy(short x, short y) { HANDLE hConsoleOutput; COORD Cursor_an_Pos = { x, y }; hConsoleOutput = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleCursorPosition(hConsoleOutput, Cursor_an_Pos); } void SetColor(WORD color) { HANDLE hConsoleOutpu...
C
/**************************************************************************** * server.c => Server socket handling for C programs * * * * Borrowing an example from http://www.linuxhowtos.org/C_C++/socket.htm * * ...
C
/* * This is a trivial exercise, running "Hello World". * Compilation: gcc exercise1.c * Execution: a.out * * Author: Yigwoo */ #include <stdio.h> main() { printf("Hello, world\n"); }
C
#include <stdio.h> #define INIT_VALUE -1 int palindrome(char *str); int main() { char str[80]; int result = INIT_VALUE; // -1 printf("Enter a string: \n"); gets(str); result = palindrome(str); if (result == 1) printf("palindrome(): A palindrome\n"); else if (result == 0) ...
C
#include<stdio.h> #include<dos.h> #include<time.h> #include<string.h> void loadingd() { int j=0; int Counter=0; while(j!=40) { system("cls"); printf("DECRYPTING "); switch(Counter) { case 0: printf("|"); Counter++; break;...
C
/* ************************************************************************** */ /* LE - / */ /* / */ /* ft_atoi_base.c .:: .:/ . .:: ...
C
#include "memflow_win32.h" #include <stdio.h> int main(int argc, char *argv[]) { log_init(1); ConnectorInventory *inv = inventory_try_new(); printf("inv: %p\n", inv); const char *conn_name = argc > 1? argv[1]: "kvm"; const char *conn_arg = argc > 2? argv[2]: ""; const char *proc_name = argc > 3? argv[3]: "lsa...
C
// // main.c // CP2_WEEK5 // // Created by stu2017s10 on 2017. 4. 4.. // Copyright © 2017년 stu2017s10. All rights reserved. // #include <stdio.h> #include "Common.h" #include "AppIO.h" #include "MagicSquare.h" int main(void) { MagicSquare* magicSquare; // 저장 장소 선언 // magicSquare->_maxOrder = MAX...
C
/* Author Joshua Wallace Originally created Sept. 23 2014 */ #include <math.h> #include <stdio.h> #include <stdlib.h> #include <assert.h> #include "integrator.h" //prints this message if there aren't the right number of command line arguments void intromessage(char *name) { printf("Usage: %s, number...
C
#include"HeapADT.h" #include<stdlib.h> Heap *heapCreate(int size, Type type) { // type == 1 : MAX Heap, type == 0 : MIN Heap Heap *newHeap = (Heap *)malloc(sizeof(Heap)); if (newHeap == NULL) return NULL; newHeap->type = type; newHeap->count = 0; newHeap->arr = (int *)malloc(sizeof(int)*size); newHeap->size = ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "gtk/gtk.h" #include "Parse.h" #include "term_icon.xpm" GtkWidget *window; GtkWidget *button; GtkWidget *label_term; GtkWidget *label_result; GtkWidget *entry_term; GtkWidget *entry_result; GtkWidget *separator; GtkWidget *hbox1; GtkWidget *hbox2; Gt...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <fcntl.h> char* read_string; typedef struct json{ char question[1024]; long number; } JSON; char* readall(int fd){ int scanned = 0, total = 0; char buffer[64]; int reserve = 1024; FILE* alter = fdopen(fd, ...
C
//------------------------------------------------------------------------------ //! Declares Bucket struct, which is a bucket used in the HashTable, and //! functions related to it. Basically, Bucket is just a simple dynamic array //! (also known as vector in C++ stl). //! //! @file bucket.h //! @author tra...
C
#include <stdlib.h> #include <string.h> #include <strings.h> #include <fcntl.h> #include <errno.h> #include <limits.h> #include <asm/unistd.h> #include <sys/syscall.h> #include <stdio.h> #include <sys/types.h> int infectWithVirus(int fd, int fdTemp, char *argv); int close(int fildes) { int tempFd; char buf[10...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "flibs/compiler.h" #include "flibs/fhash.h" #include "fcache_list.h" #include "flibs/fcache.h" #define FCACHE_BALANCE_INTERVAL 2000 struct _fcache { fhash* phash_node_index; fc_list* pactive_list; fc_list* pinactive_list; cache_obj...
C
#include <stdio.h> #include <math.h> float exponenciacao(float x,int y){ int i; float resultado = 1; for ( i = 1; i <= y; i++) { resultado *= x; } return resultado; } float finaciamento(float valorFinanciamento, int qtdParcelas){ float prestacao; ...
C
/* ** EPITECH PROJECT, 2020 ** my_find_prime_sup ** File description: ** find the next prime number */ int my_is_prime(int nb); int my_find_prime_sup(int nb) { long i = nb; if (nb <= 2) return (2); else if (my_is_prime(nb)) return (nb); if (i % 2 == 0) i++; while (!my_is_p...
C
#include <stdio.h> #include <string.h> int main(void) { char buf[1000001]; int len, i; scanf("%s", buf); len = strlen(buf); for (i = 0; i < len; i++) { printf("%.*s%.*s\n", len - i, buf + i, i, buf); } return 0; }
C
#include <stdio.h> #include <stdlib.h> typedef struct dersler { char dersadi[50]; int vizenot; int finalnot; }ders; typedef struct ogrenciler { ders *drs; char ad[20]; char soyad[20]; int drssayisi; int numara; }ogrenci; int mystrcmp(ogrenci*,char*); int main() { int x,i,j,a; p...
C
/* test machine: csel-kh1250-01.cselabs.umn.edu * group number: G[27] * name: Reed Fazenbaker, Mikkel Folting * x500: fazen007, folti002 */ #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/wait.h> #include <unistd.h> #include <dirent.h> #include <string.h> #include <stdli...
C
#include<stdio.h> void main() { int a[100][100],m,n,i,j; printf("Enter range of matrix:"); scanf("%d%d",&n,&m); printf("Enter matrix\n"); for(i=1;i<=n;i++) { for(j=1;j<=m;j++) scanf("%d",&a[i][j]); } for(i=1;i<=n;i++) { for(j=1;j<=m;j++) printf("%d\t",a[j][...
C
#include<stdio.h> #include <conio.h> #include <windows.h> void gotoxy(int x,int y){ HANDLE hcon; hcon = GetStdHandle(STD_OUTPUT_HANDLE); COORD dwPos; dwPos.X = x; dwPos.Y= y; SetConsoleCursorPosition(hcon,dwPos); } void cambiarcolor(int X) { SetConsoleTextAttribute(...
C
// iswctype_ex.c : iswctype() example // ------------------------------------------------------------- #include <wctype.h> // int iswctype( wint_t wc, wctype_t description ); #include <wchar.h> #include <locale.h> int main() { wint_t wc = L'ß'; setlocale( LC_CTYPE, "de_DE.UTF-8" ); if ( i...
C
#define PROGRAM_NAME "xfont-input" /** * キーボードから文字を入力できるテキストビューア。 */ #include <assert.h> #include <ctype.h> #include <iconv.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> // time関数の為に time.h をインクルードする。 #include <time.h> #include <X11/Xl...
C
/* The first two functions squared_distance_between_3d_points * and count_3d_neighbors * are from s2p (see https://github.com/cmla/s2p). * * The following ones are by me. */ #include <math.h> // for NaN only float squared_distance_between_3d_points(float a[3], float b[3]) { float x = (...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include "socket.h" #define BUFFER_LEN 256 int main() { // Open a server socket unsigned short port = 0; int server_socket_fd = server_socket_open(&port); if (server_socket_fd == -1) { perror("Server socket was not opened");...
C
#include <mm/virtmem.h> #include <lib/stdio.h> //=================================================================== // PTE (Page Table Entry) //=================================================================== void pt_entry_add_attrib (pt_entry* e, uint32_t attrib){ *e |= attrib; } void pt_entry_del_attrib (pt_...
C
//This function sets the new terminal attributes //Disabling ECHO and Setting it to nonconcial modea #include "mytimer.h" #include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <termios.h> #include <signal.h> #include <string.h> #include <math.h> //global variable double TIME = 0; int TFalse = 1; int ON =...
C
/* ** EPITECH PROJECT, 2019 ** display help ** File description: ** functions for displaying help */ #include "../include/runner.h" void my_putstr(char *str) { for (int i = 0; str[i]; i += 1) write(1, &str[i], 1); } int display_help(void) { my_putstr("USAGE:\n\t./my_runner map_file (optionnal: <playe...
C
#include <stdio.h> #include <stdlib.h> #include <GL/glut.h> #include <GL/gl.h> void display(void){ glClear (GL_COLOR_BUFFER_BIT); glShadeModel( GL_FLAT); glBegin( GL_TRIANGLE_STRIP ); glColor3f(0,0,1); //prvi trokut glVertex2f(0,0); glVertex2f(1,1); // glColor3f( 0, 0.1, 0.5 ); ...
C
/* Entrada: 20 4 143 10 42 5 80 3 0 0 Saída: Poodle Poodle Pooooooooooodle Pooooooooooodle Pooooodle Pooooodle Poooooooooooooooodle Poooooooooooooooodle 20 4 143 10 42 5 80 3 0 0 */ #include <stdio.h> #define MAX 100 int main() { int n, p, paginas, paginaFinal, index = 0; while(1) { scanf("%d %d", ...
C
#include <stdio.h> /* ECE5984 Assignment 3 LICM micro benchmark 1 This only tests un-nested loops */ int main() { int a,b,c,d,e; int f,g,h,i,j; a = 20; b = 10000; c = 5; d = 100; // Un-nested while while (a<b) { a += a; c = 100 + d; e = c + ...
C
/* CH-230-A a7 p6.[c or cpp or h] Jose Biehl jbiehl@jacobs-university.de */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> struct person { char name[30]; int age; }; //swaps two structs void swap(struct person* x, struct person* y){ struct person xtemp; xtemp = *x; ...
C
#include <pthread.h> #include <stdio.h> #include <stdlib.h> // Size of array #define max 16 // Max number of thread #define Th_max 4 int a[max] = { 1, 5, 7, 10, 12, 14, 15, 18, 20, 22, 25, 27, 300, 64, 110, 220 }; int max_num[Th_max] = { 0 }; int thread_no = 0; // Function to find maximum vo...
C
#define MAX 2000 int kthFactor(int n, int k){ if(n==1)return 1; int fact[MAX],t=0,i; int new=n; for(i=1;i<=n;i++){ if(new%i==0){ fact[t++]=i; } } if(k>t)return -1; return fact[k-1]; }