language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* $Id: enumord.c 1024 2006-04-22 20:49:41Z loic $ */ /* See comments in enumord.h. Michael Maurer, Jun 2002 * This package is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 dated Jun...
C
/* ** put_in_buf.c for 42sh in /home/maurin_t/ ** ** Made by timothee maurin ** Login <maurin_t@epitech.net> ** ** Started on Tue May 17 16:17:00 2011 timothee maurin ** Last update Sun May 22 02:35:19 2011 timothee maurin */ #include <stdlib.h> #include <string.h> #include "shell.h" #include "prototype.h" void ...
C
// // Created by sanguk on 12/06/2017. // #include <stdio.h> #include <stdlib.h> #include <string.h> #include "arrayqueue.h" ArrayQueue *createArrayQueue(int maxElementCount) { ArrayQueue *pResult = (ArrayQueue *) malloc(sizeof(ArrayQueue)); if (NULL == pResult) return NULL; memset(pResult, 0, sizeof(Arr...
C
#define _GNU_SOURCE #include <string.h> #include <stdlib.h> #include <unistd.h> #include <stdio.h> #include <fcntl.h> #include <sys/ioctl.h> #include <sys/mman.h> #include <sched.h> #include "exploit.h" // -------------------------------------------------------------------------- // These helper functions provide conv...
C
/* ************************************************************************** */ /* */ /* :::::::: */ /* fltvect.c :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> #include "mergesort.h" int int_comparator(const void *a, const void *b) { return *(int*)a - *(int*)b; } int char_comparator(const void *a, const void *b) { return *(char*)a - *(char*)b; } int str_comparator(const void *a, const v...
C
#define _GNU_SOURCE /* Для dprintf() */ #include <stdio.h> #include <string.h> #include <errno.h> /* Для errno */ #include <unistd.h> /* Для mincore() */ #include <sys/mman.h> /* Для mlockall(), munlockall(), mmap() и munmap() */ /* Функция mem_lock_unlock_all() выполняет следующие действия: * * 1. Создает пе...
C
#include <stdio.h> #include <stdbool.h> int **REC; int AVGAREA=0; int AVGCount=0; int findConnectedComponent(unsigned char *thresholdData, int x, int y, int w, int h, int *area,int *cx, int *cy) { if (!(*(thresholdData + (x * w) + y))) return 0; *(thresholdData + (x * w) + y) = 0; *area=*area+1; *cx +=x; ...
C
/* * @Author: zxt * @Date: 2018-05-21 16:41:01 * @Last Modified by: zxt * @Last Modified time: 2018-05-21 17:57:38 */ #include "general.h" // *************************************************************** // typedef typedef struct { uint8_t enable; uint8_t state; uint8_t times; uint16_t periodT1Set; uint...
C
/* Claro Graphics - an abstraction layer for native UI libraries * * $Id$ * * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/MP...
C
#include <stdio.h> int main() { long double f1 = 34.567839023L; float f2 = 12.345F; long double f3 = 8923.1234857L; float f4 = 3456.091F; printf("34.567839023 is %0.9lf\n", f1); printf(" 12.345 is %.3f\n", f2); printf(" 8923.1234857 is %.7lf\n", f3); printf("3456.091 is %0.1f\n", f4); }
C
#include <stdio.h> int main(){ int testcases, max, rank[10], i, cases=1; char url[10][100]; scanf("%d",&testcases); while(1){ if(testcases == 0) break; max = 0; for(i=0;i<10;i++){ scanf("%s %d",&url[i], &rank[i]); if(rank[i] > max) max = rank[i]; } printf("Case #%d:\n", cases); for(i...
C
/*******************************************************************/ /* CT60A2500 C-ohjelmoinnin perusteet * Otsikkotiedot: L05_T4 * Tekijä: Tero Lompolo * Opiskelijanumero: 0615760 * Päivämäärä: 2.10.2020 * Yhteistyö ja lähteet, nimi ja yhteistyön muoto: */ /*********************************************...
C
/* ** EPITECH PROJECT, 2019 ** reset_cooldown.c ** File description: ** reset all my cooldowns */ #include "my.h" void reset_cooldown(fight_t *f) { f->spell.cooldown[0] = 0; f->spell.cooldown[1] = 0; f->spell.cooldown[2] = 0; f->spell.cooldown[3] = 0; f->spell.cooldown[4] = 0; } void decrease_whe...
C
// // main.c // p1 // // Created by Terry Shao on 3/24/14. // Copyright (c) 2014 Terry Shao. All rights reserved. // #include <stdio.h> #include <stdlib.h> #include <time.h> #include "SkipList.h" #include "HBTree.h" #define SL //#define HBT int count = 10000; Skiplist * sl; int moves = 0; int avg = 0; int main(...
C
#include <stdio.h> #include <sys/stat.h> unsigned long get_file_size (const char *path) { unsigned long filesize = -1; struct stat statbuff; if (stat (path, &statbuff) < 0) { return filesize; } else { filesize = statbuff.st_size; } return filesize; } int main() { //unsigned long size = get_file_size("a....
C
#include <stdio.h> #include <stdlib.h> /** * echo测试 * 程序变量需要在launch.json中的args[]添加命令行参数 * */ int main(int argc,char *args[]) { while(--argc > 0) { printf("%s%c",*++args,(argc>1)?' ':'\n'); } system("pause"); return 0; }
C
#include <stdlib.h> #include <unistd.h> typedef int fd_t; struct buf_t { size_t capacity; size_t size; char* buffer; }; struct buf_t *buf_new(size_t capacity); void buf_free(struct buf_t *); size_t buf_capacity(struct buf_t *); size_t buf_size(struct buf_t *); ssize_t buf_fill(fd_t fd, struct buf_t * bu...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/socket.h> #include <netinet/in.h> #define MAXLINE 200 /* * * STUN(RFC5389) client demo by Chris <nodexy@gmail> * * Test by turnserver-0.6 from http://turnserver.sourceforge.net * * @ 2012-2-27 AT Shenzhen, China * @ 2012-2-29...
C
#include <stdio.h> int abs(int a){ if(a > 0) return a; else return -a; } int main(void) { int a1[20], i, dif, index1, index2; for(i = 0; i < 20; i++) scanf("%d", &a1[i]); dif = abs(a1[0]-a1[1]); index1 = 0; index2 = 1; for(i = 1; i < 19; i++){ if(abs(a1[i]-a1[i+1]) > dif){ dif = abs(a1[i...
C
/** * @file main.c * @brief Breve Descrição * * Descrição mais detalhada do ficheiro que até poderiam incluir links para imagens etc. * * @author luis, sarmento@ua.pt * * @internal * Created 27-set-2017 * Company University of Aveiro * Copyright Copyright (c) 2017, luis * *...
C
#include <stdio.h> #include <stdlib.h> // access: rand, srand #include <string.h> // access: strcmp #include <unistd.h> // access: getpid typedef struct _Er1 { short int code; } Er1; typedef struct _Er2 { int co...
C
#ifndef DEFINE_H #define DEFINE_H #include <stdio.h> #include <stdlib.h> #include <ctype.h> #define FLAG_NULL 0x00 #define FLAG_OPERAND_1 0x01 #define FLAG_OPERAND_2 0x02 #define FLAG_OPERANDS 0x03 #define FLAG_MENU_3 0x04 #define FLAG_MENU_4 0x08 #define FLAG_MENU_5 0x10 #define F...
C
#include "delay.h" void SysTick_Configuration(void) { if(SysTick_Config(SystemCoreClock/1000000)) { while(1); } } void Delay_us(volatile uint32_t nTime) { TimingDelay = nTime; while(TimingDelay != 0); } void Delay_ms(volatile uint32_t mTime) { TimingDelay = mTime * 1000; while(TimingDelay != ...
C
/* Author: Karsten * Partner(s) Name: * Lab Section: * Assignment: Lab # Exercise # * Exercise Description: [optional - include for your own benefit] * * I acknowledge all content contained herein, excluding template or example * code, is my own original work. */ #include <avr/io.h> #ifdef _SIMULATE_ #include...
C
#include<stdio.h> int main(void) { int x; double y; scanf("%d %lf",&x,&y); if(x>0 && x<=2000 && y<=2000 && y>=0 && x%5 == 0 && (y-(double)x-0.5)>=0.0) printf("%.2lf\n",y-(double)x-0.5); else printf("%.2lf\n",y); return 0; }
C
/* -------------------------------------------------------------------------- * Name: lookup.c * Purpose: Associative array implemented as a linked list * ----------------------------------------------------------------------- */ #include <string.h> #include "datastruct/linkedlist.h" #include "impl.h" const v...
C
#include "Resources.h" #include "stepLinkedList.h" /*-------------------------------<< ģ >>-----------------------------------*/ /* * - :CRJ- * - :201700721.001.00.1 * - System->APP->Drive->CPUע˳ * - 4ͺʼãƣ״ִ̬ * - * - : **/ /*___________________________________END______________________________________*/ Node *...
C
#include <GL/glut.h> void display(void) { /* clear all pixels */ glClear (GL_COLOR_BUFFER_BIT); glMatrixMode (GL_MODELVIEW); glLoadIdentity (); glColor3f (0.0, 0.0, 1.0); glBegin(GL_POLYGON); glVertex3i (0,0,0); //netransformirana kucica glVertex3i (30,0,0); glVertex3i (30,30,0);...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> typedef struct num { char original[51],pad[51]; struct num *link; }num; int main() { int t,n,k,i,j,len,dig; num *temp,*ansHead,*ansTail,*bucketHead[10],*bucketTail[10]; scanf("%d",&t); while(t--) { for(i=0;i<10;i++) bucketHead[i]=bucketTail[i]=NULL; ...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include "BST_header.h" int main() { Tree root = createTree(10); int right_d = getRightDepth(root); int left_d = getLeftDepth(root); root = insertTree(root, 5, right_d, left_d); right_d = getRightDepth(root); left_d = getLeftDepth(root...
C
/* ** server.c for ftp server in /home/boulat_m/rendu/Projets_sem2/myftp/Server ** ** Made by Mickael BOULAT ** Login <boulat_m@epitech.net> ** ** Started on Mon Mar 9 17:49:13 2015 Mickael BOULAT ** Last update Tue Apr 7 21:23:04 2015 Mickael BOULAT */ # include <unistd.h> # include <stdlib.h> # include <stdio...
C
#include <stdio.h> int main() { int a, b, c, d; a = 50; b = 60; d = a*b; printf("d=%d\n",d); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <limits.h> // needed for INT_MIN #include <stdbool.h> //need this to recognise bool type, otherwise it is _Bool /* Skiena Chapter 6 - Weighted graphs, 3 algos are covered: - 6.1 Minimum spanning tree (prim's algo, kruskal's algo, union-find data structure) - 6.3...
C
#include<stdio.h> #include<string.h> int main() { int ara[20]; char str[50]; char str1[50]; scanf("%s",str); int length,i; length=strlen(str); for(i=0;i<length;i++) { if(str[i]=='f'|str[i]=='g') str1[i]=i; } for(i=0;i<length;i++) { printf("%c ",str1[i]); } return 0; }
C
//c数组允许定义可以存储相同类型数据项的变量,结构是c编程中另一种用户自定义的可用的数据类型,他允许存储不同类型的数据项 /*结构用于表示一条记录,结构体中定义的就是记录的属性 * struct tag{ * member-list * member-list * member-list * } variable-list; * tag是结构体标签。 * member-list是标准的变量定义,比如int i等 * variable结构变量,定义在结构的末尾,最后一个分号之前,可以指定一个或多个结构变量 */ //以下是Book结构的声明 struct Books{ char title[50]; ...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> //left trim char *ltrim(char *s) { //takes in a pointer to the array "line" while (*s == ' ' || *s == '\t') s++; //finds postion of first space character and points to next character return s; } char getRegister(char *text) { if (*text == 'r' || *text==...
C
#include "listlib.h" static inline size_t get_total_str_size( t_list const *list, size_t delim_len, int n, t_rostr (*get_str)(const void*, size_t)) { size_t size; t_rostr str; size = 0; for (; list && n > 0; LTONEXT(list), n--) if (list->content != NULL) { str = get_str(list->co...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <math.h> #include <time.h> #include "sort.h" static list *head = NULL; static void *init() { return (void *)head; } static void push(void **head_ref, int data) { list *new_head = malloc(sizeof(list)); new_head->data = data; new_head...
C
/** File: main.c Project: DCPU-16 Tools Component: Linker Authors: James Rhodes Description: Main entry point. **/ #include <stdio.h> #include <bstring.h> #include <policy.h> #include <parser.h> extern int yyparse(); extern FILE* yyin, *yyout; void print_value(policy_value_t*...
C
#include<stdio.h> #include<string.h> #define MAX 1000 #define NAME_MAX 15 #define SEX_MAX 10 #define TELE_MAX 12 #define ADDR_MAX 30 enum Option { EXIT,//0 ADD,//1 DEL, SEARCH, MODIFY, SHOW, SORT }; struct peoinfo { char name[NAME_MAX]; int age; char sex[SEX_MAX]; char tele[TELE_MA...
C
#include<stdio.h> #include<malloc.h> struct LL { int item; struct LL *next; }; typedef struct LL node; int HasKNodes(node *head,int k) { int i; for(i=1;head!=NULL && (i<k);i++,head=head->next); if(i==k && head!=NULL) return 1; return 0; } node* GetKthNode(node *head,int k) { in...
C
/** * @file main.c * @author João Pereira * @brief Main file where all the project's features will be called * @date 27/11/2018 22:24 * */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include "Customers.h" #include "Trips.h" #include "Structures.h" #include "API_Leitura.h" int...
C
#include <err.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/ioctl.h> #include <sys/stat.h> #include <sys/types.h> #define MKNAM(a) { #a, TIOCM_ ## a } static struct { const char *name; unsigned int bit; } names[] = { MKNAM(LE), MKNAM(DTR), MKNA...
C
#include <string.h> #include <math.h> #include <stdlib.h> #include <ctype.h> #include <stdio.h> //A C example of rounding numbers int main() { float a = 9.65657; float b = 4.3; printf("A is %.2f \n", floor(a));//floor() always round down printf("B is %.2f \n", floor(b)); printf("A is %.2f \n", c...
C
#include "password.h" // generate a numeric salted hash password char* GenerateSaltedHash(char* plainText, char* salt) { BYTE buf[SHA256_BLOCK_SIZE]; SHA256_CTX ctx; char* hashed_plainTextWithSalt, *hash; int i; int plainTextLen = strlen(plainText); int saltLen = strlen(salt); BYTE plainTe...
C
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include "graph.h" int marked[]; void profundidade(Graph G, int v) { int vizinho; link t; printf("Visitando o vertice %d\n", v); marked[v] = 1; //para cada vzinho de v ainda nao visitado chamar a funcao profundidade novamente for(t =...
C
#include<stdio.h> #include<stdlib.h> #include<time.h> int food(int num) { srand((int)time(0)); for(int i=1;i<=num;i++) { printf("%d ",rand()%10); } printf("\n"); return 0; } int main() { int num; printf("please input the number of figure:\n"); scanf("%d",&num); food(num); }
C
#include <stdio.h> #include <stdlib.h> #define MAX_QUEUE 5 void priority_enqueue(); void priority_dequeue(); void display_priority(); int priority_queue[MAX_QUEUE]; void check(int); int front = -1, rear = -1; int main() { int n, ch; while(1) { printf("\n1. ENQUEUE ELEMENT IN QUEUE\n"); print...
C
#include <stdio.h> int main(){ int edad, cont = 0, cont2 = 0, cont3 = 0, cont4 = 0, cont5 = 0; printf("Ingrese su edad: "); scanf("%d", &edad); while(edad != 0){ if(edad == 18){ cont++; }else if(edad == 19){ cont2++; }else if(edad == 20){ ...
C
#include "libft.h" t_string *stringCatAlignR(t_string *dst, char *src, size_t addLength, char c) { size_t strLength; strLength = ft_strlen(src); if (addLength < strLength) addLength = strLength; if (dst->maxLen + addLength < dst->maxLen) return (NULL); if (!stringGrantSize(dst, addLength)) return (NULL); ...
C
#include <unistd.h> void ft_putwrd(char *src) { signed long long i; i = 0; while (src[i] && src[i] != ' ') ++i; write(1, src, i); } int main(int argc, char **argv) { signed long long i; if (argc == 2) { i = 0; if (argv[1][0]) while (argv[1][i]) ++i; if (i != 0) { while (i != -1) { ...
C
#include <stdio.h> int main(void) { int i,n,sum=0,j,a; scanf("%d%d",&a,&n); //enter starting value and final value for(i=a;i<=n;i++) { int count=0; for(j=1;j<=i;j++) { if(i%j==0) { count++; } } if(count==2) { sum=sum+i; } } printf("%d",sum); return 0; }
C
#include<stdio.h> main(){ int i; for(i=10;i>=0;i--) {printf("%d\n",i); printf("\a");}}
C
/* Class: Player Member Function: checkFreeBlock Takes input the position ('pos') and checks if the position is occupied by a piece of the Player or not. Returns true or false. */ bool Player::checkFreeBlock(pair<int, char> pos){ //Checks if the given position is free or not if(this->reversePieces[pos] == ""...
C
#include<stdio.h> #include<stdlib.h> typedef struct node nodo_t; struct node{ int val; nodo_t *next; }; void crear(nodo_t *head,int v1,int lim){ //head=malloc(sizeof(struct node)); //pq no usar el malloc dentro de la funcion; //cual es la causa de q al ser usado no haga ningun efecto head->val...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> void caIIoc() { asm("movq %rax, %rdi"); } void execCommand(char *command) { //OwO what is this? system(command); } char *specialEncrypt() { char plaintext[100]; fflush(stdout); gets(plaintext); char *cipherText = malloc(100); ...
C
#include <stdio.h> #include <stdlib.h> #include <stdint.h> #define MAXSIZE 128 struct Qinfo { int32_t *const buffer; int front; int rear; int flag; const int max; void (*push) (struct Qinfo *self, int32_t data); int32_t (*pop) (struct Qinfo *self); int (*isFull) (struct Qinfo *self); int (*isEmpty) (struct ...
C
void main() { int n=5,i,j; clrscr(); for(i=1;i<=n;i++) { for(j=i;j<=n;j++) { printf("%d ",i); } printf("\n"); } getch(); }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> struct elemento{ char id[50]; int valor; }; typedef struct elemento elemento; struct nodo{ elemento dato; struct nodo* sig; }; typedef struct nodo nodo; void encontrarEnLista(nodo** lista, char identificador[], int incremento, int f...
C
/* ** check_line.c for check_line in /home/pinta_a/rendu/TETRIS/last/PSU_2015_tetris ** ** Made by pinta_a ** Login <pinta_a@epitech.eu> ** ** Started on Sat Mar 19 19:12:22 2016 pinta_a ** Last update Sun Mar 20 22:42:10 2016 pinta_a */ #include "proto.h" void copy_line(int *dest, int *src, int size) { int i;...
C
#include <stdio.h> int main(void) { int input; double sum=0.0; int i=0; int max=-1; int max2=-1; int max3=-1; printf("0과 2147483647 사이의 값을 입력하세요.\n"); while((scanf("%d", &input))!=EOF) { if (input>max) // max1~maxn까지 구해야하는 상황이라면 if문은 총 n개만큼이 필요하다 max3=max2, max2=max, max=input; else if (input<max ...
C
#include <err.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <stdint.h> #include <fcntl.h> #include <errno.h> int main(int argc,char** argv) { if(argc != 5) { errx(1,"Wrong arg. num."); } struct stat st; if(stat(argv[2],&st) < 0) { err(2,"error stat file %s",a...
C
#include<stdio.h> #include<string.h> char l1[150],l2[150],s[150]; int main(){ int lenl,lens,i,j,k; scanf("%d %d",&lenl,&lens); scanf(" %s %s %s",l1,l2,s); for(i=0;i<lenl;i++){ for(j=lens-1;j>=0;j--){ for(k=lens-1;k>=j;k--) if(s[k]<=l1[i] && l1[i]<=l2[i]) s...
C
/** lab13.c solution to labs 13-14 CS1023 Winter 2010 Compute the sum of the first n integers. Compares an iterative and recursive implementation **/ #include <stdio.h> #include "simpio.h" #include "strlib.h" //function prototy[pe int IterativeSum( int n); int RecursiveSum(int n); int main(){ i...
C
/****************************************************************************** * tcp_client.c * *****************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/uio.h> #include <sys/time.h> #include <unistd...
C
#include<stdio.h> #include<curses.h> void main() { int a,b,*p,*q; a=10; b=20; p=&a; q=&b; printf("\n value of a=%d",a); printf("\n address of a=%u",&a); printf("\n value of b=%d",b); printf("\n address of b=%u",&b); printf("\n value of pointer p=%u",p); printf("\n address of pointer p=%u",&p); printf("\n va...
C
#ifndef UART_H_ #define UART_H_ #define BAUD_PRESCALE ((F_CPU / (BAUDRATE * 16UL)) - 1) /* Define prescale value */ void UART_init(unsigned long BAUDRATE){ //Double Speed UCSRA = 0x02 ; //Polling /* UCSRB |= (1 << RXEN) | (1 << TXEN); // Enable USART transmitter and receiver and...
C
#include <stdio.h> #include <stdlib.h> int main(void){ FILE *f1, *f2; char ch; //ļ1 if((f1=fopen("user.txt","r"))==NULL){ printf("Failed to open f1!\n"); exit(0); } //½ļ2 if((f2=fopen("user_copy.txt","w"))==NULL){ printf("Failed to open f2!\n"); exit(0); } while(!feof(f1)){ ch = fgetc(f1); if(ch...
C
#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <unistd.h> #include <errno.h> #include <sys/un.h> int main() { int sock; struct sockaddr_in addr, client; char buf[50]; char name[20] = "Connected"; socklen_t len = sizeof(struct sockaddr); soc...
C
//question name: Hello World //question number: 2557 //status: correct #include <stdio.h> int main(void) { printf("Hello World!"); return (0); }
C
#include "todo_list.h" #include <limits.h> todo_list_t init_todo_list(size_t max_size) { size_t index; todo_list_t todo_list; memset(&todo_list, 0, sizeof(todo_list_t)); if (max_size == 0) { return todo_list; } todo_list.max_size = max_size; todo_list.cur_size = 0; todo_lis...
C
#include <stdio.h> #include <stdlib.h> void crearBaseDatos(char,int,int); int mostrarMenu(); void reservarAsiento(int**,int,int); void cancelarAsiento(int**,int,int); void mostrarOcupacion(int**,int,int); void actualizarBD(int**,char*,int,int); int main() { int opcion, row, col, operacion, **avion,con...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <unistd.h> #include <stdbool.h> #include <values.h> #define _GNU_SOURCE struct ParsedLine { char **tokens; int token_size; }; struct ParsedLine parse_line(char *line, char *delimiter) { struct ParsedLine parsed_line...
C
#include<stdio.h> #include<stdlib.h> typedef struct stud { int item; struct stud *next; }student; // CREATION OF NODE student * creatnode(int data) { student *node=(student *)malloc(sizeof(student)); node->item=data; node->next=NULL; return node; } // INSERTION OF NODE stud...
C
/* Dominic Taraska Tug76525@temple.edu Proper input: 1. operator(ex: '+', '-', '/', etc...) 2. space 3. number if number is negative you put '-' immediately before the number after the space. Examples of proper input: + 2 * 5 + -654 % 65 res is automatically used as first input, so if...
C
#include <stdio.h> #include <stdlib.h> #include "string.h" #include "addition.h" #include "soustration.h" #include "multi.h" #include "div.h" int main(int argc ,char **argv ,char **enpv) { int operations=0; /*printf("UNE ADDITION\n"); printf("UNE SOUSTRATION\n"); printf("UNE MULTIPLICATION\n"); pr...
C
/** ** \file lexer/lexer.c ** \brief Dtermine each tokens and each options ** \date 29 novembre 2018 ** **/ #define _GNU_SOURCE #include <err.h> #include <errno.h> #include <fcntl.h> #include <fnmatch.h> #include <getopt.h> #include <glob.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/...
C
/* ** EPITECH PROJECT, 2020 ** display life bar ** File description: ** display the life bar */ #include "../include/my.h" void display_green_bar(Index_t *index, enemies_list_t *current) { sfVector2f pos; sfVector2f scale; scale.x = 1; scale.y = 1; pos.x = current->coordinates.x - 16; pos.y =...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <mpi.h> int main(int argc, char ** argv) { if( MPI_Init(&argc, &argv) != MPI_SUCCESS ) { fprintf(stderr, "MPI_Init Failed!!!\n"); return -1; } int world_rank = -1; long int le_one = 0; long int g_one = 0; ...
C
#include "header.h" //================================================ // Name: checkGreater // Input: int // Output: int // Author: Ganesh Narayan Jaiwal // Date: 3 Aug 2020 // Description: Check if entered number is greater that 100 //================================================ BOOL checkGreater(int no) { ...
C
/* * time_utils.h: Convert XTime to us or s; get elapsed runtime in us or s * Author: Stephanie Kunkel */ #ifndef TIME_UTILS_H_ #define TIME_UTILS_H_ //Includes #include "xtime_l.h" //Defines #define COUNTS_PER_USECOND (COUNTS_PER_SECOND / 1000000U) //Functions unsigned long getElapsedRuntimeS(); unsigned long...
C
/*This program is for converting temperature from Fahrenheit to Celsius and visa-versa. - Sakshi Shrivastava v1.0*/ #include<stdio.h> void main() { system("clear"); //Declaration of variables float F, C; //Asking for user's input i Fahrenheit printf("Enter temperature in Fahrenheit: "); scanf("%f",&F); //Converting...
C
// C program to count frequency of digits in an integer #include<stdio.h> void main(void){ int number ; char f0 = 0 , f1 = 0 , f2 = 0 , f3 = 0 , f4 = 0 , f5 = 0 , f6 = 0 ,f7 = 0 ,f8 = 0 ,f9 = 0 ; printf("Input num: "); scanf("%d" , &number ); while(number != 0 ){ switch(number % 10){ case 0 : ...
C
/************************************************************************/ /* Program: assignment.c */ /* Author: Aleksandr Epp <aleksandr.epp@gmail.com> */ /* Matriclenumber: 6002853 */ /* Assignment : 3 ...
C
#include<stdio.h> void main() { float a; int k; printf("Nhap 1 so bat ki:"); scanf("%f",&a); k=(int)a; if(a-k!=0.5) printf("KHONG PHAI SO BAN NGUYEN"); else printf("SO BAN NGUYEN"); }
C
#include<stdio.h> float find_max(float *arr, int n) { if (arr == NULL) return 0; float max = 0.0; float temp = arr[0]; int i; for (i = i; i < n; ++i) { if (temp > max) max = temp; if (arr[i] > 0) { if (temp <= 0) temp = arr[i]; else temp *= arr[i]; } else temp = 0.0; } return...
C
#include <stdio.h> #include <math.h> #include <stdlib.h> double func(double y){ return (1-y)*y; } double euler(double n, double h, double t_init, double y_init){ int i; double y0, y1 = y_init, t0, t1 = t_init; for(i=0; i<n; i++){ t0 = t1; y0 = y1; t1 = t0 + h; y1 = y0...
C
// Program to explain working of continue statement #include <stdio.h> #include <conio.h> int main() { // clrscr(); int n; printf("Enter a number: "); scanf("%d", &n); for(int i=1; i<= n; i++) { printf("\nStart of loop\n"); printf("%d\n", i); if( i % 3 == 0) ...
C
/*------------------------------------------------------------------------- * * instr_time.h * portable high-precision interval timing * * This file provides an abstraction layer to hide portability issues in * interval timing. On Unix we use clock_gettime() if available, else * gettimeofday(). On Windows, g...
C
#ifndef MATH_H_INCLUDED #define MATH_H_INCLUDED #define PI 3.141 #define _Abs(value) ( (value) >= 0 ? (value) : -(value) ) #define _Round(value) ( (value) % 1 > 0.5 ? ((int) (value) + 0.5) : ((int) (value)) ) #define _Sign(value) ( (value) >= 0 ? 1 : (-1) ) #define _Cube(value) ( (value) * (value) * (value) ) #define...
C
#include "printn.h" void printn(int val, int base, int n_digits) { char str[32]; char digit; char offset; int i; for (i = 0; i < 32; i++) str[i] = '0'; if (val < 0) putchar('-'); for (i = 0; val; i++) { digit = abs(val % base); if (digit <= 9) offset = '0'; else offset = ('...
C
#include "proc.c" Proc *get_proc(Proc **list); // return a proc from a list int put_proc(Proc **list, Proc *p); // place a proc into a list int enqueue(Proc **queue, Proc *p); // enter a proc into the queue by priority Proc* dequeue(Proc **queue); // return the next proc to run in the queue int printList(Proc *list);...
C
/** * @file seal_file.c * @author WangFengwei Email: 110.visual@gmail.com * @brief seal a file * @created 2011-06-19 * @modified */ #include "common.h" #include <string.h> #include <stdio.h> #include <stdlib.h> #include <openssl/evp.h> #include <openssl/aes.h> /** * Create an 256 bit key and IV using the supp...
C
/* Agat Emulator version 1.19 Copyright (c) NOP, nnop@newmail.ru */ #include "sysconf.h" #include "runstate.h" #include <windows.h> #include <tchar.h> struct RS_DATA { LPCTSTR name; struct SYS_RUN_STATE*st; unsigned flags; }; static int n_runs; static struct RS_DATA*runs; int init_run_state...
C
#include <stdio.h> int main() { int codigo, quantidade; double valor, pagamento; scanf("%d", &codigo); scanf("%d", &quantidade); if(codigo==1) { valor=5.3; } else if(codigo==2) { valor=6.0; } else if(codigo==3) { valor=3.2; } else if(codigo...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* print_float.c :+: :+: :+: ...
C
#include <stdio.h> #include <math.h> int main() { unsigned long long result = 0; unsigned long long kg; unsigned long long temp; int i; for(i = 0; i < 64; i++) { temp = pow(2,i); result = result + temp; } kg = result / 25000; printf("舍罕王应该给予达依尔%llu粒麦子\n应该给%llukg麦子\n",result, kg); return 0; }
C
int main() { char str1[80]; char str2[80]; int len1,len2,i,j,n; cin.getline(str1,80); cin.getline(str2,80); n=0; for(len1=0;str1[len1]!='\0';len1++); for(len2=0;str1[len2]!='\0';len2++); j='A'-'a'; for(i=0;i<=len1;i++) { if( (str1[i]!=str2[i]) && ((str1[i]-str2[i])!=j) && ((str2[i]-str1[i])!=j...
C
#include <constants.h> char* conversions[] = { "int", "string", "char", "bool", "real", "nil" }; const char* TypeAsString(Type t) { switch(t) { case IntType: return conversions[0]; case StringType: return conversions[1]; case CharType: ...