language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <stdlib.h> #include <pthread.h> #include "CacheSimulator.h" #define MAX 10 struct memtrace_type { unsigned long addr; unsigned char flag; }; struct memtrace_buf_type { int pos; struct memtrace_type memtrace[MAX]; }; pthread_key_t keyp; pthread_once_t init_done = PTHREAD_O...
C
#include <mpi.h> #include <math.h> #include "func.h" const double EPS = 1e-10; int SolveSystem(int n, int* mass, double* a, double* b, double* x, double* y, double* answer, int my_rank, int p){ int i, j, k, l, rank, first, last, flag[1]; int first_row, last_row, max_rows; double tmp, maxi, norm =...
C
// // primitiveRoot.c // ElGamal // // Created by Rokia on 6/6/17. // Copyright © 2017 Rokia. All rights reserved. // #include "primitiveRoot.h" #include "RandomGenerator.h" #include <gmp.h> void primitiveRoot_g(mpz_t p,mpz_t g1,unsigned int bitLength) { mpz_t p2,G,val; mpz_inits(p2,G,val,NULL); //...
C
#include <stdio.h> #include <stdlib.h> #ifndef STACK_H_INCLUDED #include "stack.h" #endif // STACK_H_INCLUDED //#ifndef MERGE_H_INCLUDED //#include "merge.h" //#endif // MERGE_H_INCLUDED #define exch(A,B) {int t = A; A = B; B=t;} void swap(int* x,int* y) { int tmp = *x; *x = *y; *y = tmp; retu...
C
#include "server.h" #include <stdio.h> void test_server_1(void) { printf("TEST_SERVER_1\n"); Server server = server_create(30, 10, 3); printf("Created\n"); server_destroy(server); printf("Destroyed\n"); } void test_server_2(void) { printf("TEST_SERVER_2\n"); Server server = server_create(3...
C
#include<stdio.h> #include<stdlib.h> typedef int TD; typedef struct list { TD node; struct list * next; }List; List *ph; List *create(TD val) { List *pnew; pnew= (List*)malloc(sizeof(List)); pnew->node = val; pnew->next = ph->next; return pnew; } List * push(TD val) { List *pc; pc = create(va...
C
/*************************************************************** main.c Handles the boot process of the ROM. ***************************************************************/ #include <libdragon.h> #include "debug.h" /********************************* ...
C
/* ** EPITECH PROJECT, 2017 ** my_cook ** File description: ** main.c */ #include "all.h" static void my_cook(int *error) { game_t *game = init_game(error); if (!game || *error != 0) return; start_animation(game); main_menu(game); free_game(game); } static void usage(void) { my_putstr_fd("My cook is a game ...
C
# ident "a simple prog to emulate the functionality of ll | wc -l" # include <stdio.h> # include <stdlib.h> # include <unistd.h> # include <errno.h> # include <signal.h> int main () { pid_t pin; int pipe_fd[2]; if (pipe(pipe_fd) == -1) { perror("pipe"); exit (1); } if ((pin = fork()) == -1) { pe...
C
#include <stdio.h> #include <stdlib.h> #include <wiringPi.h> int main() { int wTrig = 15; int wEcho = 16; wiringPiSetup(); pinMode(wTrig, OUTPUT); // 트리거는 내보내는 방향이므로 OUTPUT : 측정신호발사 pinMode(wEcho, INPUT); // 반사 신호 검출 while(1) { digitalWrite(wTrig, LOW); delayMicroseconds(100); // 트리거 신호를 위한 초기화 digi...
C
#include <stdio.h> int solve1(long long a, long long b) { int score = 0; for (int i = 0; i < 40000000; i++) { a = (a * 16807) % 0x7fffffff; b = (b * 48271) % 0x7fffffff; if ((a & 0xffff) == (b & 0xffff)) { score++; } } return score; } int solve2(long long a,...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> struct corredor{ int id; char name[256]; char instituicao[256]; } corredor; void bubblesort_ID(struct corredor *vector, int tam){ int aux_int, i, j; char aux_string[256]; for(i=tam-1; i >= 1; i--){ for(j=0; j < i ; j++){ ...
C
#ifndef AWS_COMMON_XML_PARSER_H #define AWS_COMMON_XML_PARSER_H /** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/common/array_list.h> #include <aws/common/byte_buf.h> #include <aws/common/exports.h> struct aws_xml_parser; struct aws_...
C
#include<unistd.h> #include<stdlib.h> #include<stdio.h> #include<string.h> #include<sys/types.h> #include<sys/ipc.h> #include<sys/sem.h> #include<sys/shm.h> #include<errno.h> #include<sys/msg.h> #define NOT_READY -1 #define FILLED 0 #define TAKEN 1 #define GO 2 #define STOP 3 struct ints{ int num1, num2; }; struc...
C
#include <stdlib.h> #include <string.h> #include <pthread.h> #include "boots.h" #include "bts_htab.h" #include "bts_bucket.h" void htab_free(htab_t *htab) { int i = 0; if (NULL == htab) { return; } if (htab->buckets) { for (i = 0; i < htab->size; i++) { bucket_clean(&htab-...
C
#include<stdio.h> void getLPS(char *,int); //function to get LPS array ie. values correspoinding to largest length of same prefix or suffix pattern .. void findMatch(char *,char * , int , int); // to find if pattern matches or not .. int lps[10]; main() { char pat[10]; char text[10]; int m =0 , n=0 , i=0; gets(p...
C
#include<stdio.h> void main() { int a,count=0; printf("enter the number"); scanf("%d",&a); while(a>0) { a=a/10; count++; } printf("%d",count); }
C
/* CH-230-A a4 p8.c Amartya Vats a.vats@jacobs-university.de */ #include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> void print_matrix(int a[30][30], int n){ printf("The entered matrix is:\n"); for (int i=0; i<n; i++){ for (int j=0; j<n; j++){ printf("%d ", a[i][j])...
C
#include "encoder.h" int _is_in_array(char n, char* arr, int len) { if(arr == NULL || len == 0) return -1; int i; for(i=0; i<len; i++) { if(*(arr+i)==n) return 1; } return -1; } int _make_encode_array(char* arr, char* password) { if(password==NULL || arr==NULL) return -1; if(st...
C
/* File: list.c Abstract: Generic Linked-List ADT handling implementation */ #include "list.h" #include <stdio.h> #include <stdlib.h> #include <string.h> /*structs*/ struct List_ { PNode Head; CLONE_ELEM cloneElem; DESTROY_ELEM destroyElem; COMPARE_ELEM compareElem; PRINT_ELEM pri...
C
/* ** por compatibilidad se omiten tildes ** ================================================================================ TRABAJO PRACTICO 3 - System Programming - ORGANIZACION DE COMPUTADOR II - FCEN ================================================================================ definicion de las rutinas de at...
C
#include <assert.h> #include <stdio.h> #include "minmax_list.h" #include "test_utils.h" void test_get_min_singleton() { printf(" verifying min of [1] is 1...\n"); minmax_list *p_list = singleton_list(); assert (get_min(p_list) == 1); printf(" min of [1] is 1: OK!\n"); } void test_get_min_si...
C
#include <stdio.h> #include "MK64F12.h" #include "GPIO.h" #include "RGB.h" #include "DataTypeDefinitions.h" int main(void) { GPIO_clockGating(GPIO_A); /*Habilitamos los clocks de los puertos A,B,C y E*/ GPIO_clockGating(GPIO_B); GPIO_clockGating(GPIO_C); GPIO_clockGating(GPIO_E); GPIO_pinControlRegisterType pi...
C
/* backup - backup a directory Author: Andy Tanenbaum */ /* This program recursively backs up a directory. It has two typical uses: * * 1. Backing up a directory to 1 or more diskettes * 2. Backing up RAM disk to a shadow directory on hard disk * * The backup directory or medium may be empty, in which case, the...
C
#include <stdlib.h> #include <stdio.h> #include <ctype.h> #include <string.h> #include "Estructura.h" eEmpleado* eEmpleado_nuevo(void) { eEmpleado* pNuevo = (eEmpleado *)malloc(sizeof(eEmpleado)); return pNuevo; } eEmpleado* eEmpleado_nuevoParametrizado(char* idStr, char* nombreStr, char* direccionStr, char* ...
C
#include <stdio.h> #include <assert.h> // calculate_mode возвращает моду из массива а. // вместо точки с запятой открывайте фигурные скобки и пишите ваше решение. int calculate_mode(int n, int a[n]){ int count1 = 0; int count2 = 0; int moda = a[0]; int std = 0; int g = 0; int j; int i; for( j =...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* enemy_action.c :+: :+: :+: ...
C
#include <stdio.h> #include <sys/types.h> #include <sys/wait.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <dirent.h> #include <memory.h> #include <errno.h> #include <time.h> #include <sys/types.h> #include <grp.h> #include <assert.h> #include <signal.h...
C
#include<stdio.h> #include<stdlib.h> void displays(int vin, float dist, float elapsed_time, float *ave_speed) { *ave_speed = dist/elapsed_time; printf("Vehicle ID: %d\n", vin); printf("Distance : %f km \n", dist); printf("Elapsed time: %f hours\n ", elapsed_time); printf("Average speed: %f km/h\n", *av...
C
#include <sys/types.h> //Basic System Data types #include <sys/socket.h> // Structure needed by socket #include <netinet/in.h> //sockaddr_in() and other internet definitions #include <arpa/inet.h> //inet(3) functions #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <string...
C
#include "ft_ls.h" void read_filesystem(char *direct, char **files, char **directories, char *flags) { DIR *dir; struct dirent *entry; char temp[1024]; int f; int d; f = 0; d = 0; ft_bzero(temp, 1024); if (!(dir = open...
C
#include"stdio.h" void main() {int b,c,n,i=1,j=1; printf("һΪĸÿÿո"); scanf("%d",&n); scanf("%d,",&c); while(i<=n-1) {scanf("%d,",&b);if(b<c) {c=b;j=i+1;} i++; } printf("\n\nmin is %d\nand it is the %d one\n\n",c,j); }
C
// 11. Crie um aplicativo de conversão entre as temperaturas Celsius e Farenheit.Primeiro o usuário deve escolher se // vai entrar com a temperatura em Célsius ou Farenheit, depois a conversão escolhida é realizada através de um comando SWITCH. // Se C é a temperatura em Célsius e F em farenheit, as fórmulas d...
C
#include <FS.h> #include <SPIFFS.h> #include <ArduinoJson.h> //Variables DynamicJsonDocument config(3500); bool setupFile(){ log_i("begin filesystem SPIFFS"); if (!SPIFFS.begin(true)) { log_e("SPIFFS Mount Failed"); printOledTextSingleLine("Falha ao montar SPIFFS"); return false; } log_i("begin ...
C
#include<stdio.h> int main(void) { char str[80], *pstr; int i, j, k, m, e10, digit, ndigit, a[80], *pa; printf("Input a string:\n"); /*********Found************/ gets(str); printf("\n"); pstr = &str[0]; /* ַָpstrstr׵ַ */ /*********Found************/ pa = a; /* ָpaa׵ַ */ ndigit = 0; /* ndigitжٸ...
C
#include <stdio.h> int main() { int arr[10] = { 5, 10, -1, -4, 7, 9, 2, 3, 20, 15 }; int arrsize = sizeof(arr) / sizeof(int); int min = 0, i, j; for (i = 0, j = 1; i < arrsize; i++, j++) { int t = j; while (t < arrsize) { if (arr[min] > arr[t]) min = t; t++; } int temp = arr[i]; ...
C
#define _CRT_SECURE_NO_WARNINGS 1 #include<stdio.h> //int main() //{ // int n = 0; // scanf("%d", &n); // int i = 0; // int x = 0; // int count = 0; // int a[50] = { 0 }; // for (i = 0; i < n; i++) // { // scanf("%d", &a[i]); // } // scanf("%d", &x); // for (i = 0; i < n; i++) // { // if (a[i] == x) // { // count...
C
#ifndef REDBLACK_H #define REDBLACK_H #include "../nstl-types.h" #define destroy_rb(RB) destroy_rb1(RB) #define destroy_rb(RB,D) destroy_rb2(RB,D) /* * A node with a payload pointer. Can be used for regular trees and map * lookups. Can be used for a key/value structure */ struct Red_black; typedef struct Red_bla...
C
#include <stdio.h> #include <stdlib.h> void ShellSort(int* a, size_t n, size_t h) { int i, j, t; for (i = h; i < n; ++i) { j = i; t = a[i]; while (j >= h && t < a[j - h]) { a[j] = a[j - h]; j -= h; } a[j] = t; } } ...
C
#include "futils.h" #include <stdio.h> #include <stdlib.h> bool read_file_to_buffer(const char* filename, char** buffer, size_t* len) { if (!(buffer && len)) { return false; } bool result = false; size_t string_size = 0, read_size = 0; FILE* file = fopen(filename, "r"); if (file) { ...
C
#include <stdio.h> #define BITS_IN_INT (int)sizeof(int) * 8 /*--------------------------------------------------------- convert_2_binary: inserts the binary value of the decimal into an array Takes 2 arguments: -a size 32 int array for holding 1s and 0s -a decimal int that is to be converted to binary ----------...
C
#include <stdio.h> char* myitoa(int n, char* str); char* myitoa(int n, char* str) { int i = 0, temp; int dec = 1, count = 1;//因为求余时个位数也需要算进去,所以count得从1开始 if(n < 0) { str[i++] = '-'; n = -n; } temp = n; do { dec *= 10; temp /= 10; count++; }while(temp > 10); // printf("temp = %d\n",temp); whil...
C
#include "../include/string.h" void *memset(void *dst, int c, size_t sz) { while (--sz >= 0) *((int*)dst+sz) = c; return dst; } int memcmp(void *s1, void *s2, size_t sz) { }
C
#include<stdlib.h> #include<stdio.h> // using namespace std; struct node{ float coeff; int expo; struct node * link; }; struct node* insert(struct node* head,float co,int ex) { struct node* temp; struct node*newP=malloc(sizeof(struct node)); newP->coeff =co; newP->expo=ex; newP->link=N...
C
/* * Host Dispatcher Shell Project for SOFE 3950U / CSCI 3020U: Operating Systems * * Copyright (C) 2015, <GROUP MEMBERS> * All rights reserved. * */ #include <stddef.h> #include <stdlib.h> #include <stdio.h> #include <stdbool.h> #include <unistd.h> #include <signal.h> #include <sys/types.h> #include <sys/wait.h...
C
#include "stdio.h" #include "string.h" #include "stdlib.h" #include "unistd.h" #include "miss.h" //栈 Status Stack_Init(STACK *obj,unsigned int deep) { obj->data = (ELEMENT_TYPE*)malloc(sizeof(ELEMENT_TYPE)*deep); memset(obj->data,0,sizeof(ELEMENT_TYPE)*deep); if(obj->data != NULL) { obj->data =...
C
/* Kunci Soal M7 by David Fauzi */ // Header #include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct // Queue { int front, rear, size; unsigned capacity; int *array; } Queue; // FUNGSI-FUNGSI QUEUE // Membuat queue Queue *createQueue(unsigned capacity) { Queue *...
C
#include <stdio.h> #include <stdlib.h> typedef struct { void *buf; unsigned int size; unsigned int head, tail; } dft_buffer; int dft_buffer_init(dft_buffer *, unsigned const int); int dft_buffer_read(dft_buffer *, void *, unsigned const int); int dft_buffer_write(dft_buffer *, void *, unsigned const int); int dft_...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_unsg.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include "biblio.h" /*−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− Prototipo : Labirinto* LeLabirinto(const char*); Funcao : Recebe o argumento "argv[1]" que contem o labirinto problema e lê e aloca todos os dados contid...
C
/* ========================================================================== */ /* Projet : biblClient */ /* -------------------------------------------------------------------------- */ /* client.c : fonctions de gestion du fichier client ...
C
#include <pthread.h> #include <stdio.h> #include <stdlib.h> #include <math.h> #include <time.h> #include <stdlib.h> #include <zconf.h> #include "FileBuffer.h" #define NUM_THREADS 4 #define SIZE_OF_BUFF 5 FileDeq *fileDeq; void writeToFile(FileBuff *buff,void *args) { printf("writing\n"); fprintf(buff->filePtr,...
C
/* * Program with solution to Ques 9 * Compilation- gcc -o base32_to_base64 base32_to_base64.c * Execution- ./base32_to_base64 * Dushyant Batra, (1910990098), 18/08/2021 * Assignment 3 (Bits and Bytes) */ #include<stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> //returns the character corresp...
C
/** * helpers.c * * Helper functions for Problem Set 3. */ #include <cs50.h> #include <stdio.h> #include "helpers.h" /** * Returns true if value is in array of n values, else false. */ bool search(int value, int values[], int n) { sort(values, n); int min = 0; int max = n - 1; while (...
C
#define P 15 #define Q 16 #define F (1 << Q) #define CONVERT_TO_FP(n) ((n) * (F)) #define CONVERT_TO_INT_TOWARD_ZERO(x) ((x) / (F)) #define CONVERT_TO_INT_NEAREST(x) ((x) >= 0 ? ((x) + (F) / 2) / (F) : ((x) - (F) / 2) / (F)) #define ADD(x, y) ((x) + (y)) #define SUB(x, y) ((x) - (y)) #define ADD_INT(x, n) ((x) ...
C
/* 1: gcc -Wall -ansi -O2 1.c -lpthread 2: ./a.out test1.txt */ #include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <errno.h> #define GRID_W 9 #define GRID_H 9 #define BLOCK_OFFSET 3 #define EXPECTED_SUM (GRID_W * BLOCK_OFFSET) extern int errno; int SUM_THREAD = 0; pthread_mutex_t SUM_THREAD_...
C
/** * @brief Some mathematical processing functions * @param Mathematical variables to process * @retval Processing the completed mathematical results * @author ZCD * @Time 2020 1 11 */ #include "User_Math.h" #include "math.h" #include "stdlib.h" #include "stm32f4xx_hal.h" /** * @brief Numerica...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* check_input.c :+: :+: :+: ...
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 x, y; printf("Digite um numero:"); scanf("%d",&x); if(x<1){ y = x; printf("\nImprimindo y: %d",y); } else if(x == 1){ y = 0...
C
/* * Copyright 2016 Aaron Barany * * 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/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> double factorial(int n); double e_a_la_x(int x, int tol); int main() { int num, tol; printf("Ingrese un numero y una tolerancia: \n"); scanf("%d",&num); scanf("%d",&tol); printf("\nEl numero calculado es %lf", e_a_la_x(num,tol))...
C
#include <stdio.h> #include <stdlib.h> int main() { int sayi,a,b,c,d,e,f; printf("4 basamakli bir sayi giriniz : "); scanf("%d",&sayi); a=sayi%10; b=(sayi%100)-a; c=((sayi%100)-a)/10; d=(sayi%1000)-(a+b); e=((sayi%1000)-(a+b))/100; f=(sayi-(a+b+d))/1000; if(((f*10)...
C
#include <stdio.h> #include <stdlib.h> #include <mpi.h> #include <math.h> #include <stdbool.h> #include <string.h> MPI_Status status; size_t n, m; size_t TIME; int process_rank, process_number; const double K = 401.0 / (8960.0 * 380.0); double H; double TAU; struct Cell { size_t width; size_t height; int nu...
C
#include<stdio.h> int main() { int i; float marks[5]={}; printf("Enter name of student\n"); for(i=0;i<5;i++) { scanf("%f",&marks[i]); } for(i=0;i<10;i++) { printf("%.2f",marks[i]); } }
C
#include<stdio.h> int main(void){ int sa = 5050,sb = 0; for(int i = 1;i<=100;i++){ sb += i*i; printf("%d\n",sb); } printf("%d\n",sb); sa = sa*sa; printf("%d\n",sa-sb ); return 0; }
C
/* Author: Nishan Ghimire Roll no : 210316(BE/D) Question Print all armstrong number */ # include<stdio.h> # include<math.h> int main(){ int sum,num,n,terms,rem; terms = 999; for (int i = 100; i < terms; i++) { sum = 0; n = i; while (n > 0) { rem = n%10; ...
C
/*----------------------------------------------------------------------------- ** Copyright (C) 2001 Radical Entertainment Ltd. All rights reserved. ** ** winutil.h ** ** Description: A set of utilities which are specific to the windows development ** environment. ** ** Modification History: ** + Create...
C
#pragma once #ifndef BASE64_H #define BASE64_H size_t base64_encode_s(unsigned char *out, const unsigned char *src, size_t len, size_t line_max); /** * base64_encode - Base64 encode * @src: Data to be encoded * @len: Length of the data to be encoded * @out_len: Pointer to output length variable, or %NULL if not u...
C
#include <stdio.h> int main() { int rollno[50],marks[50],i,n; printf("\nEnter number of students: "); scanf("%d", &n); for(i=0;i<n;i++) { printf("Enter Roll of Student [%d] : ",i+1); scanf("%d",&rollno[i]); printf("Enter Mark of Student [%d]: ",i+1); scanf("%d",&marks[i]); ...
C
/* BP: Entrenamiento de redes neuronales feedforward de 3 capas (entrada - oculta - salida). Algoritmo: Backpropagation estocastico. Capa intermedia con unidades sigmoideas. Salidas con unidades lineales. PMG - Ultima revision: 18/02/2002 */ #include <stdio.h> #include <math.h> #include <stdlib.h> #include <time.h> #...
C
#include<stdio.h> double Temperature(double n); int main(void) { double fah, kel; int val; printf("Please enter a temperature in Fahrenheit: "); val = scanf("%f", &fah); while (val == 1) { kel = Temperature(fah); printf("%.2f F = %.2f K\n", fah, kel); printf("Enter another temperature in Celsius (q or ...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <string.h> #include "structs.h" #include "printer.h" #define MAX_BUFF 16 #define READ_STR "%15s" // ----- CREATORS FUNCTIONS Point *create_point(int x, int y); Map *create_map(int rows, int columns, FILE *input); // --------------------------------...
C
/************************************************************************* * Nazev projektu: Prekladac jazyka IFJ 2015 * * Soubor: Instruction_list.j (pomocny soubor) * * Autor: Martin Švec * Datum: 19. listopadu 2015 * Popis: Soubor obsahuje deklarace pomocnych funkci pro praci s instrukci paskou. * D...
C
#include <stdio.h> #include <stdlib.h> #include <locale.h> /* Karakterler \0 > sonlandırıcı karakter (null character) \a > çan sesi (alert) \b > geri boşluk (back space) \t > 1 tane tab kadar boşluk bırakır. (horizontal TAB) \n > Bir alt satıra geçer(new line) \v > düşey tab (vertical tab) \f > sayfa ileri (fo...
C
#include<stdio.h> #include<conio.h> double getfloat(); int main() /*Main is written to check the getfloat function*/ { double num; num = getfloat(); printf("\nNumber : %lf\n", num); _getch(); return 0; } double getfloat() { double num = 0; char number[20]; scanf("%s", number); sscanf(number, "%lf"...
C
#include <stdio.h> #include <locale.h> void main() { int num1, num2; setlocale(LC_ALL,"Portuguese"); printf("Me diga dois nmeros e eu colocarei \n"); printf(" os dois em ordem crescente \n"); printf("\n Primeiro nmero: "); scanf("%d",&num1); printf("\n Segundo nmero: "); scanf("%d",&num2...
C
#include "fila.h" int Menu(); void Coloca(); void Tira(); Aluno a; int main(){ init(); Menu(); } int Menu() { int resp; while(TRUE) { printf("\n---------------------------------------\n1-Colocar Aluno\n2-Retirar Aluno\n3-Terminar\n---------------------------------------\nDigite:"); ...
C
/* * ===================================================================================== * * Filename: stdio.c * * Description: 输入输出函数的定义与实现 * * Version: 1.0 * Created: 2014年11月17日 20时45分19秒 * Revision: none * Compiler: gcc * * Author: Shui(dubingyang), du...
C
#define _XOPEN_SOURCE #include <stdio.h> #include <stdlib.h> //#include <pthread.h> #include <unistd.h> #include <string.h> //#include <crypt.h> tylko dla crypt_r int main(int argc, char ** argv) { char * pass = NULL; char * salt = NULL; int opt; opterr = 0; while((opt = getopt(argc, argv, "p:s:"))!= -1) { s...
C
/* * throttle_data.c * * Created on: Mar 8, 2017 * Author: xuefei1 * * Status: C */ #include "throttle_data.h" //index 0 to 90, representing 0 to 90 degree of throttle plate travel //the value at index i and value at index i+1 indicates if APPS value is within this range //then the throttle plate wil...
C
//4 #include <stdio.h> int main () { int x, result; while (1) { printf("Enter a mark: "); result = scanf("%d", &x); if (result) { if (x == 0) { break; } if (x > 100 || x < 0) { printf("Wrong Mark:%d\n" ,...
C
#include <stdio.h> // Needed for exit() #include <stdlib.h> #include <string.h> void doWhile(); int globalVar = 0; int main() { char name[17]; printf("What's your name? "); fgets(name, 30, stdin); printf("Hello %s\n\n", name); printf("\n"); char wholeName[17] = "Satoshi Nakamoto"; int primeNumbers...
C
#include "HAL_GPIO.h" /*************MODER configuration*************/ static void HAL_Config_Mode(GPIO_TypeDef *port , uint32_t pinNumber , uint32_t mode_type) { uint32_t bitNumber; bitNumber = pinNumber * 2; // Bit number for GPIO MODE register switch(mode_type) { // (0b00) case INPUT_ANALOG: port->MODER &...
C
/************************************************************************* > File Name : acm1029.c > Author : enjoy5512 > Mail : enjoy5512@163.com > Created Time : 2016年12月20日 星期二 14时53分46秒 ************************************************************************/ #include...
C
/*############################################################################### Kodierung: UTF-8 ohne BOM ###############################################################################*/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <math.h> #include "vektoren.h"...
C
#include <stdio.h> #include <stdlib.h> #include "stack.h" int main() { int i; int a[10] = {12,4354,657,876,2433,23,18,943,54,8}; Stack S = malloc(sizeof(struct Node)); S = CreateStack(); for(i=0;i<8;i++){ Push(a[i],S); } Pop(S); int b = Top(S); printf(...
C
/* PostScript graphics - * This provides a bit of a shell around writing graphics to * a postScript file. Perhaps the most important thing it * does is convert 0,0 from being at the bottom left to * being at the top left. */ #ifndef PSGFX_H #define PSGFX_H #include "psPoly.h" struct psGfx /* A postScript outp...
C
/* #include<stdio.h> #include<stdlib.h> #include<conio.h> #define PASS 1 #define FAIL 0 void display_menu(); int check_PW(); void check_balance(); void deposit(); void withdraw(); int main() { int service; int balance = 0; printf("츮 ý 湮 ּż մϴ."); do { display_menu(); printf("ϴ 񽺸 ϼ."); scanf("%d", &servi...
C
#include <string.h> #include <stdio.h> #include <molerat/base.h> #include <molerat/queue.h> void queue_init(struct queue *q, unsigned int max_size) { q->capacity = 8; q->items = xalloc(q->capacity * sizeof *q->items); q->read = q->write = 0; q->max_size = max_size; wait_list_init(&q->waiters, 0); q->waiters_sta...
C
#include "skynet.h" #include "skynet_module.h" #include "spinlock.h" #include <assert.h> #include <string.h> #include <dlfcn.h> #include <stdlib.h> #include <stdint.h> #include <stdio.h> #define MAX_MODULE_TYPE 32 struct modules { int count; struct spinlock lock; const char * path; struct skynet_module m[MAX_MO...
C
/*5.5m ~n ֮*/ #include<stdio.h> int main(void) { int m,n,i; int factorsum(int t); printf("Input m: ");scanf("%d",&m); printf("Input n: ");scanf("%d",&n); for(i=m;i<=n;i++) { if(i==factorsum(i)) printf("%5d",i); } return 0; } /*tӺ*/ int factorsum(int t) { int sum=0,i; if(t==1) sum=1; for(i=1;i<t;i++) {...
C
#include <ctype.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #define ARG_LENGTH_MIN 2 #define ARG_LENGTH_MAX 6 typedef void (*sig_handler_t)(int); static void exit_sig_handler(int sig) { (void)sig; exit(EXIT_SUCCESS); } static void print_usage(cha...
C
#include <stdio.h> int main (void) { int rows; int number; char t[1000]; char c; scanf("%d",&rows); getchar(); while (rows--) { while(fgets(t,1000,stdin) != NULL) { //printf("%s",t); //printf("%c",t[2]); scanf("%d",&number); getchar(); t[number] = '\0'; printf("%s",...
C
/**********************************************/ rational * rational_assign(rational * data, rational * y) { integer_destroy(data->num); integer_destroy(data->den); data->num = integer_copy(y->num); data->den = integer_copy(y->den); rational_normalize(data); return data; }
C
#include "winctl.h" #include "taskbar.h" #include <stdlib.h> static bool winctl_left_btn_handler(xtk_spirit_t *spirit, void *arg) { winctl_t *winctl = (winctl_t *) arg; if (!winctl) { return false; } uview_msg_t msg; if (winctl == taskbar.last_winctl) { /* 隐藏/显示 */ if (winct...
C
#include "render.h" #include "scene.h" #include "intersection.h" #include "maths.h" #include "config.h" #include "utils.h" #include "queue.h" #include "photon.h" #include <stdio.h> #include <pthread.h> #include <stdlib.h> struct thread_input_data { int x; int y; bool last; }; struct thread_output_data { int ...
C
/* * Copyright (C) 2013-2015 The Android Open Source Project * * 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/licenses/LICENSE-2.0 * * Unless required b...
C
/* program that declares a variable n, forks a new process and prints “Hello from parent [PID - n]” and “Hello from child [PID - n]” from parent and child processes respectively. */ #include <stdio.h> #include <unistd.h> #include <sys/types.h> void main(void) { pid_t n; int m = fork(); n = getpid(); if (m == 0)...
C
#include "ft_includes.h" void ft_error(void) { ft_putstr("Error\n"); } int main(int argc, char **argv) { char **res; int *tab_possibility; int **arr; tab_possibility = NULL; if (argc == 2) res = ft_split(argv[1]); arr = ft_tab_init(); if (argc != 2 || ft_check_error(argv[1]) == 0) ft_error(); else { ...
C
/* * maps.h * * Created on: 08.05.2018. * Author: student */ #include<stdbool.h> #ifndef MAPS_H_ #define MAPS_H_ #define SIZEROW 15 #define SIZECOLUMN 20 struct Level { unsigned char initial_map[SIZEROW][SIZECOLUMN]; int start_row; int start_column; }; // Map 1 struct Level level1 = { .initial_...