language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* * Copyright (c) 2002, Intel Corporation. All rights reserved. * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com * This file is licensed under the GPL license. For the full content * of this license, see the COPYING file at the top level of this * source tree. * Test pthread_cancel * It may retu...
C
#include <stdio.h> #define LEN 30 struct string { char String[LEN]; } #define ITEM(T) \ _Generic((T), struct string \ : struct string, default \ : int, float \ : float, double \ : double, long \ : long)...
C
#include "sym_table.h" #include <string.h> #include <stdlib.h> #define MAX_SIZE_VAR 50 #define MAX_LENGTH_VAR 20 static Var val_array[MAX_SIZE_VAR]; static int var_num = 0; Var create_var(char *name,float value,int level) { //printf("create new var-------\n"); Var newvar = val_array[var_num]; //printf("111111111-...
C
#include<stdio.h> int checkPrime(int number); int checkArmStrong(int number); int main(){ int number,flag; printf("Enter a number:"); scanf("%d",&number); flag=checkPrime(number); if(flag==1) printf("Number is Prime\n"); else printf("NUmber is not prime\n"); flag=checkArmStron...
C
/* * For each file specified on the command line, this program will * read the file, determine the left margin (minimum number of spaces * appearing on each non-trivial line), and then remove that number * of spaces from each line. Does not handle tabs. * * Used to compress long, formatted text files. Released ...
C
// Shell. #include "types.h" #include "user.h" #include "fcntl.h" // Parsed command representation #define EXEC 1 #define REDIR 2 #define PIPE 3 #define LIST 4 #define BACK 5 #define MAXARGS 10 struct cmd { int type; }; struct execcmd { int type; char *argv[MAXARGS]; char *eargv[MAXARGS]; }; s...
C
#include <stdio.h> #include "structbib.h" typedef struct { char** string; int quantidade; int capacidade; } lista_string; lista_string* Criar(int cap){ typedef struct { char** string; int quantidade; int capacidade; } lista; li...
C
#include "tscheme.h" static int get_char(FILE *stream) { int c = getc(stream); return c; } static void unget_char(int c, FILE *stream) { ungetc(c, stream); } static int peek_char(FILE *stream) { int c = get_char(stream); unget_char(c, stream); return c; } static bool delimiter_p(int c) { return isspace(c) ...
C
/* * main.c * * Created: 12/15/2016 9:22:55 PM * Author: Benjamin Sejdic & George Albert Florea */ #include "TestButtons.h" #include "../src/asf.h" #include "../delayFunctions.h" int main(void) { /* Initialize the SAM system */ SystemInit(); board_init(); sysclk_init(); pinMode(GREEN_BUTTON, INPUT); /* set gr...
C
#include <stdint.h> #include <stdio.h> #include <util/delay.h> #include <avr/io.h> #include "lcd_driver.h" #include "port_macros.h" #include "go2.c" int main() { // Initializing the buttons unsigned int last_left_button_state = (PINB & (1 << 1)); unsigned int left_button_pressed = 0; unsigned int last_right_butto...
C
/* tpblockscope3.c: block scope test for switch */ int main() { int a = 1; int b = 1; int c = 2; switch (a) { case 0: { int a = 20; int b = 30; a = a + 1; b = 10; c = a + b; } break; case 1: { int a = 50; int b = 60; a = a + 1; b = 20; c = a + b; } b...
C
#ifndef MOTORS_H #define MOTORS_H #include "mseduino.h" #include "hall.h" #define FOREVER ~(0(size_t)) #define TURN_TICKS 6 #define MOTOR_LEFT_A J28 #define MOTOR_LEFT_B J26 #define MOTOR_RIGHT_A J25 #define MOTOR_RIGHT_B J24 #define CLIMB_MOTOR_A J22 #define CLIMB_MOTOR_B J21 #define LEFT_REVERSE 1 #define LEFT...
C
#include "deqll.h" #include <stdio.h> #include <stdlib.h> #include <assert.h> // DO NOT MODIFY THIS STRUCTURE struct dllnode { int item; struct dllnode *prev; struct dllnode *next; }; // DO NOT MODIFY THIS STRUCTURE struct dequeue { struct dllnode *front; struct dllnode *back; }; // dequeue_create() creat...
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
#ifndef U_NODE_H #define U_NODE_H #ifdef __cplusplus extern "C" { #endif struct XNode { char ip[15]; int port; char name[256]; }; typedef struct XNode * XNodePtr; /*! \fn int node_from_string(const char * str, XNodePtr p) * \brief Create nodes from a XML string. * \param str a XML string. * \para...
C
if (true) { print(true); } else { print(false); } int i = 0; while (i < 10) { print(i); i++; } int i = 0; int N = 2; while (i < N) { print("i"); print(i); int j = 0; while (j < N) { print("j"); print(j); int k = 0; while (k < N) { print("k"); print(k); k++; } j++; } i++; }
C
#include "lists.h" /** * insert_dnodeint_at_index - insert new node at a given index * @h: pointer to first node passed by reference * @idx: index in which is going to be inserted the node * @n: value to insert in that node * Return: address of new node on success otherwise NULL */ dlistint_t *insert_dnodeint_at_...
C
#include "ft_printf.h" void ft_format_p(int *count, va_list *argc) { unsigned long point; point = (unsigned long)va_arg (*argc, void *); write (1, "0x", 2); (*count) += 2; ft_putpoint(point, count); }
C
#include <stdio.h> int main() { int i; /* i : variable de type entier */ int j; /* j : variable de type entier */ i = 22; /* i vaut 22 */ j = i; /* on recopie la valeur de i dans j donc j vaut aussi 22 à présent */ printf ("i vaut %d\n", i); /* Affiche la valeur de i */ printf ("i + j va...
C
#include <stdio.h> #include<string.h> #pragma warning (disable:4996) // ڷ н带 Է ޾Ƽ ġϸ α ޼ // ġ ޼ Բ 3ȸ н带 Է¹ް void main() { const char* my_password = "sonbc"; char input_password[30]; int index; const int max_counter = 3; for (index = 0; index < max_counter;index++) { // printf("н带 Էϼ: "); fputs("йȣ Էϼ: ...
C
#include<stdio.h> main() { int i,j,k,n; int G[100][100],temp[100][100]; //freopen("in.txt","r",stdin); scanf("%d",&n); for(i=0; i<n; i++) for(j=0; j<n; j++) { scanf("%d",G[i]+j); temp[i][j]=G[i][j]; } for(i=0;i<n;i++) for(j=0;j<n;j++) ...
C
#include <sys/types.h> #include <sys/stat.h> #include <sys/uio.h> #include <unistd.h> #include <fcntl.h> #include <stdlib.h> /** * read_textfile - reads a text file and prints the contents to STDOUT * @filename: the filename * @letters: number of letters * Return: the number of letters read and printed, 0 on failu...
C
/** * math sample * 2020-07-01 K.OHWADA */ // expm1: // computes the e (Euler's number, 2.7182818) raised to the given power arg, minus 1.0 // https://en.cppreference.com/w/c/numeric/math/expm1 #include <stdio.h> #include <stdlib.h> #include <math.h> /* * main */ int main(void) { for(int i=0; i<11; i++)...
C
/* * lapack_dgttrf.c * *This program is a C interface to dgttrf. * * Written by Remi Delmas. * */ #include "../include/lapack_f77.h" #include "../include/lapack_enum.h" #include "../include/lapack_aux.h" void lapack_dgttrf(const int n, double * dl, double * d, double * du, double * du2, int * ipiv, int * info ...
C
/*compile-errors:*/ /*compile-result:1*/ /*save-event:compile*/ #include<stdio.h> int main() { int y; scanf("%d",&y); //stores the year { if(y%4==0) //divisiblity by 4 { if(y%100==0) //divisiblity by 100 {if(y%400==0) //divisiblity by 400 printf("Le...
C
#include<stdio.h> int x,y,z; int find(int x,int y,int z); find(int x,int y,int z) { int i,t,s,days=0; if(x%4==0)t=1; else t=0; for(i=1;i<y;i++) { if(i==2)s=2-t; else s=0;days=days+30+i%2-s; } days=days+z; return(days); } void main() { int year,month,date,day;scanf("%d%d%d",&year,&month,&date)...
C
#include <stdio.h> int main(int argc, char **argv) { int i; unsigned int val; argc--; argv++; if (!argc) { printf("Usage: bits hex-val\n"); return 1; } printf("\t\t"); for (i = 31; i >= 0; i--) { printf(" %2d", i); if (i && !(i&0x7)) printf(" | "); } printf("...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #define MAX 100 typedef struct{ char marca[30]; char placa[9]; char modelo[50]; int tipoMarcha; // 1=Auto, 2=Manual int qtdPortas; } Veiculo; Veiculo criarVeiculo(char* placa, char* modelo, char* marca, int qportas, int tmarcha){ Veiculo v; strcpy(v....
C
#include <stdio.h> int main(){ int p[2][10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int n, i, j, sum = 0, max = 0; for(i = 0; i < 10; i++){ scanf("%d", &p[0][i]); sum = sum + p[0][i]; } for(i = 0; i < 10; i++){ for(j = 0; j < i; j++){ if(p[0][i] == p[0][j]) p[1][j]++; } } ...
C
#ifndef __CONNECTION_H__ #define __CONNECTION_H__ #define MAX_REMOTE_CONNECTIONS_ALLOWED 1 /** Démarre le mode télécommande \param port Port sur lequel écouter password Mot de passe permettant de se logger \return 0 si tout est ok */ int start_remote_control( unsigned int port, char* password ); /** Arrête le mode...
C
// // pwm.c // cxg-60ewt // // Created by Leonid Mesentsev on 26/11/2019. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rig...
C
#include <stdio.h> #include <stdlib.h> struct Node { int data; struct Node*left; struct Node*right; }; struct Node*root=NULL; void insert() { int key; struct Node*p=(struct Node*)malloc(sizeof(struct Node)); struct Node*r,*t=root; printf("Enter the value\n"); scanf("%d",&key); p->dat...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> int main(int argc, char *argv[]) { char buff[30]; strcpy(buff,argv[1]); printf("\n%s\n",buff); return 0; }
C
#include "ftp.h" int FtpLogByteSizeSet(int Bytesize) { if(Bytesize > MAXBZ) return 0; ByteSize = Bytesize; return 1; } void get_current_time(char* time_str) { time_t timep; struct tm * p; time(&timep); p = localtime(&timep); sprintf(time_str,"%d%d%d%d%d"...
C
# include<stdio.h> # include<stdlib.h> int map[5][5]; int dir[4][2]={1,0,-1,0,0,1,0,-1}; struct node { int x,y; }; struct node queue[50],record[5][5]; void bfs() { int head,tail,i; struct node now,next; head=tail=0; now.x=queue[tail].x; now.y=queue[tail].y; tail++; while(head<tail) {...
C
#include<stdio.h> #include<stdlib.h> typedef struct data { char ch; struct data *next; }data; typedef struct list { data *head, *tail; }list; void init(list *l); void enlist(list *l, char ch); void remov(list *l, char ch); int searchlist(list *l, char ch); int isempty(list *l); int charsearch(list *l, char ch); int ...
C
int main() { int a[2][1000],i=0,j,c=1000,b=0,m[1000]={0}; while(1) { cin>>a[0][i]; if (cin.get() =='\n') break; i++; } i = 0; while(1) { cin>>a[1][i]; if (cin.get() =='\n') break; i++; } for(j=0;j<=i;j++) { if(a[0][j]<c) c=a[0][j]; if(a[1][j]>b) b=a[1][j]; ...
C
/* Программа 03-1.с – пример создания нового процесса с одинаковой работой процессов ребенка и родителя */ #include <sys/types.h> #include <unistd.h> #include <stdio.h> int main() { pid_t pid, ppid; int a = 0; (void)fork(); /* При успешном создании нового процесса с этого места псевдоп...
C
/* ** EPITECH PROJECT, 2018 ** nm objdump ** File description: ** nm get sections */ #include <string.h> #include <stdio.h> #include "nm.h" static int get_sections32(elf_t *elf, char *file) { int i = -1; int ret = 0; size_t size = 0; Elf32_Shdr start = elf->shdr32[elf->ehdr32->e_shstrndx]; char *str = (char *)((...
C
#include <errno.h> #include <stdio.h> #include <unistd.h> int main() { char BUFF[1024]; int lu; while ((lu = read(3, &BUFF, 1024)) > 0) { int a_ecrire = lu; char *pos = BUFF; while(a_ecrire) { int ecrit = write(1, pos, a_ecrire); a_ecrire -= ecrit; pos += ecrit; } } if (lu...
C
#include <stdio.h> #include <stdlib.h> #include "lists.h" /** * print_dlistint - fucntion to print all elemnnt of DLlist * @h: head of the list * Return: number of nodes */ size_t print_dlistint(const dlistint_t *h) { const dlistint_t *p = NULL; int i = 0; p = h; while (p) { printf("%d\n", p->n); p = p-...
C
#include <stdio.h> #include <stdlib.h> typedef struct network{ double d; double * p_d; } network; void hello(){ printf("hello\n"); } network * get_net(){ network * net = malloc(sizeof(network)); return net; } void free_net(network * net){ free(net); } int main(){ hello(); network * net = ...
C
/* ** EPITECH PROJECT, 2018 ** flags.c ** File description: ** first part of flags */ #include <stdarg.h> void my_putchar(char c); int my_put_nbr(int nb); int my_putstr(char const *str); int flags_with_base_management(int argument, va_list display); int easy_flags_management(int argument, va_list display) { switc...
C
#include "Wave.h" #include "delay.h" void Wave_Init() { GPIO_InitTypeDef GPIO_InitStructure; TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure; NVIC_InitTypeDef NVIC_InitStructure; RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE); //ʱʹ RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); //ʹA˿...
C
#include <stdio.h> #include <string.h> #include <math.h> #include <ft2build.h> #include FT_FREETYPE_H #include <freetype/ftglyph.h> #define TTF_PI 3.1415926535 #define FT2_SRC_COLOR_KEY 0x1000 /* (ṩӿڸû): 1. ֵɫ : Ĭλɫ 2. ǷЧ : Ĭϲ÷ЧΪЧҪĿռ 3. ת : ĬΪתûתǶȣΧ0360 4. Ƿʾ : ĬΪʾ 5. Ƿֱʾ ...
C
#include "ft_ultimate_div_mod.c" #include <stdio.h> int main() { int a=6, b=2; ft_ultimate_div_mod(&a, &b); printf("a=%d %d\n", a, b); // printf("a=%d\n", a); return 0; }
C
/* ---------------------------------------------------- */ /* Displaying all System V message queues on the system */ /* -----------------------------------------------------*/ #define _GNU_SOURCE #include <sys/types.h> #include <sys/msg.h> #include "tlpi_hdr.h" int main(int argc, char* argv[]) { int maxind, ind,...
C
// Swapping two numbers #include <stdio.h> int main() { int x,y,temp; printf("Enter the value of x and y\n"); scanf("%d%d",&x,&y); printf("Before swapping\nx=%d\ny=%d\n",x,y); temp = x; x = y; y = temp; // Using temp to swap storing x to temp and y to x then moving temp to y printf("After Swapping\nx=%d...
C
const char base64_charset[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789" "+/"; /* base64_decode: Description: Encode a char array to a base64 encoded string Parameters: ...
C
#include "holberton.h" /** * _strlen - Calculate the lenght of a string * @s: The array to be evaluated * * Return: On success 1. * On error, -1 is returned, and errno is set appropriately. */ int _strlen(char *s) { int i = 0; while (s[i] != '\0') i++; return (i); } /** * append_text_to_file - Append cont...
C
#include "linkedList.h" #include <opencv2\highgui\highgui_c.h> /* Gets a linked list of frames and prints every frame details input: The first node of a FrameNode linked list */ void printFrames(FrameNode* head) // O(n) { FrameNode* current = head; printf("\t%-20s%-20s%-20s\n", "Name", "Duration", "Path"); while...
C
/* * Main program to benchmark hash functions * Part of the xxHash project * Copyright (C) 2019-2021 Yann Collet * GPL v2 License * * This program 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; either...
C
/***************************************************************************** * | File : OLED_Driver.c * | Author : Waveshare team * | Function : 0.9inch OLED using SSD1306 control * | Info : *---------------- * | This version: V1.0 * | Date : 2018-04-17 * | Info : Basic vers...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> void selection_sort (long int v[], int size) { int i, j, posMenor = 0; long int temp; for (i = 0; i < size - 1; i++) { posMenor = i; for (j = i + 1; j < size; j++) { if (v[j] < v[posMenor]) posMenor = j; } temp = v[i]; v[i] = v[posMenor];...
C
#include "stdafx.h" #include "resource.h" #include "GameBoard.h" /*****************************************Ϸ****************************************/ struct GameBoard* New_GameBoard(HWND parent/**/, int x, int y, int nWidth, int nHeight) { WNDCLASSEX wndClass = {sizeof(WNDCLASSEX)}; struct GameBoard* gameB...
C
#include<conio.h> #include<stdio.h> #include<stdlib.h> int main() { float matrizA[3][3]; float matrizAB[3][4] = {{3,2,4,1},{1,1,2,2},{4,3,-2,3}}; float vetorX[3]; float pivo = 0, m = 0; int i, j, k; int ordem = 3; for(i=0; i<ordem; i++) { pivo = matrizAB[i][i]; for(j=0; j<=ordem; j++) ...
C
/** * set_bit - Sets the value of a bit to 1 at a given index. * @n: Number to Modify. * @index: Index of the bit to be set to 1. * Return: 1 if success, -1 if not. */ int set_bit(unsigned long int *n, unsigned int index) { if (index >= 64) return (-1); *n |= 1 << index; return (1); }
C
#define _CRT_SECURE_NO_WARNINGS 1 // versionĿ # include <windows.h> # include <iostream> # pragma push_macro // ý̺Ͳϵͳİ汾Ϣļʾ void main() { // ȡ̵ID DWORD dwIdThis = ::GetCurrentProcessId(); // һ̺ͱİ汾ҲԷ0Աָһ DWORD dwVerReq = ::GetProcessVersion(dwIdThis); WORD wMajorReq = (WORD)(dwVerReq>16); WORD wMinorReq = (WORD)(d...
C
#include <stdio.h> double calc(char op, double num1, double num2); int main() { char op; double num1; double num2; printf("Select operand to use (+, -, *, /):\n"); scanf(" %c", &op); // " %c", space needed to get char printf("Input first number:\n"); scanf("%lf", &num1); printf("Input second number:\...
C
// (C) 2021 Quenio. Licensed under CC0 1.0: https://creativecommons.org/publicdomain/zero/1.0 #include <stdio.h> int main() { int count = 0; int c; while ((c = getchar()) != EOF) { if (c == '\n') { count++; } } printf("line count = %d\n", count); }
C
/* * Copyright (c) 1991 Michael Landy * * Disclaimer: No guarantees of performance accompany this software, * nor is any responsibility assumed on the part of the authors. All the * software has been tested extensively and every effort has been made to * insure its reliability. */ /* * greybar - generate a r...
C
/* ** my_strcmp.c for my_strcmp in /home/thibrex/delivery/CPool_Day06/tests ** ** Made by Cornolti Thibaut ** Login <thibrex@epitech.net> ** ** Started on Mon Oct 10 11:28:45 2016 Cornolti Thibaut ** Last update Sun Nov 6 22:27:33 2016 yann probst */ int my_strcmp(char *s1, char *s2) { int i; i = 0; while...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_single_arg_arr.c :+: :+: :+: ...
C
#include "edicao.h" void alocarMemoria(Ptr_imagem ptr_imagem) { ptr_imagem->pixel = (Pixel **) malloc(ptr_imagem->alt * sizeof(Pixel *)); for (int i = 0; i < ptr_imagem->alt; i++) { ptr_imagem->pixel[i] = (Pixel *) malloc(ptr_imagem->larg * sizeof(Pixel)); } } bool isppm(char *caminhoImagem) { ...
C
/* c6-5.h Ķ(ӣֵ)洢ʾ */ typedef struct CSNode { TElemType data; struct CSNode *firstchild,*nextsibling; }CSNode,*CSTree;
C
/* switch statement: as the declaration of the case labels */ #include <stdio.h> void keyword_case(void) { enum { AIRPLANE, CAR, TRAIN } tool = 0; switch (tool) { case AIRPLANE: printf("airplane\n"); break; case CAR: printf("air\n"); break; case TRAIN: printf("train\n"); break; default: printf("un...
C
#include "linked_list.h" #include "stddef.h" #include "stdlib.h" #include "stdio.h" /* create a new node */ /* returns a pointer to the newly created node */ /* print an error message and return NULL if an error occurs */ Node *initialise_node(void) { Node *node; node = (Node*) malloc(sizeof(Node)); if (nod...
C
#define ex1 #include <stdio.h> #include <stdlib.h> #include <conio.h> #include <locale.h> #ifdef ex1 /*1 - Escreva um programa que receba uma letra via teclado. Escreva uma funcao que pesquise esta letra dentro do vetor abaixo. Imprima o resultado da pesquisa no video na funcao main(). Passe como informacao pa...
C
#include<stdio.h> #include<string.h> int calc(int a, int b, char ch) { switch(ch) { case '+': return a+b; case '-': return a-b; case '*': return a*b; case '/': return a/b; default: return 0; } return 0; } void write_file () { FILE *fp = fopen("...
C
#include <stdio.h> int main() { int sum = 0, num, success_input; printf("һ<q>"); success_input = scanf("%d",&num); while (success_input = 1) //ע!Ӧsuccess_input == 1 { sum += num; printf("һ<q>"); success_input = scanf("%d",&num); } printf("ܺ%d\n",sum); return 0; }
C
#include <stdio.h> main(){ int contador; contador=0; for(contador = 0; contador < 100000; contador++) { printf("%d\n", contador); } }
C
/*-----------------------------------------------------------------------*/ /* Low level disk I/O module skeleton for FatFs (C)ChaN, 2013 */ /*-----------------------------------------------------------------------*/ /* If a working storage control module is available, it should be */ /* attached to t...
C
/* ======= TYPEDEF ======= -Similar to the symbolic name */ #include <stdio.h> typedef int* INT_POINTER; //synonim typedef struct date DATE; struct date { int day; int month; int year; }; struct person { char firstname[11]; char surname[21]; struct date DOB; }; main() { int *p1; int *p2; //same as bel...
C
#include "app/plane.h" #include "app/airline.h" #include "communication/plane.h" #include <stdlib.h> #define CHECK_EXIT(r) {if((r) == -1) {print_error("Read invalid message in plane\n");pthread_exit(0);}} #define echo(msg) mprintf("[%d] "msg"\n", self->plane->id) #define SafeActionWithClean(block, onexit) { \ if...
C
/*Matrix addition,subtraction and multiplication Program*/ #include<stdio.h> void add( int a1[2][2], int a2[2][2]); void subtract(int a1[2][2], int a2[2][2]); void multiply(int a1[2][2], int a2[2][2]); int main() { int arr1[2][2], arr2[2][2]; int i,j; /* take input in both the array */ printf("Enter f...
C
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #include <openenclave/host.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "run_u.h" int main(int argc, const char* argv[]) { oe_result_t r; oe_enclave_t* enclave = NULL; const oe_enclave_type_t type = OE_ENC...
C
#include<stdio.h> #include<string.h> #include<cs50.h> int main() { // Character string of curtain size char text[100]; int j=0; // Taking input for text while(text[j-1] != '\n') { if( text[j-1] == '\b') { text[j-1] = '\0'; j = j-2; } text[j] = getchar(); j++; }...
C
#include "labData_2D.h" /*-----------------------------------------------------------------------------*/ /* Fichier source pour la création, l'affichage et le mise à jour du tableau 2D*/ /*-----------------------------------------------------------------------------*/ /*Fonction qui va initialiser notre tableau en 2...
C
#include<stdio.h> void main() { //һЩҪõIJ int number,i,j,temp; //ֵʼ i=0; //һ16λŶʼΪ0 int array[16] = {0}; printf("please input a number:"); scanf("%d",&number); temp = number; //%2 while(temp != 0) { array[i] = temp % 2; //ģ2㣬ֵ temp = temp / 2; i++; } // for (j = 15; j >= 0; j--) { printf("%d",...
C
/* bluepp 2014-06-21 2014-07-23 May the force be with me! Problem: Reverse Linked List II Source: https://oj.leetcode.com/problems/reverse-linked-list-ii/ Notes: Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Given 1->2->3->4->5->NULL, m =...
C
/****************************************************************************** * Copyright (C) 2017 by Alex Fosdick - University of Colorado * * Redistribution, modification or use of this software in source or binary * forms is permitted as long as the files maintain this copyright. Users are * permitted to mod...
C
/* * misc.h * * Created on: May 29, 2016 * Author: Aymeric Genet */ #ifndef MISC_H_ #define MISC_H_ #define MAX_SAMPLE_DIGIT 6 #include "math.h" #include <stdio.h> /* * Initializes the reading of a file containing random elements. Typical uses * include "/dev/random" and "/dev/urandom". * * @return ...
C
#include<stdio.h> #define MAX 5 int main() { int i,j; int space=0; /*run loop (parent loop) till number of rows*/ for(i=MAX;i>0;i--) { /*print first set of stars*/ for(j=0;j< i;j++) { prin...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> #include <math.h> #include "ManipSeqSimple.h" // Affiche la chaine de caractères seq de longueur lg void AfficheSeq(char seq[], int lg){ int i; for (i=0; i<lg; i++) { printf("%c", seq[i]); } printf("\n"); } // Affiche la chaine...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<sqlite3.h> static int callback(void *not_used, int argc, char **argv, char **col_name) { static print_head = 0; int i; #if 1 if(0 == print_head) { for(i = 0; i < argc; i++) { printf("%s\t",col_name[i]); } pri...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> struct street { int from, to, number; } streets[2048]; int comp[64]; int use[64]; int count; void print() { int i, j, k; struct street s; for(i = 0; i < count; i++) streets[i].number = i + 1; for(i = 0; i < count; i++) { j = rand() % count; k ...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> typedef enum { false, true } bool; void swapInt(int *a, int *b){ int tmp = *a; *a = *b; *b = tmp; } void bubbleSort(int *arr, int n){ if (n == 1) return; bool swapped = false; for (int i = 0; i < n - 1; ++i) { if (arr[i...
C
/* getchʹʾ ṩVisual C++MS-Windows/MS-DOS */ #include <conio.h> #include <ctype.h> #include <stdio.h> int main(void) { int ch; int retry; do { printf("밴"); ch = getch(); printf("\nµļ%cֵ%d\n", isprint(ch) ? ch : ' ', ch); printf("һΣYN"); retry = getch(); if (isprint(r...
C
#include <GL/gl.h> #include <GL/glu.h> #include <GL/glut.h> #include <stdio.h> #include <math.h> #include <stdlib.h> #include <string.h> /* Initialize variables needed for animation */ float spinX = 0.0; float spinY = 0.0; float zoomIn = 0.0; float zoomOut = 0.0; /* Initialize material property and light source....
C
#include<stdio.h> int main() { int l; int b; int m; float f; int a; printf("enter the numeber of length \n"); scanf("%d\n",&l); f=l*b; printf("the value of leangth in meeter is %d \n",m); printf("enter the numeber of breath\n"); scanf("%d\n",&b); m=0.305*...
C
void ft_putchar(char c); int g_countW; int g_countL; char g_text; char g_space; char g_dash; char g_space1; char g_vertical; void ft_length(int x) { while (g_countL < x) { if (g_countL % x == 0) { ft_putchar(g_text); g_countL++; if (g_countL == x) { ft_putchar(g_space); ...
C
/** @file AzElPa.h * @brief Function prototypes for the calculation of * azimuth, elevation and partials from local tangent coordinates. * * This header file contains the prototypes for the calculation of * azimuth, elevation and partials from local tangent coordinates. * * @author Miguel Alonso Angu...
C
#include <stdio.h> #include <ctype.h> #include "graph.h" #include "judge.h" #include "minePopulation.h" #include <stdbool.h> #include <math.h> /* int hash (char query[],int width,int height){ char queryLow[100]; char row[100]; int length=0; int coloumn; for (int i = 0; query[i]; i++) { quer...
C
int main() { int i = 0; int j = 123; double a = 1.5; float b = 2.2; double c = a + b; // 3.7 double d = b - a; // 0.7 double e = b / a; // 1.4666666666666666666666666666667 double f = a * b; // 3.3 double g = j + a; // 124.5 double h = j + b; // 125.2 //printf("c: %e d: %e e: %e f: %e...
C
#include "sort.h" /** * insertion_sort_list - Function that ordered doubly linked list, * that oredered acsending * @list: Paremeter doubly linked lict * Return - None */ void insertion_sort_list(listint_t **list) { listint_t *forward = NULL, *backward = NULL, *a = NULL, *b = NULL, *c = NULL, *d = NULL; if...
C
#include "List.h" #include <stdlib.h> #include <stdbool.h> #include <stdio.h> typedef struct ListElement { int value; int frequency; struct ListElement* next; } ListElement; typedef struct List { ListElement* head; } List; bool isEmpty(List* list) { return (list == NULL || list->head == NULL); } int getTheValu...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* deal_with_map_directory.c :+: :+: :+: ...
C
#ifndef TURBOISO_H #define TURBOISO_H struct MatchingOrderPair { vector<NECNode*>* q; ULONG score; }; struct RankingPair { QueryNode* v; double score; }; /* * Sorts for min-pq. TODO : verify min pq not max pq */ struct CompareRankingPair { bool operator()(const RankingPair* p1, const RankingPai...
C
/* /osxptb/trunk/PsychSourceGL/Source/OSX/Eyelink/EyelinkMessage.c PROJECTS: Eyelink AUTHORS: f.w.cornelissen@rug.nl fwc E.Peters@ai.rug.nl emp PLATFORMS: All. HISTORY: 15/06/06 fwc Adapted from early alpha version by emp. 19-06-11 mk Refactored to share parser with othe...
C
//http://code.kx.com/wiki/Cookbook/ExtendingWithC#High_Precision_wall_time_on_Linux #include"k.h" #include<time.h> //this is the version from the kx wiki //K x param is not used as this is going to be nilladic function K getTime(K x){ struct timespec ts; clock_gettime(CLOCK_REALTIME,&ts); R ktj(-KP,(ts.tv_sec-10...