language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <stdlib.h> #include <string.h> struct ident { char sigla[30]; char local[60]; char liga[61]; }; int main() { struct ident estacao[20]; struct ident comboio[30]; int opcao; int qtdEstacao = 6, qtdComboio = 10; while(1){ puts("MENU PRINCIPAL"); puts(" ...
C
#include "common.h" static char software_version[] = "$Id: done_handling.c,v 1.11 2010-09-22 07:03:59 freddy77 Exp $"; static void *no_unused_var_warn[] = { software_version, no_unused_var_warn }; /* * This test try do discovery how dblib process token looking for state * at every iteration. It issue a query to ser...
C
#pragma once /* M6: Ŀ 21 08 41 (21 41 ʼ 08 峤) 4D 36 (4D 36ʾϢM6Ϣ) 01 (Ϣǩ1-255ѭ) 01 (AGC) 01 00 (λָ2ֽ) 06 00 (Ŀ2ֽ) 8ֽ */ struct Msg_M6 { const BYTE head[3] = { 0x21, 0x08, 0x41 }; // ͷ const BYTE type[2] = { 0x4D, 0x36 }; // Ϣ BYTE tag = 0; // Ϣǩ BYTE agvno = 0; // AGV UINT16 taskno = 0; /...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <sys/stat.h> #include <sys/types.h> #include <ctype.h> // isdigit .... #include <getopt.h> // Pour les arguments #include <pwd.h> // Pour la fonction getpwnam qui change le nom; int myChown(int argc, char * argv[]) { // Décl...
C
// DDA #include<stdio.h> #include<graphics.h> #include<math.h> void DDA(int xa,int ya,int xb,int yb) { int dx=xb-xa; int dy=yb-ya; int step,k; float xincrement,yincrement,x=xa,y=ya; if(abs(dx)>abs(dy)) { step=abs(dx); } else { step=abs(dy); } xincrement=dx/(float)step; yincrement=dy/(float)step; putp...
C
#include<stdio.h> #include<conio.h> /* syntax of tmpname function char *tmpname(char *name) */ int main(){ char name[L_tmpnam+1]; tmpnam(name); puts(name); getch(); return 0; }
C
/** * @file save.h * @brief save/restore facility amidst the choice tree * @author Ben Blum */ #ifndef __LS_SAVE_H #define __LS_SAVE_H #include "estimate.h" #include <sys/time.h> struct ls_state; struct hax; struct save_state { /* The root of the decision tree, or NULL if save_setjmp() was never * called. *...
C
#include <linux/timer.h> #include <linux/kthread.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/delay.h> #include <linux/jiffies.h> #include <linux/init.h> #define TOUT 8000 static struct task_struct *spare; static struct timer_list time_ex; void timer_callback(struct timer_list *time) { pri...
C
/* * Oscar Hedblad * COP3502, 0002 * Matchmaking Program * Professor Marshall Tappen */ #include <stdio.h> #include <stdlib.h> #include <strings.h> #include <math.h> /* My different prototypes */ int factorial(int n); int matchScores(int perm[], int boysRating[][10], int girlsRatings[][10], int len); int matchDiffere...
C
/* To compile normally * gcc -Wall netset.c -o netset * * To compile with debugging info * gcc -g -Wall netset.c -o netset */ /* Initial configuration * - setup a working copy of INTERFACES_PATH that has NETDEV setup for dhcp * - copy it to the location DHCP_CONFIG */ /* To add a new profile, ...
C
// 引数のある関数ポインタの練習 #include <stdio.h> int max(int, int); int min(int, int); int main(void) { int (*cmp)(int, int) = NULL; // cmpの初期化 int a = 1, b = 20; cmp = max; printf("%dと%dのうち、最大のものは%d\n", a, b, cmp(a, b)); cmp = min; printf("%dと%dのうち、最小のものは%d\n", a, b, cmp(a, b)); return 0; } int m...
C
/* Name: Isaac DeMello Date: 3/3/2016 File name: avg.c Group: Woojin, Kyle */ #include<stdio.h> main() //begin main { //initialize variables int num = 0; float avg; int flag; int sum = 0; int div = 0; //prompt user for first input printf("Enter the first number to sum: \n"); scanf(...
C
/** * CSC369 Assignment 2 * * This is the source/implementation file for your safe stop sign * submission code. */ #include "safeStopSign.h" /** * @brief Broadcasts a condition variable and does error checking. * * @param cond pointer to the condition variable to initialize. */ static void broadcastConditionVariable(p...
C
//ECE471 Project //Raspberry pi tank weather station beer getting beast //Jason Millette //11/26/18 #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/time.h> #include <unistd.h> int main() { system("/home/pi/RpiTank/./initDisplay.py"); //Initialize the SPI displays system("/ho...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* libft.h :+: :+: :+: ...
C
/* Evaluation Of postfix Expression in C++ Input Postfix expression must be in a desired format. Operands must be integers and there should be space in between two operands. Only '+' , '-' , '*' and '/' operators are expected. */ #include <stdio.h> #include <string.h> int top = -1; int stack[1000]; ...
C
#include<stdio.h> #include<conio.h> #include<string.h> union student { char name[10]; int roll_no; int marks; }; void main() { union student s; clrscr(); printf("The Size of Union is %u bytes",sizeof(s)); strcpy(s.name ,"Prashant"); //string function used printf("\n The name is %s",s.name); s.roll_no=12; printf("\n Th...
C
/* ** EPITECH PROJECT, 2018 ** Evalxpr ** File description: ** make calcul with parenthese */ #include "include/my.h" #include <stdlib.h> int eval_expr(char const *str); int ini_multiplicator(char *str); int number(char **str); int factors(char **str); int summands(char **str); int main(int ac, char const *av[])...
C
/* * @@name: target_mapper_map.1c * @@type: C * @@compilable: yes * @@linkable: no * @@expect: success * @@version: omp_5.0 */ #include <stdio.h> #include <stdlib.h> #define N 1000 typedef struct myvec { size_t len; double *data; } myvec_t; #pragma omp declare target mapper(myvec_t v) map(v, v.data [0:v.le...
C
// RUN: %tool "%s" > "%t" // RUN: %diff %CORRECT "%t" int bar(int a) ensures \result == a + 1 { return a + 1; } int foo() { int x; x = 0; while(x < 20) invariant x <= 20 { x = bar(x); } assert x == 20; return 0; }
C
#pragma once void BubbleSort(int a[], int n) { int tmp = 0; for (int i = 0; i < n-1; i++) { bool bFlag = false; for (int j = 0; j < n-1-i; j++) { if (a[j]>a[j+1]) { tmp = a[j]; a[j] = a[j + 1]; a[j + 1] = tmp; bFlag = true; } } if (!bFlag) { break; } } } // ðÿ...
C
#include <stdio.h> #include <stdlib.h> #include "Lista2.h" int main () { Lista * p = lista_cria (); lista_insere_inicio (p, elemento_cria("joao", "2222.2222", 2)); lista_insere_inicio (p, elemento_cria("pedro", "1111.1111", 1)); lista_insere_inicio (p, elemento_cria("ana", "6666.6666", 6)); lista_insere_...
C
//Check if number id power of two //So number should have only one set bit // //Idea is // //If output num & (num -1) is 0 i.e. we had only one bit set >> so number is power of two // //Keep dividing number by two till num is one and check if num%2 is non zero at any point //Denotes num is not power of two else it is ...
C
// -*- compile-command: "gcc -o problem_026 problem_026.c -Wall" -*- // Copyright (c) 2014 Michael Caldwell #include <stdio.h> int main() { printf("Project Euler - Problem 26:\n" "Find the value of d < 1000 for which 1/d contains the longest recurring cycle.\n\n"); int n, i, m, j; int number[50...
C
#include <stdio.h> #include <stdlib.h> int Y (int a, int b) { return b == 0 ? a : Y (b, a % b) ; } int main() { int a, b, c, d ; char o ; while (scanf("%d/%d%c%d/%d",&a, &b, &o, &c, &d) != EOF) { int fz, fm ; switch (o) { case '-' : fz = a * d - b * c ; break ; ...
C
//to print upper and lower triangular matrix// #include<stdio.h> int main() { int m,n,i,j,a[10][10],b[10][10],c[10][10]; printf("Please Enter Number of rows and coloums : "); scanf("%d%d", &m,&n); printf("Please Enter the Matrix Elements\n "); for(i=0;i<m;i++) { for(j=0;j<n;j++) { ...
C
#include <stdio.h> int main(int argc, char *argv[]) { int distance = 100; float power = 2.345f; double super_power = 56789.4532; char initial = 'A'; char first_name[] = "Zed"; char last_name[] = "Shaw"; int number = 100; printf("You are %d miles away.\n", distance); printf("You hav...
C
// // main.c // barber // // Created by Takashii on 2021/5/28. // #include <stdio.h> #include <pthread.h> #include <time.h> #include <unistd.h> #include <semaphore.h> #include <stdlib.h> #define CHAIRNUM 5 sem_t cus,bar; //sem int empty_chair; int working_status ; int waiting_cus ; pthread_mutex_t mutex; void * B...
C
// Prevent Visual Studio Intellisense from defining _WIN32 and _MSC_VER when we use // Visual Studio to edit Linux or Borland C++ code. #ifdef __linux__ # undef _WIN32 #endif // __linux__ #if defined(__GNUC__) || defined(__BORLANDC__) # undef _MSC_VER #endif // defined(__GNUC__) || defined(__BORLANDC__) #include "OSM...
C
/* snake.h */ #include <stdlib.h> #include <stdio.h> #include "SDL.h" #define X_GRID_LENGTH 20 #define Y_GRID_LENGTH 20 #define BLOCK_SIZE 15 #define X_WINDOW_POS 200 #define Y_WINDOW_POS 50 void initialize_sdl_resources(); void initalize_game_state(); void generate_food(); void render_game_state(); void update_...
C
#include "pebble_os.h" #include "outlined_text.h" void draw_outlined_text(GContext* ctx, char* text, GFont font, GRect rect, GTextOverflowMode mode, GTextAlignment alignment, int outline_pixels, bool inverted) { (inverted) ? graphics_context_set_text_color(ctx, GColorBlack) : graphics_context_set_text_color(ctx,...
C
#include <cs50.h> #include <stdio.h> int main(void) { printf("How old are you? \n"); int age = GetInt(); if (age>20) { printf("You can drink!\n"); } if (age>17) { printf("You can vote!\n"); } if (age>15) { printf("You can drive!\n"); } else ...
C
/** * Display the current date and time in three formats */ #include <stdio.h> #include <time.h> int int main(int argc, char const *argv[]) { /* 1. 获得日历时间 */ time_t current = time(NULL); struct tm *ptr; char date_time[21]; int hour; char am_or_pm; return 0; }
C
/* * triangulo.c * * Created on: 28 sept 2021 * Author: juanm */ #include <stdio.h> #include <stdlib.h> #include "utn_biblioteca.h" #include "triangulo_estructura.h" #include "triangulo.h" int trianguloCarga(eTrianguloEscaleno* triangulo) { int retorno=-1; if(triangulo!=NULL) { w...
C
/*++ Copyright (c) 1997 Microsoft Corporation Module Name: trie.c Abstract: Contains wrapper routines around the fast & slow IP route lookup schemes Author: Chaitanya Kodeboyina (chaitk) 26-Nov-1997 Revision History: --*/ #include "precomp.h" #include "strie.h" #includ...
C
#include "stdio.h" #include "malloc.h" #include "stdlib.h" #include "stdbool.h" struct Node{ int data; struct Node *firstChild; struct Node *nextSibling; struct Node *parent; bool isLocked; int noOfLockedDecendent; int operation; }; bool lock(struct Node *node); bool unLock(struct Node *nod...
C
#include "pohoncalc.h" #include <stdio.h> /* *** Konstruktor *** */ BinTree Tree(infotype Akar, BinTree L, BinTree R, BinTree P){ BinTree T; T = AlokNode(Akar); if(T != Nil){ Left(T) = L; Right(T) = R; Parent(T) = P; return T; } else{ return Nil; } } /* Menghasilkan sebuah pohon biner dari A, L, da...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <locale.h> #include <unistd.h> #include "vendas.h" #include "menu.h" void imprimeVendas(TVendas Vendas){ limpezaDoBuffer(); printf("\nCodigo do produto comprado: "); printf("%d\n", Vendas.codigo); printf("\nCLiente: "); printf("%s\n...
C
#pragma once #include <stdio.h> #define MAX_VERTICES 5 #define INF 1000L //׷ ġ ܼ 2 迭 int weight[MAX_VERTICES][MAX_VERTICES] = { { 0, 16, INF, 25, INF }, { 16, 0, 29, INF, INF }, { INF, 29, 0, 12, 17 }, { 25, INF, 12, 0, 22 }, { INF, INF, 17, 22, 0 } }; int selected[MAX_VERTICES]; // int dist[MA...
C
#include <stdlib.h> //rand, srand #include <time.h> //time #include <stdio.h> int rambo(int min, int max); int rambo(int min, int max){ return rand() % (max - min + 1) + min; } int main(){ srand((unsigned) time(NULL)); int qtd = 10; while(qtd--) printf("%d ", rambo(4, 7)); puts(""); }
C
#include<stdio.h> void main() { int a=10; int *p=&a; float b=20; float *q=&b; void *ptr; ptr=&a; // ptr=&b; printf("%p %p %p\n",p,q,ptr); printf("%d %d\n",*p,*(int *)ptr); printf("%f %f\n",*q,*(float *)ptr); }
C
#include <stdio.h> #include <stdlib.h> int main() { int n,i,j,old; int *v; scanf("%d",&n); v=(int *) malloc(n*sizeof(int)); if (v==NULL) exit(-1); for(i=0;i<n;i++) { old=0; for(j=0;j<i;j++) { int k; k=v[j]; v[j]=(old+v[j])%2; old=k; if (v[j]) printf("*"); else prin...
C
/* * AD5252.c * * Created on: 12.02.2018 * Author: Erich Styger Local */ #include "Platform.h" #include "AD5252.h" #include "GI2C1.h" #include "CLS1.h" #include "UTIL1.h" #define AD5252_I2C_ADDR 0b0101100 /* S01011xx */ #define AD5252_I2C_CMD (1<<7) #define AD5252_I2C_REG (0<<7) #define AD5252_I2...
C
#include "simpleCSVsorter.h" // implementation char get_type(char* val) { if(strcmp(val, "color") == 0 || strcmp(val, "director_name") == 0 || strcmp(val, "actor_2_name") == 0 || strcmp(val, "genres") == 0 || strcmp(val, "actor_1_name") == 0 || strcmp(val, "movie_title") == 0 || strcmp(val, "actor_3_name") == 0 || st...
C
//#include<stdio.h> //#include<math.h> // //#define ERROR 1E-8 // // // //double my_sin(double x) //{ // double temp = x; // // double result = x; // // double i = 1; // // while (fabs(temp) > ERROR) // { // temp *= -(x * x); // i++; // temp /= i; // i++; // temp /= i; // result += temp; // } // // return result...
C
/*Moje funkcje*/ #include <stdio.h> #include <stdlib.h> #include "mazelib.h" #include "random.h" #include <ncurses/curses.h> /*F-a przyporzadkowuje punktowi, na ktory wskazuje wskaznik p, nowe wspolrzedne a i b. Poza tym rysuje ludzika w nowym miejscu*/ void Daj(int a, int b){ p->x = a; p->y = b; lab[b][a] = '@'...
C
#include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h> typedef struct binary_tree binary_tree; struct binary_tree { int item; int height; binary_tree *left, *right; }; binary_tree *create_empty_binary_tree() { return NULL; } binary_tree *create_binary_tree(int item, binary_tree *left, bin...
C
typedef struct pair { int x; int y; } MyPair; volatile MyPair mypair; volatile int k = 0; void assignk(struct pair* p) { p -> x = k; p -> y = k; return; } int main() { for (;;) { assignk(&mypair); k = (k + 1) % 2; }; return 0; }
C
#include <stdio.h> int main() { int a[5], i; // initialization stage for (i = 0; i < 5; i++) a[i] = 1; // visiting stage for (i = 0; i < 5; i++) printf("%d\n", a[i]); }
C
#include <stdio.h> #include <stdlib.h> int trespasos(int); int main(void) { int argumento, res; printf("Ingrese numero 1: "); scanf("%d", &argumento); fflush(stdin); res = trespasos(argumento); printf("Paso 1: %d\n\n", res); printf("Ingrese numero 2: "); scanf("%d", &...
C
#include<stdio.h> #include<math.h> double madhav_leibniz(int steps); double euler_leibniz(int steps); double euler_zeta(int steps); double euler_zeta(steps) { int k = 1 ; double sum = 0.0 ; while(k < steps) { sum += 1.0 / (k*k); k++; } /* pi^2/6 = series sum */ double pi = sqrt(6.0*sum); printf("pi = %...
C
#include <stdio.h> #include <string.h> void reverse(char s[]){ int c, i,j; for(i = 0, j = strlen(s) -1; i<j;i++,j--){ c = s[i]; s[i] = s[j]; s[j] = c; } } main(){ printf("x is x \n"),printf("y is y \n"); }
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <pthread.h> int err(const char *str, int line) { perror(str); printf("line %d: ", line); exit(0); } static void * threadFunc(void *arg) { int i; printf("New thread started\n"); for(i = 1; ; i++) { printf("loop %d\n", i); sleep(1); } retu...
C
/** @file Queue module of unsigned chars. */ #ifndef EHAL_QUEUE_H #define EHAL_QUEUE_H #ifdef EHAL_GLOBAL #include "ehal_global.h" #endif #include <stdbool.h> #include <stdint.h> struct queue { unsigned char *buff; /**< your buffer goes here. */ uint8_t sz; /**< number of elements in buff */ uint8_t s; /**< start...
C
#include "../../includes/view/table.h" /* ---------------//--------------- [Structs] ---------------//--------------- */ //[struct table] struct table{ string *info; //Information of table -> Array of strings string *titles; //Table titles -> Array of strings string title_lines; /...
C
/* * File: main.c * Author: protodev * License: see LICENSE * * Created on February 18, 2016, 12:20 PM */ #include <arpa/inet.h> #include <stdint.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <X11/X.h> #include <gtk-3.0/gtk/gtk.h> #include <gdk/gdkkeysyms.h> #include "main.h" #include...
C
/* * defines.h * * Created: 13.09.2017 12:12:04 * Author: tobib */ #ifndef DEFINES_H_ #define DEFINES_H_ #include "usart.h" #define F_CPU 16000000 // Clock frequency in Hz enum {JOYSTICK_X, JOYSTICK_Y, SLIDER_LEFT, SLIDER_RIGHT, BUTTONS}; typedef enum { LEFT_BUTTON, RIGHT_BUTTON, JOY_BUTTON } button; #def...
C
#ifndef MATHC_TYPES_UINT_H #define MATHC_TYPES_UINT_H #ifndef __cplusplus #define static_assert _Static_assert #endif typedef union { unsigned v[2]; struct { unsigned v0, v1; }; struct { unsigned x, y; }; struct { unsigned r, g; }; } uvec2; static_assert(sizeof(uve...
C
/* Write a function invert(x,p,n) that returns x * with the n bits that begin at position p inverted, * leaving the others unchanged */ #include <stdio.h> #include "bits.h" unsigned invert(unsigned, int, int); int main() { unsigned tests[10] = {0x0, 0x1, 0x6, 0x3f, 0x25}; unsigned expected[][2] = { {0x1, ...
C
#include <stdio.h> int main(){ printf("Hello world\n"); //ushort //int *x = 5; //uint m = 6; //printf("%d\n", x); //printf("%u ", &x); return 0; } /*int main(){ //ushort int x = 5; //uint m = 6; printf("%d", x); //printf("%u ", &x); } */
C
/*_____________________________________________________________________________________________ Copyright 2011 Nishchay Mhatre Licensed under the Apache License, Version 2.0 (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.apache.org/...
C
#include <ctype.h> #include <stdio.h> #include <stdlib.h> #include "keyword.h" #include "lex.h" tok_t get_next_token() { static char peek = ' '; for (; peek == ' ' || peek == '\t';) peek = fgetc(stdin); if (isdigit(peek)) { int num = 0; do { num = num * 10 + peek - '0'; peek = fgetc(stdin); } whil...
C
/* * Stack.h: * This module implements a stack (FIFO). * * Used to simulate recursion. */ #ifndef STACK_H_ #define STACK_H_ #include <stdio.h> #include <stdlib.h> #include <time.h> /* * This struct represents the list of parameters needed for a recursive call, * in order to find number of solutions to a board...
C
#include <stdio.h> #include <time.h> #include <sys/time.h> #include <sys/resource.h> #include <stdlib.h> #include <dlfcn.h> #include "contact.h" #include <unistd.h> #include <errno.h> #ifdef DYNLIB contacts_unidb* (*d_cunidb_initialize)(int type); void (*d_cunidb_free)(contacts_unidb* db); struct contact_uninode* (*d...
C
/*  题目:打印出所有的"水仙花数",所谓"水仙花数"是指一个三位数,其各位数字立方和等于该数 本身。 例如:153是一个"水仙花数",因为153=1的三次方+5的三次方+3的三次方。  程序分析:利用for循环控制100-999个数,每个数分解出个位,十位,百位。  */ #include<stdio.h> #include<math.h> //输入一个整数,判断此整数是否为水仙花数,是则返回1,否则0 int judge(int number) { int ge, shi, bai; int forjudge1 = number; bai = number / 100;//百位 number = number %...
C
#include <stdio.h> #include <unistd.h> #include <sys/socket.h> #include <stdlib.h> #include <arpa/inet.h> #include <ctype.h> #include <strings.h> #include <errno.h> #include "wrap.h" #include <limits.h> #include <poll.h> #define SERV_IP "127.0.0.1" #define SERV_PORT 6666 #define MAXLINE 1024 #define LISTENEQ 128 #defi...
C
/********************************************************************************* * Despina Patronas, Dpatrona * 2021 Winter CSE 101 pa7 * Arithmetic.c *********************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "Lis...
C
#include <stdio.h> #define TAM 40 #define NUMSOCI 5 /* M03.PROG-UF1:NF2 PT: Exercicis Estructures complexes. Nombre: Luis Ramos Santos. Fecha: 19/02/2018. Descripcin: Ex5.Crea un programa per realitzar la gesti dels socis d'un club. L'estructura del soci t id_soci, nom i edat. El program...
C
/* ** EPITECH PROJECT, 2017 ** bubble_sort.c ** File description: ** bubble_sort */ #include <criterion/criterion.h> #include <unistd.h> #include <stdio.h> void my_swap(int *a, int *b) { int c; c = *a; *a = *b; *b = c; } void swap_elem (int *array, int index1, int index2) { my_swap(&array[index1], &array[inde...
C
#include<stdio.h> void move(int ,char ,char); void hanoi(int ,char ,char ,char); int index=0; int main() { hanoi(2,'A','B','C'); return 0; } void move(int n,char x,char y) { printf("%dst move %c ---> %c \n",++index,x,y); } void hanoi(int n,char x,char y,char z) { if(n==1) move(1,x,z); else { ...
C
// // gmVector.c // MyOpenGLES // // Created by Archer_LJ on 14-7-10. // Copyright (c) 2014年 Archer_LJ. All rights reserved. // #include <stdio.h> #include <math.h> #include "gmVector.h" #include <string.h> void InitgmVector2(gmVector2* vec) { memset(vec, 0, sizeof(gmVector2)); } void InitgmVector3(gmVector3*...
C
//Проверка на целое, если рациональное число //является целым, то «да», иначе «нет» //Подключаемые модули отсутствуют //int INT_Q_Z(struct RATIONAL a), где a - проверяемое число //Функция возвращает 1, если проверяемое число целое, иначе 0 //Плотников Юрий - 5307 int INT_Q_Z(struct RATIONAL a) { if (a.denominato...
C
#include <stdio.h> int main() { int n; scanf("%d",&n); if(n>=30 && n<=50) printf("\nD"); else if(n>=51 && n<=60) printf("\nC"); else if(n>=61 && n<=80) printf("\nB"); else if(n>=81 && n<=100) printf("\nA"); else printf("\nInvalid Input"); return 0;...
C
#include <stdio.h> #include <stdlib.h> #include<conio.h> #define f(x) (exp(-(pow(x,2)))) int main() { int i,n; float a,b,x[30],y[30],wedd=0,h; printf("Enter the lower and upper limit:"); scanf("%f%f",&a,&b); printf("Enter the number of intervals"); scanf("%d",&n); h=((b-a)/n); printf("\n...
C
/* ** EPITECH PROJECT, 2020 ** programP1 ** File description: ** navy */ #include "my.h" general_t g; void display_pid_p1(void) { pid_t pid = getpid(); my_putstr("my_pid: "); display_nbr(pid); my_putstr("waiting for enemy connection...\n\n"); } void get_pid(int sig, siginfo_t *info, void *context) ...
C
/** * @file * @brief Relabels each connected component to guarantee a consistent map. * @author Felipe Lemes Galvao */ #include <ift.h> #include "iftSuperpixelFeatures.h" #include "iftExperimentUtility.h" int main(int argc, char* argv[]) { if (argc < 3) iftError("Usage: %s <input img> <output_img> [min_regi...
C
#include <stdio.h> #include <stdlib.h> int main() { int *p, n; printf("Enter number of integers: "); scanf("%d", &n); p = (int *) malloc(n * sizeof(int)); if (p == NULL) { printf("Unable to allocate memory. Exiting the program...\n"); exit(1); } /* exit(0) --> successful termination OR normal termination ...
C
#include <pads.pri> static void Proto(p) { PutRemote(p); } static void CheckProto( p ) { if( GetRemote() != p ) ProtoErr(); } static long ShiftIn( bytes ) register bytes; { register long shifter = 0; CheckProto( bytes ); while( bytes-- ) shifter = (shifter<<8) + (GetRemote()&0xFF); return shifter; } long RcvL...
C
/* * Hearthstone * Copyright (C) 2005-2008 Hearthstone <http://www.hearthstone-project.com/> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or *...
C
#include<stdio.h> void main() { int r,*R,*a; printf("enter r "); scanf("%d",&r); R=&r; *a=3.14*(*R)*(*R); printf("%d is area",*a); }
C
/* using the stdlib.h library, we can execute terminal (bash) commands with the system() function -- for Unix/POSIX systems only*/ #include <stdio.h> #include <stdlib.h> int main() { system("echo \" Just a sample of the power this enables.\n \""); printf("The above statement was executed by the echo command.\n"); ...
C
/* ** EPITECH PROJECT, 2017 ** minishell.c ** File description: ** main.c */ #include <string.h> size_t my_strlen(char *str) { size_t i = 0; for (; str[i] != '\0'; i++); return (i); }
C
#include <stdio.h> #include <string.h> int mystrend(char *s, char *t); int main() { char a[] = "football"; char b[] = "ball"; char c[] = "foot"; printf("strend(%s,%s): %i\n", a, b, mystrend(a,b)); printf("strend(%s,%s): %i\n", a, c, mystrend(a,c)); printf("strend(%s,%s): %i\n", c, a, mystrend...
C
#include<stdio.h> void Fibonacci(int n); main() { int k,n; long int i=0,j=1,f; printf("Enter the range of the Fibonacci series: "); scanf("%d",&n); printf("%d\n%d\n",0,1); n=n-2; fib(n); } void fib(int n) { static long int f=0,s=1,sum; if(n>0) { sum=f+s; ...
C
#include <stdlib.h> #include <aem/log.h> #include "driver.h" #include "display.h" int liblcd_display_init(struct liblcd_display *disp, const struct liblcd_driver *driver, int param1, int param2, int param3, void *argv) { aem_assert(disp != NULL); aem_assert(driver != NULL); if (!liblcd_stream_ok(&disp->stream))...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_printf_core.c :+: :+: :+: ...
C
/* listen.c: thread to listen on a port and maintain connected fds */ /* there is a finite maximum number of fds -- once more are connected, */ /* old ones are closed */ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <pthread.h> #include <errno.h> #include <sys/types.h> #in...
C
/* David Sedlák <xsedla1d>, Karel Hanák <xhanak34> */ #include <stdio.h> #include <unistd.h> #include <thread> #include <queue> #include <mutex> #include <vector> #include <iostream> #include <string.h> #include <regex> using namespace std; vector <mutex *> locks; mutex *entered_chain_mutex, *finished_mutex; bool li...
C
/****************************************************** ̸ : scanf_sprintf.c ۼ : 뵵 : Ҹ Ȱ ******************************************************/ #include <stdio.h> int main(void) // main() Լ { int x, y; char data_in[20] = "50, 123"; char data_out[20]; sscanf(data_in, "%d%*c%d", &x, &y); sprintf(d...
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 op; float num1, num2; puts("Uma simples calculadora:"); puts("Escolha uma operacao \n1 + \n2 - \n3 * \n4 /"); scanf("%d",&op); ...
C
#ifndef lcthw_list_h #define lcthw_list_h #include <stdlib.h> /* * struct ListNode * * The ListNode data structure represents the * heart of the doubley linked list. * * It knows the memory address of the node to * its left and the node to its right - this is * why we can define the list as doubley linked. *...
C
#include "utils.h" void get_token(char cmd[], char token[], int *idx, int size) { /* * generates the next token contained in cmd appearing after the idx * Arguments: * char cmd[] - the cmd string * char token[] - the resultant token * int *idx - pointer to the starting index in cmd * int size - the ma...
C
#include<stdio.h> int main() { int a=2,b=3; b=a++ + b--; a=a-- + ++b; b=a++ + --b; printf("a=%d\nb=%d\n",a,b); }
C
// // Create Window // #include <SDL.h> #include <stdio.h> #ifdef PLATFORM_EMCC #include <SDL_touch.h> #include <emscripten.h> #endif int fpsCount = 0; int debugCount = 0; double debugTime = 0.0; int _isQuit = 0; int fps; double capp_currentMilliSecound() { return SDL_GetTicks(); } void main_loop() { SDL_Eve...
C
#include <stdio.h> #include <math.h> #define CMAX 10 #define VMAX 10 int NC, NV, NOPTIMAL,P1,P2,XERR; double TS[CMAX][VMAX]; void Data() { double R1,R2; char R; int I,J; printf("\n SIMPLEX METHOD\n\n"); printf(" MAXIMIZE (Y/N) ? "); scanf("%c", &R); printf("\n NUMBER OF VARIABL...
C
#ifndef _LINUX_RATELIMIT_H #define _LINUX_RATELIMIT_H #include <linux/param.h> #include <linux/spinlock.h> #define DEFAULT_RATELIMIT_INTERVAL (5 * HZ) #define DEFAULT_RATELIMIT_BURST 10 struct ratelimit_state { raw_spinlock_t lock; /* protect the state */ int interval; int burst; int printed; int missed;...
C
#include <stdio.h> int main() { char ch; while((ch = getchar()) != '#') //ch = getchar()表达式的值为从键盘输入并存入到ch中的值, { //对于赋值表达式,左值的值即为表达式的值 putchar(ch); } return 0; }
C
/* Chapter-6 Program to categorize a single character that is entered at the terminal * Vasanth [02 September 2014] */ #include<stdio.h> int main(void) { char c; printf("Enter a single character:\n"); scanf("%c", &c); if((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ) printf("It's an alphabetic character....
C
// // Eric Jiang // node.c // OS_Problem-2 // #include <stdio.h> #include <stdbool.h> /* struct for tree nodes*/ struct tree_node{ int children_no; char name; struct tree_node *left; struct tree_node *right; }typedef tree_node; /* struct for creating new nodes */ struct tree_node* newNode(int children_no, c...
C
/* the following checks numbers between 1-100 and finds all the prime numbers */ #include<stdio.h> #define SIZE 100 main() { printf("PRIME NUMBERS\n-------------------\n"); int i,j,k;//counters for nested for loops k=1; //This algorthm requires the loops to start at 2 for(i=2;i<SIZE;i++) { ...