language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#ifndef _INCLUDED_QUADTREE_H #define _INCLUDED_QUADTREE_H typedef struct _quadtree_node_t { struct _quadtree_node_t *parent; float side_length; // cells are square int num_items; // if 1, this node is a leaf, else an internal node float mass; // total mass of this cell (sum of...
C
#pragma once #include "Types.h" #include <math.h> #define M_PI 3.1415926535897932 #define M_DEG_TO_RAD(deg) deg/180 * M_PI #define M_RAD_TO_DEG(rad) rad/M_PI * 180 union v2 { v2() : x(0.0f), y(0.0f) {} v2(r32 x, r32 y) : x(x), y(y) {} struct { r32 x; r32 y; }; struct { r32 u; r32 v; }; inl...
C
#include<stdio.h> #include<stdlib.h> #define LOAD_FACTOR 20 struct ListNode { int key; int data; struct ListNode *next; }; struct HashTableNode { int bcount; struct ListNode *next; }; struct HashTable { int tsize; int count; struct HashTableNode **Table; }; struct HashTable* CreateHashTable(int size) { struct ...
C
#include <mpi.h> #include <stdio.h> int main(int argc, char *argv[]) { int rank; MPI_Comm cart; MPI_Init(&argc, &argv); MPI_Comm_rank(MPI_COMM_WORLD, &rank); int dims[] = {4, 3}; int periods[] = {1, 0}; MPI_Cart_create(MPI_COMM_WORLD, 2, dims, periods, 1, &cart); int coords[2]; for (int i = 0; i < 1...
C
#pragma once #define MAX_BUFF_SIZE 4096 typedef struct buffer_s { unsigned char* bytes; size_t size; unsigned int r_point; unsigned int w_point; } buffer; int read_from_buffer(void* stream, void* to, size_t r_size); int write_to_buffer(void* stream, const void* from, size_t w_size); int skip_buffer_r...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* process_map.c :+: :+: :+: ...
C
uint32_t reverseBits(uint32_t n) { uint32_t counter = 0; int multi = 31; while(multi > -1) { counter += (n % 2) * (uint32_t)pow(2, multi); n = n >> 1; multi--; } return counter; }
C
#include<stdio.h> int main(void){ int i,x,y,tmp_x,x2,y2; scanf("%d %d",&x,&y); scanf("%d %d",&x2,&y2); tmp_x=x; for(i=1;tmp_x>=y-x;x=x*i) i++; printf("%d %d",i,y-x); return 0; }
C
#include <stdio.h> #define LIMIT 1000 int wordlength(int natural); int main() { long sum; int i; i = 0; sum = 0; while (++i <= LIMIT) { printf("%d\n", wordlength(i)); sum += (long) wordlength(i); if (!(i%10)) { printf("--- br ---\n"); } } printf("The sum is: %ld\n", sum); return 0; } int wordle...
C
#include <stdio.h> #include <stdlib.h> void print_matrix(int** A, int col, int row); //Функция для печати матрицы int main(int argc, char *argv[]) { if (argc!=3){ printf("A data-entry error. \n"); //Проверка количества данных, введеных через консоль return EXIT_FAILURE; } FILE* matrix_1 = fopen (argv[1],"r")...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* utils2.c :+: :+: :+: ...
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 <stdio.h> int main() { int arr[] = {1,2,3,4,5,6,34,52,20,45,33}; //to get the sizeof arr int n = sizeof(arr)/sizeof(arr[0]); printf("Size of an array:%d",n); return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_itoa_other.c :+: :+: :+: ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* fill_objects_part2.c :+: :+: :+: ...
C
#include<stdio.h> main( ) {int a,b=0,c,d=1,e,n,i; scanf("%d",&n); for(a=n;a>=1;a--) { b=b+1; for(i=1;i<=a-1;i++) {printf(" "); } for(c=b;c>=1;c--) { printf("%d",d); d++; printf(" "); } printf("\n"); }}
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> //project includes #include <persist.h> int createDb() { int cr; cr = sqlite3_open(DB, &db); if (cr) { fprintf(stderr, "%s %s\n", CNTCREATE, sqlite3_errmsg(db)); sqlite3_close(db); return 0; } char *zErrMs = 0; if(!createBookTa...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <sys/stat.h> #include <dirent.h> #include <unistd.h> #include <time.h> #include <sys/types.h> #include <sys/wait.h> #include <fcntl.h> #include <ctype.h> #include "board.h" #include "play.h" int main(int argc, char * argv[]){ sran...
C
#ifndef FORCES_H #define FORCES_H #include "Kernels.h" #include "Globals.h" // -------------------------------------------------------------------------- __device__ __forceinline__ void applyMassScaling(float4& predictedPosition) { predictedPosition.w = (M_E, -5 * predictedPosition.y); } // -------------------...
C
#include <stdio.h> #include <stdbool.h> #include <math.h> bool validatedata(int a, int b) { if (a <= 0 || b <= 0) { printf("Do dai 1 canh khong the bang 0\n"); return false; } else { return true; } } float tinhcanhhuyen(int a, int b) { return (float) (sqrt(a * a + b * b)); } i...
C
void selectSort(int array[], int size) { for ( int i = 0; i < size; i++ ) { int min = i; for ( int j = i + 1; j < size; j++ ) { if ( array[j] < array[min] ) { min = j; } } if ( min != i ) { int temp = ar...
C
#include <stdio.h> int count=0; int ismulti(char *inp); int main() { char inp[1010]; register int res; while(scanf(" %[^\n]",inp)!=EOF) { if(inp[0]=='0' && inp[1]==0) break; count = 0; res = ismulti(inp); if(res>=0) printf("%s is a multiple of 9 and has 9-de...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <ctype.h> #include "shared.h" #include "parser_types.h" #include "parser_utils.h" static char * get_path(char * prototype_path, char * client_number); int strcicmp(char const *a, char const *b) { bool is_a_null = a == NULL; b...
C
// p_3.c // cl p_3.c #include <stdio.h> int main() { int i = 10; int* pi = &i; printf("%d \n", i); *pi = 999; printf("%d \n", i); return 0; }
C
#include "headers/sdl.h" #include "headers/openal.h" #include "headers/maze.h" #include <math.h> #define MIN(a,b) (((a)<(b))?(a):(b)) #define MAX(a,b) (((a)<(b))?(b):(a)) // OpenAL global variables ALuint source; ALuint buffer; EFXEAXREVERBPROPERTIES reverb; void action(int** maze, t_position player) { // On bo...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> #include "cliente.h" #include "funciones.h" static int proximoId(); static int buscarLugarLibre(Cliente* clientes,int limiteC); /** \brief Inicia cliente array * \param clientes Cliente* array clientes * \param limiteC cantidad de elemen...
C
#include "CmacAes.h" #include "CmacAesOps.h" #include <string.h> int CmacAes_Calculate(CMAC_AES_CALCULATE_PARAMS *params, uint8_t aes_cmac[16], size_t aes_cmac_len) { unsigned char K1[16] = {0}; unsigned char K2[16] = {0}; size_t n_blocks; bool is_complete_block; int ret; uint8_t iv[16] = {0};...
C
/* * network.c * * TM4C network driver * For use by the Serial Token Ring protocol * * Written by Tianshu Huang, April 2018 */ #include "network.h" #include "uart.h" #include "c_client.h" #include "../tm4c123gh6pm.h" #include "fifo.h" #include "../display/ST7735.h" #include "../controller/controller.h" // Ga...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <netinet/in.h> #include <arpa/inet.h> #include <sys/socket.h> #include <sys/types.h> #define PORT 8880 //端口号 #define BUFFER_SIZE 1024 //缓冲区大小 #define LISTEN_Q 20 //监听的队列数 int main(int argc, char *argv[]) { struct sockaddr_in se...
C
// Khoa Tran // CSE 374 HW 5 // 05/11/2020 // Purpose of main.c: // From words in a dictionary, match each word into // a numbered key sequence with letters representing // numbers from 2-9 and storing this data in a trie // data structure in order to preserve memory and // maintain common prefixes. Also, ask the user...
C
#ifndef ORDERED_WINDOW_SEQUENTIAL_DEPENDENCE_H_GUARD #define ORDERED_WINDOW_SEQUENTIAL_DEPENDENCE_H_GUARD #include <stdlib.h> #include "scorer/ScoringFunction.h" int* countOD(int** positions, int qlength, int gap) { int* tf = (int*) calloc(qlength - 1, sizeof(int)); int i, j, k; for(i = 0; i < qlength - 1; i++)...
C
#pragma once #include "Matrix3.h" struct Matrix4 { public: float _11, _12, _13, _14; float _21, _22, _23, _24; float _31, _32, _33, _34; float _41, _42, _43, _44; public: Matrix4() : _11(0), _12(0), _13(0), _14(0), _21(0), _22(0), _23(0), _24(0), _31(0), _32(0), _33(0), _34(0), _41(0), _42(0...
C
ElemType Comm_Ancestor(SqTree T, int i, int j){ if(T[i]!='#'&&T[j]!='#'){ while(i!=j){ if(i>j) i=i/2; else j=j/2; } return T[i]; } }
C
#include "symtab.h" #include<stdlib.h> #include<string.h> #include<stdio.h> extern Global_element* global; extern Function *funcs; Function * insert_Function_safe(char *name) { Function * aux; Function * new_Function = malloc(sizeof(Function)); new_Function->down = NULL; new_Function->name ...
C
#include<stdio.h> #include"binary_tree.h" int main() { TreeNode *tree = CreateTree("5", NULL, NULL); char arr[100]; while (1) { scanf("%s", arr); insertNode(arr, tree); traversal_inorder(tree); puts(""); traversal_inorder(LeftTree(tree)); puts(""); traversal_inorder(RightTree(tree)); puts(""); ...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> int count = 0; int avg = 0; double stdev(int seq[]); double dist(int seq[], double dev); void read(int N) { FILE *ptr; ptr = fopen("data", "r"); size_t nr; int seq[N]; int num; while(1) { nr = fread(&num, sizeof(int), 1, ptr); if (nr == 0...
C
// C Primer Plus // Chapter 13 Exercise 6: // Programs using command-line arguments rely on the user’s memory of how to // use them correctly. Rewrite the program in Listing 13.2 so that, instead of // using command-line arguments, it prompts the user for the required // information. #include <stdio.h> #include <stdl...
C
#include <stdio.h> #include <stdlib.h> #include "ships.h" const unsigned int xsize = 10; const unsigned int ysize = 10; const unsigned int shiplen = 3; /* implement these functions */ /* Task a: Place <num> ships on the game map. */ void set_ships(unsigned int num) { unsigned int x; unsigned int y; unsi...
C
/** Write a C program to input the base and sides of a triangle. Calculate the hypotenuse upto 2 decimal place. */ #include <stdio.h> #include <stdlib.h> #include <math.h> int main(int argn, char *argv[]) { int side1, side2; float hyp; if (argn != 3) { printf("Error: Needed lengths of both si...
C
#include <stdio.h> int main(void) { int height = 0, width = 0; FILE *fp = fopen("linux.bmp", "r"); fseek(fp, 0x12, SEEK_SET); fread(&width, 4, 1, fp); printf("Width of image is : %d\n", width); fclose(fp); }
C
#include "tags.h" #include <stdlib.h> #include <string.h> const struct object_vtable tag_vtable = { (void (*) (void *)) tag_delete, (void * (*) (const void *)) tag_copy, (int (*) (const void *, const void *)) tag_cmp }; struct tag * tag_create (const char * name, int type) { struct tag * tag = mallo...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* msh_handle_quote.c :+: :+: :+: ...
C
#include<stdio.h> int main() { struct SB { char num[100]; char c[100]; char name[100]; double grade1,grade2,grade3,ave; }hehe[500]; int i,N,max=0,count; scanf("%d",&N); for(i=0;i<N;i++) { scanf("%s%s%s%lf%lf%lf",hehe[i].num,hehe[i].c,hehe[i].name,&hehe[i].grade1,&hehe[i].grade2,&hehe[i].grade3); } for(i=0;...
C
#include<stdio.h> // ./first_line filename int main(int argc, char **argv) { // 0. Check that there are correct # of args. if (argc != 2) { fprintf(stderr, "Usage: %s <filename>\n", argv[0]); return 1; } // 1. Open the file. FILE *stream = fopen(argv[1], "r"); if (stream == NULL...
C
#ifndef __OPENCL_VERSION__ #include <stdio.h> #include <stdlib.h> #include <math.h> #include <float.h> #endif #include <sdirk.h> #define sdirk_uround() ( DBL_EPSILON ) /*void sdirk_setewt (__global const sdirk_t *sdirk, __global const double *y, __global double *ewt) { const int neq = sdirk->neq; for (int k ...
C
/******************************************** NAME : Jagajeevan.S DATE : 09.08.2021 DESCRIPTION : To take 8 consecutive bytes in memory. Provide a menu to manipulate or display the value of variable of type t (input) & indexed at i (i/p) INPUT & OUTPUT : Menu : 1. Add element 2. Remove element 3. Display element...
C
#include <stdlib.h> #include "../../infrastructure/dbg/dbg.h" #include "../../infrastructure/mem/mem.h" #include "../../infrastructure/validation/validation.h" #include "../../web_api/services/update_order_request.h" #include "../../web_api/services/update_order_request_order_item.h" // allocates an update order requ...
C
#include <stdio.h> #include <stdlib.h> int main() { int i, sum=0, sqsum=0; for(i=1; i<=100; i++) { sum += i; printf("%d\t", sum); sqsum += i*i; printf("%d\n", sqsum); } sum = sum * sum; int res = ((sum-sqsum)>=0) ? sum - sqsum : sqsum - sum; printf("\n%d\n", res)...
C
#include <stdio.h> int main() { int n, c, k; printf("Enter an integer in decimal number system\n"); scanf("%d", &n); printf("%d in binary number system is:\n", n); for (c = 31; c >= 0; c--) { k = n >> c; if (k & 1) printf("1"); else printf("0"); } printf("\n"); return 0; }
C
////////////////////////////////////////////////////////////////////////////// // // Filename: eeprom_bsp.c // // Description: Control driver for the PIC18F4550's internal EEPROM // // Author(s): Trevor Parsh (Embedded Wizardry, LLC) // // Modified for ASL on Date: // //////////////////////////////////////////////////...
C
#include<stdio.h> int * abc(void); main() { int *ptr; ptr=abc(); printf("%d\n",*ptr); } int * abc(void) { int number=10; return &number; }
C
#include <poyoio.h> void digital_write(int pin, int vol) { volatile char* output_addr = GPO_WRADDR; volatile int* input_addr = GPO_RDADDR; // 0ビット目は0ピンの状態、1ビット目は1ピンの状態というように値を格納しているので、 // ピンの値に応じたビットのみを変更する if (vol == 1) { *output_addr = (*input_addr | (1 << pin)); } else if (vol == ...
C
#include <stdio.h> double cube(double value); int main(void) { double input = 0.0; printf("Enter floating point value: "); while (scanf("%lf", &input) != 1) { while (getchar() != '\n'); printf("Enter floating point value: "); } printf("cube: %.2f\n", cube(input)); return ...
C
/** * @file stack.c - Ficheiro que contém todas as funções relacionadas com a stack * @copyright Copyright (c) 2021 */ #include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> #include <stdarg.h> #include <math.h> #include "stack.h" #include "array.h" stack create() { stack myStack; // I...
C
/* * Copyright 2015 Joseph Landry */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> #include "list.h" struct list { void **buf; int size; int count; }; struct list *newList(){ struct list *list; list = calloc(1, sizeof(*list)); list->size = 32; list->count = 0; list->buf =...
C
#include "list_de_listNodes.h" /***********************AJOUTE**************************/ void list2N_insert(list2N **l,int nodeid, listeNodes *peres) { list2N *tmp=malloc(sizeof(list2N)); if(!tmp) { printf("erreur de creation de la liste\n"); exit(-5); } tmp->values.node=nodeid; ...
C
/*************************************************************************** main.c - description ------------------- begin : Mon Oct 21 09:41:54 CEST 2013 copyright : (C) 2013 by Brandon Warhurst email : robo...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> int main(){ int d1,d2; srand(time(NULL)); char name[20]; d1=rand()%6+1; d2=rand()%6+1; printf("What is your name?\n>"); scanf(" %s",name); printf("Hello, %s!\n",name); printf("Rolling the dice...\n"); printf("Dice1: %d \n",d1); prin...
C
#include <stdio.h> #include <string.h> int main(void) { char frase[50]; int espacos = 0; int palavras = 0; int i; printf("Digite uma frase: "); fgets(frase, 50, stdin); // Pegar a frase da string int tamanho = strlen(frase); // Contar o numero de caracteres da string for(i = 0; i < tamanho; i++) { ...
C
int Partition(SqList &L, int low, int high) //改进版 { KeyType pivotkey; pivotkey = L.r[low].key; L.r[0] = L.r[low]; while(low < high) { while(low<high && L.r[high].key>=pivotkey) high--; L.r[low] = L.r[high]; //将比关键字小的记录移到低端,曲轴在[0]不动. while(low<high && L.r[low].key<=pivotkey) low++; ...
C
#include <stdio.h> #include <windows.h> #include <assert.h> // 开启 N-API 实验性功能,如:多线程 napi_threadsafe_function #define NAPI_EXPERIMENTAL #include <node_api.h> typedef struct{ napi_async_work work; // 保存线程任务的 napi_threadsafe_function tsfn; // 保存回调函数的 }Addon; /** 调试报错用的 */ static void catch_err(napi_env env, n...
C
//#include<iostream> //using namespace std; #include"heap.h" //void Swap(int* p1, int* p2) //{ // int tmp = *p1; // *p1 = *p2; // *p2 = tmp; //} // //void AdjustDown(int* a, int n, int parent) //{ // int child = parent * 2 + 1; // while (child < n) // { // //ѡҺСǸ // if (child+1 < n && a[child + 1] ...
C
/** * generate.c * * Generates pseudorandom numbers in [0,MAX), one per line. * * Usage: generate n [s] * * where n is number of pseudorandom numbers to print * and s is an optional seed */ #define _XOPEN_SOURCE #include <cs50.h> #include <stdio.h> #include <stdlib.h> #include <time.h> // upper limit on ra...
C
#include <led_driver.h> #include <error_handler.h> #include <stdint.h> #include <stdbool.h> const int LED_MIN = 0; const int LED_MAX = 16; static uint16_t *g_address; static uint16_t g_image = 0; static bool isValidLed(unsigned ledNumber) { return (ledNumber >= 0) && (ledNumber < 16); } void LED_Create(uint16_...
C
#include <stdio.h> #include "stack.h" void parse(char *str); int indexn = 0; int i = 0; stack_256 st; char program[30000] = {0}; char current; int main(int argc, char *argv[]) { if (argc == 2) { parse(argv[1]); } printf("\n"); return 0; } void parse(char *str) { while ((current = str...
C
#include "minishell.h" void sig_int(int code) { (void)code; if (g_sig.pid == 0) { ft_putstr_fd("\b\b ", STDERR); ft_putstr_fd("\n", STDERR); ft_putstr_fd("\033[0;36m\033[1mminishell ▸ \033[0m", STDERR); g_sig.exit_status = 1; } else { g_sig.exit_status = 130; } g_sig.sigint = 1; } void sig_quit(int...
C
/**************************************************************************** Elaine Ha Teresa Truong CSE 12, Fall 2019 December 1, 2019 ...
C
/* * File Name: lisenGetIP.c * Author: sunowsir * Mail: sunowsir@protonmail.com * GitHub: github.com/sunowsir * Created Time: 2018年11月16日 星期五 16时37分43秒 */ #include "../include/CreateConnect.h" typedef struct args { LinkList **list; int listNum; } Args; Args arg; void *startListen(void *None) { ...
C
#include <stdio.h> #include <stdlib.h> struct Object { int *nums; int len; }; struct ListNode { int val; struct ListNode *next; }; struct ListNode *make_list(int *nums, int size) { int i; struct ListNode dummy; struct ListNode *prev = &dummy; dummy.next = NULL; for (i = 0; i < si...
C
/* Author : Naoki Kishi (KUEE 2T13) GitHub URL : https://github.com/naoki-kishi/cpro2018 */ #include <stdio.h> #include <stdlib.h> //プロトタイプ宣言 int input(char str); int cnr(int n,int r); int main(void){ int n = input('n'); int r = input('r'); int ans = cnr(n,r); printf("%d",ans); return 0; } int in...
C
/* 1- typedef struct Nodo_ .... Nodo 2- definire la lista come puntatore al primo nodo Nodo *lista; 3- passare l'indirizzo della lista alla funzione crea lista e aggiungi elemento &lista 4- definire tutte le funzioni con il doppio puntatore **lista 5- se si devono fare modifiche al primo elemento HEAD modificare il con...
C
#include <stdio.h> #include <stdlib.h> // gcc -o out.bin arrayptr.c -Wall /* prints: p = ffffcc20 a = &a = &a[0] = ffffcc20 ffffcc20 ffffcc20 &p = ffffcc18 p = ffffcc28 */ int main() { int a[] = { 1, 2, 3, 4, 5 }; int * p; p = a; printf("p = %08x\n...
C
#include<stdio.h> #include<string.h> #include<stdlib.h> #include <openssl/conf.h> #include <openssl/evp.h> #include <openssl/err.h> #include <openssl/aes.h> #include <openssl/bio.h> #include <openssl/hmac.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <assert.h> #include...
C
//Write a C Program to arrange the elements in ascending order. #include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> int main() { int i,j,temp,n,a[10]; scanf("%d", &n); for (i = 0; i < n; i++) scanf("%d", &a[i]); for (i = 0; i < n; i++) { ...
C
#ifndef __LINK_H__ #define __LINK_H__ #include <stdio.h> #include <stdlib.h> typedef int DataType; typedef struct node { DataType Data; struct node * pNext; }LinkNode; typedef struct list { LinkNode *pHead; int cLen; }LinkList; #endif
C
// // Created by souso on 12/12/2017. // #include <stdio.h> #include "SortingFunc.h" #include "../Helpers.h" void bubble_sort(int *arr) { printf("Sorting using Bubble Sort"); int num = sizeof(arr) - 1; for (int i = 0; i < num; ++i) { for (int j = 0; j < num - i - 1; ++j) { if (arr[j] ...
C
#define MASK 0b11011111 int nc_toupper(int c) { char tmp = (char)c; if (tmp >= 'a' && tmp <= 'z') tmp &= MASK; return tmp; }
C
#include <stdio.h> #include "fdl_file.h" #include "fdl.tab.h" fdl_file add_to_file(fdl_file file, token token) { fdl_file new = (fdl_file)malloc(sizeof(struct fdl_file_s)); new->next = file; new->head = token; return new; } void print_parse(fdl_file file) { while(file->next != NULL) { print_tree(file->h...
C
/**Write a function to compute the value of the derivative of a polynomial, P(x), of degree n, in a given point x=x0. The degree, and the coefficients of the polynomial, and the point, x0, will be passed as parameters. You must use pointers */ #include <stdio.h> #include <stdlib.h> #include <math.h> void read(int *v...
C
//dang in ra phu thuoc vao dac ta #include <stdio.h> main(){ int x = 360, y= -1; long yl=-11; char *vb = "pro\0grammer"; double dx= 3.14159265; printf("\nx= %010d\nx=%-010d\nx=%10o\nx%010o",x,x,x,x); printf("\nx=%-10d\nx=-010x",x,x); printf("\n\yl=%ld\ny=%10u\ny%10o\ny=%10x",y,y,y,y); printf("\n\nyl=%ld\nyl=%1...
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 "mpi.h" #include <stdio.h> enum { false, true }; enum { EX_TAG, INTERCOMM_TAG, INTERCOMM_P2P }; int main (int argc, char* argv[]) { int numprocs, rank; MPI_Init (&argc, &argv); MPI_Comm_size (MPI_COMM_WORLD, &numprocs); MPI_Comm_rank (MPI_COMM_WORLD, &rank); printf ("world procs = %d, world...
C
/*TAD: Minha biblioteca para o SIG-car */ #ifndef MYLIB_H #define MYLIB_H /* Função get menu ** Operação que abre uma nova página de acordo com a entrada do usuário */ void get_menu( int n ); /* Função input ** Operação que obtém a entrada do usuário e aloca corretamente */ char* entr_str( char* frase ); /* Funçã...
C
#ifdef PLAN9 #include <u.h> #include <libc.h> #else #include "linux.h" #endif #include "dat.h" #include "pstring.h" #include "hash.h" /* Bernstein's hash */ uint hash(unsigned char *buf, int len) { unsigned int hash = 5381; while (len--) hash = ((hash << 5) + hash) + (*buf++); /* hash * 33 + c */ return hash; ...
C
#include "unity_fixture.h" #undef free // because we don't want Unity's version of free #include "prime_factors.h" TEST_GROUP(PrimeFactors); TEST_SETUP(PrimeFactors) {} TEST_TEAR_DOWN(PrimeFactors) {} TEST(PrimeFactors,FactorsOfOne) { int *actual = prime_factors_of(1); TEST_ASSERT_NULL(actual); } TEST(PrimeFact...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #ifdef __GNUG__ #include <std.h> #endif #ifdef MSDOS #include <stdlib.h> #include <malloc.h> #endif #include "Global.h" #include "Variable.h" typedef struct _StrElement{ char *value; struct _StrElement *next; } StrElement; void var...
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 vize[4]; int sayac,ortalama; int toplam; for(sayac=0;sayac<4;sayac++) { printf("notlari giriniz\n"); scanf("%d",&vize[sayac]); to...
C
/* ************************************************************************** */ /* */ /* :::::::: */ /* devide_ants.c :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <unistd.h> int main(int argc, char** argv) { if(argc!=2) { perror("executable <key file>"); exit(1); } int fdKey=open(argv[1],O_WRONLY|O_CREAT); if(fdKey==-1) { perror("open"); exit(1); } int i,nbByte; unsigned int ...
C
// Name: p12.c // Purpose: Evaluates an expression entered by the user // Author: EM #include <stdio.h> int main(void) { float value = 0.0f; char ch; float i = 1.0f; float num = 0.0f; char operator; printf("Enter an expression: "); while ((ch = getchar()) != '\n') { if (ch == '.') { ...
C
#include <stdio.h> #include<stdlib.h> struct node { int data;struct node *next;}; struct node *head=NULL; int l=0; void create() {struct node* temp =(struct node *) malloc (sizeof (struct node)); struct node* p=head; printf("ENTER THE DATA: "); scanf ("%d",&temp->data); if (head == NULL) {head=temp;temp->nex...
C
#include "xlist.h" int main(void) { int y=0,m=0,yd=0,md=0,d=31,gre=1,dotw=1,i=0; char e[9][100]={ /*0*/"\n=========================Error========================\n", /*1*/"\n=========================x=========================\n", /*2*/"̃vOł͐0NIO`Ă܂B", /*3*/"̒lɕsȒl͂܂B", /*4*/"OSI͖2621NɈƌĂ܂B\n\\ꂽJ_[͎QlxɂlB",...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strmap.c :+: :+: :+: ...
C
// Copyright (c) Lawrence Livermore National Security, LLC and other VisIt // Project developers. See the top-level LICENSE file for dates and other // details. No copyright assignment is required to contribute to VisIt. #include <math.h> #include <stdio.h> #include <visit-config.h> #include <string.h> #include <ios...
C
#include<stdio.h> int main() { char input[999]; printf("Enter the value\n"); scanf("%s",input); int n; n=0; int c1=0,c2=0; while(input[n]!='\0') { if(input[n]=='.') { c1++; if(input[n+1]!='\0') c2=1; } n+...
C
/* * image.c * * Created on: May 7, 2014 * Author: palotasb */ #include "glcd.h" #include "image_font.h" #include "image.h" Image const Image_Empty = { .size.x = 0, .size.y = 0, .getPixel = Image_Empty_zeroFunction, .getPixelByte = Image_Empty_zeroFunction }; /** * Calculates the b...
C
#include<stdio.h> int algarismo (int a) {//Essa função printa um algarismo da Dezena ou da Unidade, considerando a definição diferenciada dos teens switch (a) { // case 0: // printf("zero"); // break; // Zero foi desconsiderado pois não se pronuncia ele. case 1: printf("um"); break; case 2: printf("dois"); ...
C
#include "st-unicode.h" #include "st-utils.h" #include <string.h> st_unichar st_utf8_get_unichar (const char *p) { st_unichar ch; if (p == NULL) return 0x00; if ((p[0] & 0x80) == 0x00) { ch = p[0]; } else if ((p[0] & 0xe0) == 0xc0) { ch = ((p[0] & 0x1f) << 6) | (p[1] & 0x3f); } else if ((...
C
#include <xinu.h> #include <future.h> #include <stdio.h> int de_Q(Future_queue*); void en_Q(Future_queue*, pid32); void print_Q(Future_queue*); //Allocate memmory to the future. future_t* future_alloc(future_mode_t mode) { future_t *future_element; future_element = (future_t *)getmem(sizeof(future_t)); swi...
C
#include <stdio.h> int main(int argc, char const *argv[]) { if (argc != 3) { printf("The operands number is %d and should be 2!\n", argc - 1); return -1; } if (strlen(argv[1]) != strlen(argv[2])) { printf("The lengths of two operands should be the same!\n"); return -2; ...