language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* * 08-a-02.c * * Created on: 2018/06/05 * Author: ub301144 */ #include <stdio.h> #include <stdlib.h> int main() { int a[5][5]; int i,j; for(i=0;i<5;i++){ for(j=0;j<5;j++){ if(i==j){ a[i][j]=1; }else{ a[i][j]=0; } } } for(i=0;i<5;i++){ for(j=0;j<5;j++){ printf("%d",a[i][j]); }print...
C
/*!**************************************************************************** * @file * sensorlib_bme280.c * * Ansteuerung fr den Wettersensor BME280 von Bosch Sensortec * * @date 28.10.2019 * @date 31.10.2019 Update-Routine, Strukturtyp fr Sensordaten *********************************************...
C
/** * Sistemas Operativos * Módulo 2, Sesión 6, Ejercicio 4 * Francisco Domínguez Lorente */ #include <sys/types.h> #include <fcntl.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <string.h> #include <sys/wait.h> int main() { struct flock cerrojo; int fd; cer...
C
#include "folder.h" #include "stdlib.h" #include <stdio.h> int main(int argc, char const *argv[]) { const char *nameData; const char *nameResult; #ifdef TEST nameData = "/home/clement/Workspace/VsCodeProject/ESISAR_CS/3A/CS351/ESISAR_CS351_TP4/Exercice1/data/donnee.txt"; nameResult = "/home/clement/Wor...
C
// exe ϰ // exercise, meditate, respirate ۺϣ // ĿǼҼ䷱----- Silencer @ fy4 #include <skill.h> inherit F_CLEAN_UP; string *add = ({ "qi", "jing", "shen" }); mapping *type = ({ ([ "add": "force", "add_c": "", "cost": "kee", "cost_c": ...
C
// Vector.h // Visualização 3D // W. Celes - celes@inf.puc-rio.br // PUC-Rio, Jan 2008 // Class provided by Prof. Waldemar Celes for Vector manipulation. #ifndef V_VECTOR_H #define V_VECTOR_H #include <stdio.h> #include <math.h> struct VVector { float x, y, z; VVector () { } VVector (float vx, float...
C
/* Rosa María Ramírez Moreno A01700857 22-01-18 */ #include <stdio.h> #include "operations.h" void printTestMesssage(int, char *, char *); int testAddition(void); int testSubstraction(void); int main(){ //Test add printTestMesssage(testAddition(), " add test 1 passed", ...
C
#include<stdio.h> char string[]={"acbca"}; int length(char string[]) { int i=0; while(string[i] != '\0') { i++; } return i; } void pallendrom(char string[]) { int i,j,k=0; for(i=0,j=length(string)-1;i<length(string)/2+1,j>length(string)/2-1;i++,j--) { if (string[i] == string[j]) { printf("%c %c %d %d\...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* sorted_delete.c :+: :+: :+: ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* env_handler.c :+: :+: :+: ...
C
/* Algoritmo de Self-Organizing Map por Teuvo Kohonen (1984) Implementado por Geraldo Rabelo geraldo.rabelo@gmail.com em 24/08/2017 Como SOM funciona? As entradas (input.dat) representam um conjunto de padrões a ser reconhecido pela rede após seu treino. Treino Passo a Passo: ...
C
#include <string.h> #include "hanoi.h" int check_cmd(char buf[2], Tower **tower) /* Fonction qui vérifie la commande de jeu */ { int flag; /* Contient 0 si tout se passe bien, autrement -1 */ flag = 0; /* Boucles pour aller au premier plateaux de chaque tour */ while (tower[0]->plate && tower[0]->plat...
C
#include <stdio.h> #include <GL/glew.h> #include <GL/gl.h> #include <SDL.h> #include "vertex_buffer.h" void setup_rendering() { glMatrixMode( GL_MODELVIEW ); glLoadIdentity(); glFrustum(0, 20, 20, 0, 0, 10); //glRotatef() //glTranslatef(-1.0f, 0.0f, 0.0f); glScalef(0.3f, 0.3f, 0.3f); glRo...
C
/* ** ALEX NENKO STD SOFTWARE ** ** File: an-list.h - macroses to facilitate AN-LIST management ** ** Oct 1991 Alex Nenko - written ** Dec 2002 Alex Nenko - comments, usage ** Apr 2003 Alex Nenko - 2 bugs in examples in comments :) ** ** NOTE. AN-LIST macroses work with 2-directional list of objects. ** ...
C
/* Iterative deepening search (迭代加深搜索) */ #include<stdio.h> #include<stdlib.h> #include<string.h> #define MAX_LEN 101 int num[MAX_LEN]; int n, find, dplimit; void dfs(int depth) { int i, j; if(depth >= dplimit) return; if(num[depth] == n) { if(!find) { for(j=0; j<=depth; j++) printf("%d ", num[j]); pr...
C
#include<stdio.h> int main() { struct addbooks { char a[40]; char id[30]; char authorname[30]; char price[30]; char shelfnumber[30]; }book1; printf("\nENTER BOOK INFORMATION\n"); printf("===============================\n"); printf("Book Name: "); gets(book1.a); printf("Book Id...
C
#include "leet.h" // Counter struct begin typedef struct HashNode { struct HashNode *next; int val; int freq; } HashNode; void node_show(void *p) { HashNode *node = p; if (p == NULL) { printf("%p", p); } else { printf("%d(%d)", node->val, node->freq); } } typedef struct Ha...
C
#include <stdio.h> #define PI 3.14 int main() { float radius, result; int choice; printf("Enter radius: "); scanf("%f", &radius); printf("1. Area of Circle\n2. Circumference of Circle\n3. Volume of Sphere\nEnter your choice: "); scanf("%d", &choice); switch (choice) { case 1: result = PI * radius * radi...
C
//Generates filter coefficients for smooth differentiators as described in: //Holoborodko P. 2008. Smooth noise robust differentiators. www.holoborodko.com. //See also: de Matos MC. 2018. Seismic attributes from the complex Teager-Kaiser energy. //These can be used with fir. //See smooth_diff for more comments. //N i...
C
#include "quadtree.h" struct point1 { int x; int y; }; /*container for regions*/ struct regionData1 { int minRow; int maxRow; int minCol; int maxCol; int count; points **vertices; void *data; int region_id; //indicates which region the node belongs to }; /*container for quadrant boundaries*/ struct boundi...
C
/* critical.c * ... fixes a race condition when multiple threads read from / * write to a shared variable using the OpenMP critical directive. * * Joel Adams, Calvin College, November 2009. * * Usage: ./critical * * Exercise: * - Compile and run several times; note that it always produces the correct balance...
C
#include <stdio.h> int main () { float H, he1, hf1, he2, hf2, p; printf ("Digite o numero de horas extras feitas pelo funsionario: "); scanf ("%f", &he1); printf ("Digite o numero de horas faltas feitas pelo funcionario: "); scanf ("%f", &hf1); //calculo, H = minutos = he * 60 - (2/3 * (hf * 60) he2 =...
C
#include "plt_vertex_processor.h" #include <stdlib.h> #include "platypus/mesh/plt_mesh.h" #include "platypus/base/allocation/plt_linear_allocator.h" typedef struct Plt_Vertex_Processor_Working_Buffer { unsigned int vertex_capacity; float *clipspace_x; float *clipspace_y; float *clipspace_z; float *clipspace_w; ...
C
//////////////////////////////////////////////////////////////////////////////// // senseye_serv_2.c // // University of Michigan // // Serves data from the stonyman imagers up to the host pc //////////////////////////////////////////////////////////////////////////////// // includes #include <stdlib.h> #include <stdi...
C
#include<stdio.h> int main() { int a,b; scanf("%d",&a); b=a^a; printf("power of no=%d",b); return 0; }
C
/** * Implement int sqrt(int x). * Compute and return the square root of x, where x is guaranteed to be a * non-negative integer. Since the return type is an integer, the decimal * digits are truncated and only the integer part of the result is returned. * * Example: * Input: 8 * Output: 2 * * 实现求平方根,注意...
C
#include <unistd.h> #include <stdio.h> #include "SDL.h" #include "ourtypes.h" #include "things.h" #include "network.h" #include "main.h" #include "input.h" void input(){ SDL_Event event; if (players[playerno]) key_input(); else if (SDL_PollEvent(&event) && event.type == SDL_QUIT) mode = EXIT; ...
C
typedef struct{ char *nam; FILE *ptr; } FileWithName; #define COMMENTS_LEN 10000 #define LINE_LEN 200 int WhichBin_Float(float x, float *b, int n); int WhichBin_Double(double x, double *b, int n); FILE *Open(char *filename, char *mode); char *ReadComments(FILE *fp_in); char *ReadAndWriteComments(FILE *fp_in, ...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #define SIZE_A 10 #define SIZE_B 20 void populate_array(int array[], int size); void print_array(int array[], int size); /* * 1. გამოაცხადეთ ორი სხვადასხვა ზომის მასივი და დაწერეთ ფუნქცია, რომელიც * შეავსებს ამ მასივის ელემენტებს მნიშვნელობებით და აჩვენებს ე...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_char.c :+: :+: :+: ...
C
#include <stdio.h> struct date { int day; int month; int year; } date[2]; int N (struct date *p); int main (void) { struct date *p = date; int i= 0; printf("Enter both dates of which you want to know the elapsed time (dd.mm.yyyy):\n1st date: "); while(p < date + 2){ scanf("%d.%d.%d", &date[i].day, &date...
C
/* ** my_find_prime_sup.c for my_find_prime_sup in /home/boitea_r ** ** Made by Ronan Boiteau ** Login <boitea_r@epitech.net> ** ** Started on Sun Oct 18 18:50:14 2015 Ronan Boiteau ** Last update Thu Dec 17 23:38:47 2015 Ronan Boiteau */ #include "my.h" int my_find_prime_sup(int nbr) { while (my_is_prime(nbr...
C
#include <stdio.h> int main() { int n,m; while( scanf("%d %d", &n,&m)!=EOF){ printf("%d\n",n^m); } return 0; }
C
#include <stdio.h> typedef struct STnode* link; struct STnode {item b[M]; int m; int k;}; static link *dir; static int d, D, N; link NEW(){ link x = malloc(sizeof *x); x->m = 0; x->k = 0; return x; } void STinit(int maxN){ d= 0; N = 0; D = 1; dir = malloc(D*(sizeof(*dir))); dir[0...
C
#include <SDL.h> #include <SDL_image.h> #include <SDL_mixer.h> #include <SDL_ttf.h> #include <stdlib.h> #include <math.h> #include <time.h> #define SCREEN_W 800 #define SCREEN_H 600 #define GRAVIDADE 1 #define SALTO 20 #define IMAGENS 8 #define ATUALIZACAO 10 typedef struct _FIGURA { SDL_Surface...
C
unsigned char ibuf[16]; unsigned char* itoa(unsigned int n){ int e=14; while(n>=1)ibuf[e]=n%10+'0',n/=10,e--; return ibuf+e+1; }
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include <string.h> int measure(); int main() { measure(); system("pause"); return(0); } int measure() { int num1, num2, num3, max; printf("enter three numbers\n"); scanf("%d%d%d", &num1, &num2, &num3); if (num1>num2>num3) { pr...
C
#include<stdio.h> #include<string.h> int main() { int x,y,z; char lab[20]; printf("Enter x\n"); scanf("%d ",&x); printf("Enter y\n"); scanf("%d",&y); printf("Enter z\n"); scanf("%d",&z); printf("Enter the lab allocated for ACE training\n"); scanf("%s",lab); if(strcmp(lab,"L1")==0) { if(y<z) { printf("L2 has the minimal...
C
#include <stdio.h> #include <stdbool.h> int main () { char c1 = 'a'; printf("Ϊ%d\n",sizeof(c1)); //1 short s1 = 20; printf("Ϊ%d\n",sizeof(s1)); //2 int i1 = 225; printf("Ϊ%d\n",sizeof(i1)); //4 long l1 = 333333333; printf("Ϊ%d\n",sizeof(l1)); //4 long long ll...
C
#include "STC15Wxx.h" #include "INTRINS.h" sbit Trig = P1^1; sbit Echo = P1^0; bit busy; unsigned char IntCnt=0; unsigned int distance=0; //延时1MS void DelayXms(int x){ //@12.000MHz unsigned char i, j; while(x--){ i = 12; j = 169; do{ while (--+j); } while (--i); } } //延时1us void Delay1us(){ //@12....
C
#ifndef CONCEPT_H #define CONCEPT_H /////////////////// // SDR Concept // /////////////////// //A concept named by a SDR //References// //-----------// #include "SDR.h" #include "Task.h" #include "AttentionValue.h" //Parameters// //----------// #define PRECONDITION_BELIEFS_MAX 512 #define POSTCONDITION_BELIEFS_MAX...
C
#include <stdio.h> int main(int argc, char *argv[]) { if(argc == 99) return 99; if(argv[0] != NULL){ argv[0] = NULL; argc = 0; } argc = main(argc + 1, argv); printf("%d bottle%c of beer on the wall\n", argc, argc == 1?'\0': 's'); ...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include "stack.h" #include <time.h> /*=============================================================== * * função : getnterms * .obtém o número de termos e de operações '?' na string de * entrada * input : * .len : tamanho da string d...
C
#include<stdio.h> #include<sys/socket.h> #include<stdlib.h> #include<string.h> #include<sys/un.h> int main() { int server_sockfd, client_sockfd; int server_len,client_len; struct sockaddr_un server_address; struct sockaddr_un client_address; unlink("server_socket"); server_sockfd = socket(AF_UNIX //domain ,...
C
#define _CRT_SECURE_NO_WARNINGS #include "Contact.h" void InitContact(Contact* pcon) { assert(pcon); pcon->sz = 0; memset(pcon->data, 0, sizeof(pcon->data)); } void ADDContact(Contact* pcon) { assert(pcon); if (pcon->sz == MAX) { printf("ͨѶ¼\n"); return; } //¼Ϣ printf(":"); scanf("%s", pcon->data[pcon->sz...
C
#include <stdio.h> int main(void) { int a[100],i,j,k,n,temp; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&a[i]); } scanf("%d",&k); for(i=0;i<k;i++) { temp=a[0]; for(j=0;j<n-1;j++) { a[j]=a[j+1]; a[j+1]=temp; } } for(j=0;j<n;j++) { printf("%d",a[j]); } return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* conv_str.c :+: :+: :+: ...
C
/***************************************************************************//** * \file error.h * * \brief Tratamiento de errores. */ #ifndef ERROR_H #define ERROR_H #include "tipos.h" /*===== Constantes ============================================================= */ /** * Este define pe...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include "methods.h" #define NUM_SCORES (5) int main() { char db[5] = "\\\\"; printf("\n\t\tWelcome to the Golf Handicap Calculator (C)\n"); printf("\n"); printf("\t\t # # \n"); printf("\t\t # GHC # \...
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: apacot * * Created on 19 novembre 2019, 13:10 */ #include <stdio.h> #include <stdlib.h> #include ...
C
#include<stdio.h> //输入一个数,判断该数是否是素数 int main(void) { int iNum = 0; int i = 2; printf("input a integer: "); scanf("%d",&iNum); getchar(); while(i < iNum) { if(iNum % i == 0) break; i++; } if(i >= iNum) printf("%d is primer number!\n",iNum); ...
C
#ifndef __SYMBOL_HASH_TABLE_H__ #define __SYMBOL_HASH_TABLE_H__ #include "symbol.h" #define HASH_TABLE_SIZE 499 /* Type: SymbolHashTable A hash table for holding symbols. */ typedef struct _SymbolHashTable { int size; int maxsize; Symbol ** symbols; } SymbolHashTable; SymbolHashTable * new_SymbolHashTable ...
C
#include "renderLoop.h" //#include "../GraphLib/include/graph.h" #include "unit.h" SDL_Surface* init(char* p_windowName, int p_resX, int p_resY) { SDL_Surface* window; if (SDL_Init(SDL_INIT_EVERYTHING) != 0) { printf("[-] ERROR - %s\n", SDL_GetError()); return NULL; } if (!IMG_Init(IMG_INIT_PNG)) { printf...
C
#include "commercially_acyclic.h" int isCommerciallyCyclic (Graph * graph) { int * visited = (int *)malloc(graph->listSize * sizeof(int)); int * cycleVertices = (int *)malloc(graph->listSize * sizeof(int)); int * leftTheWhile = (int *)malloc(graph->listSize * sizeof(int)); int cycleFoundFlag = -1, cycleFinishe...
C
/* A : [1 2 3 4 5 6] B : 1 */ /** * @input A : Integer array * @input n1 : Integer array's ( A ) length * @input B : Integer * * @Output Integer array. You need to malloc memory, and fill the length in len1 */ int* rotateArray(int* A, int n1, int B, int *len) { int *ret = (int *)malloc(n1 * sizeof(int)); ...
C
#include "../c1.h" #include <stdio.h> #define STACK_INIT_SIZE 100 #define STACKINCREMENT 10 typedef int SElemType; typedef struct{ SElemType *base; SElemType *top; int stacksize; }SqStack; Status InitStack_Sq(SqStack *S){ (*S).base = (SElemType*)malloc(STA...
C
#include "holberton.h" /** * powsqrt - search number of sqrt *@n: first entry point *@m: second entry point *Return: int */ int powsqrt(int n, int m) { if ((m * m) == n) { return (m); } else if ((m * m) < n) { return (powsqrt(n, m + 1)); } else { return (-1); } } /** *_sqrt_recursion - take the i...
C
#include <stdio.h> #include <signal.h> #include <glib.h> #include <glib/gprintf.h> #include <sys/types.h> #include <unistd.h> #include <signal.h> void print_t(); void trata_sigsev(int signum); int main() { //g_unix_signal_add(SIGSEV, trata_sigsev, NULL); signal(SIGSEGV, trata_sigsev); g_thread_init(NULL); g_threa...
C
#include <stdio.h> #include <conio.h> #include <stdbool.h> #include "symtabUtility.h" int main(){ struct node *root = NULL; root = enterSymbol(root, "ORANGE", 0x32, false); enterSymbol(root, "PEAR", 0x1C, true); enterSymbol(root, "1PEAR", 0x2A, false); enterSymbol(root, "PEACH", 0x60, true); enterSymbol(root,...
C
/* 堆实现优先队列 */ #include <stdio.h> int n = 0; struct argus{ int id; int period; int inti_period; }query[3001]; void swap(int a, int b){ query[0].id = query[a].id; query[0].period = query[a].period; query[0].inti_period = query[a].inti_period; query[a].id = query[b].id; query[a].period = query[b].perio...
C
// // Created by pang on 19-1-16. // #include "../pch.h" #include "smsh.h" #define is_delime(x) ((x)==' ' || (x)=='\t') char * next_cmd(char * prompt,FILE *fp){ char *buf; int bufspace = 0; int pos = 0; int c; printf("%s",prompt); while ((c=getc(fp)) != EOF){ if(pos+1>=bufspace){ ...
C
#include<stdio.h> #define min(a,b) (a<b)?a:b int main() { int n,i,k1,k2,p1,p2,sum; char arr[1005],brr[1005]; while(scanf("%d",&n)==1){ scanf("%s %s",arr,brr); sum=0; for(i=0; i<n; i++){ k1=(arr[i]-'0')+1; k2=(brr[i]-'0')+1; p1=abs(k1-k2); ...
C
#include <stdio.h> #include <string.h> /* Beskrivning Write a program in C for a 2D array of size 3x3 and print the matrix. First ask the user to enter all the enteries [i][j] and then print the array to the output. Print the array to the output like a table. E.g. 123 234 456 54 678 987 12 987 100 */ int ma...
C
#include <stdio.h> #include <string.h> int main() { long long int len_1,len_2,i,j,yes,flag,k,e=1000000,f=1000000; char ch1[e],ch2[f]; while(1){ gets(ch1); gets(ch2); len_1=strlen(ch1); len_2=strlen(ch2); yes=0; if(len_1<len_2){ f...
C
#include "matrix.h" #include "debounce_matrix.h" #include "timer.h" //debounce times in milliseconds. Note that keys are sent on first state change, //so there is no EMI protection. Actual debounce time is between (value) and (value - 1), //due to timer resolution. Relies on all your switches actualy being good. //In ...
C
#include<stdio.h> #include"nvector.h" #include"stdlib.h" nvector* nvector_alloc(int n){ nvector* v = malloc(sizeof(nvector)); (*v).size = n; (*v).data = malloc(n*sizeof(double)); if( v==NULL ) fprintf(stderr,"error in nvector_alloc\n"); return v; } void nvector_free(nvector* v){ free(v->data); free(v);} vo...
C
/* SCCS : @(#)unixtext.c 75.1 06/28/95 File : unixtext.c Author : Richard A. O'Keefe & Chung-ping Lan Purpose: Source code for unix text stream Copyright (C) 1990, Quintus Computer Systems, Inc. All rights reserved. */ #include <stdio.h> #if WIN32 #include <io.h> #else #include <unistd.h> #endif #inc...
C
#include<stdio.h> void main() { int x = 12, y = 7, z; z = x != 4 || y == 2; printf("Z = %d\n",z); } /* vivek@vivek-HIRAY:~/Desktop/CodeSnippets/c codesnippets/8july$ cc cs7.c vivek@vivek-HIRAY:~/Desktop/CodeSnippets/c codesnippets/8july$ ./a.out Z = 1 */
C
#if defined(__ARM_ARCH_6M__) /* Cortex-M0 это ARMv6-M, код для LPC1114 */ #define GPIO_DIR_REG 0x50018000 /* GPIO1DIR задает направление для блока GPIO 1 */ #define GPIO_REG_VAL 0x50013FFC /* GPIO1DATA задает значение для блока GPIO 1 */ #define GPIO_PIN_NO (1<<8) /* 8-й бит отвечает за 8-й пин */ #else ...
C
# time out class Solution { public: string longestPalindrome(string s) { int max = 0; int index_store = 0; int cur_len; for(int i = 1;i<s.size();i++) { int index = 1; cur_len = 1; for(int j=i;j-index >=0 && j+index < s.size();index++) ...
C
#include <stdio.h> #include <limits.h> #include <math.h> #include <assert.h> #include "simple-math.h" void division(int a, int b) { printf("Input two integers to divide\n"); scanf("%d%d", &a, &b); assert(b != 0); printf("%d/%d = %.2f\n", a, b, a/(float)b); printf("the program to perform division\n"); }
C
#include <unistd.h> #include <stdio.h> #include <sys/types.h> int main() { pid_t pid; char *argv[] = {"./pre", (char *)0}; char *argc[] = {"./sort", (char *)0}; int p[2]; if(pipe(p) == -1) perror("Pipe Failed."); pid = fork(); if(pid < 0) { printf("%...
C
#include<stdio.h> #include<stdlib.h> #include <string.h> #include<winsock.h> #pragma comment(lib,"Ws2_32.lib") void main(int argc, char * argv[]){ // Initialize winsock WSADATA wsData; WORD version = MAKEWORD(2,2); int wsok = WSAStartup(version, &wsData); if(wsok != 0){ printf("Can't...
C
#include<stdio.h> #include<math.h> #define MAX 100 int top=-1; float s[MAX]; float evaluate(float op1, float op2, char operator) { switch(operator) { case '+' : return op1+op2; break; case '-' : return op1-op2; break; case '*' : return op1*op2; break; case '/' :...
C
/* * File: rbt.c * Author: Ron F. <> * Last Modified: June, 2019 * Topic: RBT & Hash table * ---------------------------------------------------------------- */ #include "my_h.h" /* create a new node */ node* create_node(int data, char cp_word[MAX_WORD]) { node *new_node = (node*)mal...
C
#include <stdio.h> /* void maxPasajeros(int numPasajeros,int no){ int arr[10], i, j, c, heap_root, temp; //"no" va a ser el numero de simulaciones //aqui se ingresan los datos del heap for (i = 0; i < no; i++) scanf("%d", &arr[i]); for (i = 1; i < no; i++) { c = i; ...
C
#include <stdio.h> int a; int main(){ double b,c; printf("请输入c"); scanf ("%lf",&c); printf("这个小数是:%lf",c); a=c; b=c-a; printf("%lf的整数部分是:%d,小数部分是:%lf\n",c,a,b); return 0; }
C
/* ** EPITECH PROJECT, 2019 ** CPE_corewar_2019 ** File description: ** get_champion_color.c */ #include "my.h" #include "vm.h" int get_champion_color(vm_t *vm, champion_t *champion, int *color) { int i = -1; if (!vm || !champion || !color) return 84; while (++i < vm->nbr_champions) { if ...
C
#ifndef EXPRESSIONOFTREE_H_ #define EXPRESSIONOFTREE_H_ #include "TreeNode.h" /** * Concatenate expression with "," and with the string that the node represent * using the getExpressionOfTreeRec * * * @param * char* expression - the string which will be concatenated. * TreeNode* node - a pointer to a tre...
C
/*A priority queue is a data structure for maintaining a set S of elements, each with an associated value called a key. *A max priority queue supports the following operations: *INSERT(S, x) inserts the element x into the set S *MAXIMUN(S) returns the element of S with the largest key *EXTRACT-MAX(S) removes and re...
C
/** * In-memory cache of the persistent raft log stored on disk. */ #ifndef RAFT_LOG_H #define RAFT_LOG_H #include "../include/raft.h" /** * Initial size of the entry reference count hash table. */ #define RAFT_LOG__REFS_INITIAL_SIZE 256 void raft_log__init(struct raft_log *l); void raft_log__close(struct raft...
C
#define NULL ((void*)0) typedef unsigned long size_t; // Customize by platform. typedef long intptr_t; typedef unsigned long uintptr_t; typedef long scalar_t__; // Either arithmetic or pointer type. /* By default, we understand bool (as a convenience). */ typedef int bool; #define false 0 #define true 1 /* Forward d...
C
#include <sys/mntent.h> #include <stdio.h> #include <stdlib.h> static int show(const char *file) { struct mntent *me; FILE *f = fopen(file, "r"); if (!f) { perror("fopen() failed()"); exit(1); } printf("\nin %s:\n", file); while ((me = getmntent(f))) { printf("%s\t%s\t%s\t%s\t%d\t%d\n", me->mnt_...
C
#include <stdio.h> #include <math.h> void main() { int n; int i; float l; float d; float k; float s; printf("Ingrese la cantidad de numeros a evaluar: "); scanf("%i",&n); i=0; do { i=i+1; k=pow(i,3); printf("[%i]^3= %f ",i,k); }while(i!=n); l=1; s=0; do { s=s+l; l=l+2; d...
C
// // list.c // CG&V_LAB Draughts // // Created by Sahil Satishkumar on 18/04/15. // Copyright (c) 2015 Sahil Satishkumar. All rights reserved. // #include <stdlib.h> #include <stdio.h> #include "list.h" //functiile de prelucrare a cozii cu miscari void addTomList(int i, int j){ coada *t; t = (coada*)mall...
C
#pragma ident "@(#)base_conv.c 1.4 92/07/20 SMI" /* * Copyright (c) 1986 by Sun Microsystems, Inc. */ /* * Machine-independent versions of base conversion primitives. * Routines to multiply buffers by 2**16 or 10**4. Base 10**4 buffers have * b[i] < 10000, carry in and out < 65536. Base 2**16 buffers have b[i]...
C
/** * Implementation for ports.h **/ #include "ports.h" #include <fcntl.h> #include <errno.h> #include <pthread.h> #include <slack/map.h> typedef struct _port { int port; int proto; int pipe[2]; } port_t; Map *udp_ports = NULL; Map *tcp_ports = NULL; pthread_mutex_t tcp_lock = PTHREAD_MUTEX_INITIALIZER; pthrea...
C
#include <stdio.h> unsigned long faktoriyel_hesapla(int sayi); int main() { int sayi; printf("Lütfen faktöriyeli hesaplanacak sayiyi giriniz:"); scanf("%d",&sayi); for (int i = 1; i < sayi; ++i) { printf("%d sayısının faktöriyel Sonucu :%ld \n", i, faktoriyel_hesapla(i)); } return 0; }...
C
//Switch case to perform arithmatic operations #include<stdio.h> int main(){ float a,b; char operator; printf("Enter operand: '+', '-', '*', '/'\n"); scanf("%c", &operator); printf("Enter two number to perform arithmtic operations:\n"); scanf("%f %f", &a, &b); switch (operator) { case '...
C
#include <stdint.h> // A test case to test the simulator's EvenParity semantics // // After some changes to generalize LLVMPointer handling, we tickled some bad // behavior around this primitive (see #260). int __attribute__((noinline)) test_and_verify_parity(uint64_t x) { uint64_t stack_var; void* stack_addr = &...
C
#include <assert.h> #include "compiler.h" int E(); void STMT(); void IF(); void BLOCK(); int tempIdx = 1, labelIdx = 1; #define nextTemp() (tempIdx++) #define nextLabel() (labelIdx++) // #define emit printf int isNext(char *set) { char eset[SMAX], etoken[SMAX]; sprintf(eset, " %s ", set); sprintf(etoken, " %s...
C
//Count Number of Words in a String #include<stdio.h> int main() { char str[10000]; int itr,count; count=0; scanf("%[^\n]",str); for(itr=0;str[itr];itr++) { if(str[itr]==' ') { count++; } } printf("%d",count+1); }
C
#include<stdio.h> #include<stdlib.h> #include<math.h> #define MAX 100 int max(int a, int b, int c); int main(void) { /* code */ int n,a[100]; scanf("%d",&n); for(int i = 0; i < n; i++) { scanf("%d",&a[i]); } int count = 0; //判断是是否可以组成三角形:穷举两个条件 //1)两边之和大于第三边 //2)两边之差小于第三边 // for(int i = 0; i < n;i++) // ...
C
#include "internal.h" void expression() { parsePrecedence(PREC_ASSIGNMENT); } void binary(bool canAssign) { // Remember the operator. TokenType operatorType = parser.previous.type; // Compile the right operand. ParseRule* rule = getRule(operatorType); parsePrecedence((Precedence)(rule->precedence + 1)); ...
C
#include <stdio.h> void main() { char a[30] = "Hello World"; char *b = a; printf("%s\n", a); }
C
#include<stdio.h> #include<stdlib.h> #include<unistd.h> #include<string.h> #include<assert.h> #include<signal.h> void sig_fun(int sig) { printf("sig=%d\n",sig); } int main() { signal(SIGINT,sig_fun); while(1) { printf("main run\n"); sleep(1); } exit(0); }
C
/* * Criado em: 21 de 05 de 2019 * Autor: Equipe de desenvolvimento do SACODE (www.sacode.lesc.ufc.br) */ #include "mem_map.h" /*! \fn uint32_t read_ram_cel(uint32_t cel_data) \brief funcao criada por precaucao, apenas retorna o valor de um espaco de memoria da RAM \param cel_data: endereco de memoria (de...
C
#include<stdio.h> #include<string.h> void main() { int fact=1,i,a; printf("Enter the number:"); scanf("%d",&a); for(i=1;i<=a;i++) { fact=fact*i; } printf("%d",fact); }
C
#ifndef SCREEN_INTERACE_H #define SCREEN_INTERACE_H #include <SDL2/SDL.h> #include <stdio.h> void createWindow(); void cleanup(); bool stop(); // Screen dimension constants long x_res = 0; long y_res = 0; // The windwo we'll be rendering to SDL_Window* window = NULL; // VRAM Buffer SDL_Texture* display = NULL; //...
C
#include <stdio.h> #include <string.h> #include "../include/MyTypes.h" #include "../include/func.h" Status Matching(char line[], char *target) { int i = 0; int j = 0; int line_len = strlen(line); int target_len = strlen(target); while((i < line_len) && (j < target_len)) { if(line[i] == target[j]) { ...