language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <stdlib.h> #include "lib.h" #include "funciones.h" #include "types.h" #include <string.h> #define SIZE_ARRAY 200 /*muestra un menu de opciones en pantalla */ void mostrar_menu() { printf("\tMENU DE AGENDA:\n\n\n"); printf("\t1_CONSULTA POR APELLIDO\n"); p...
C
#ifndef MY_ARRAY_H_INCLUDED #define MY_ARRAY_H_INCLUDED #include <stdarg.h> #define TRUE 1 #define FALSE 0 #define OK 1 #define ERROR 0 #define INFEASIBLE -1 #define OVERFLOW -2 #define MAX_ARRAY_DIM 8 #define MAX_MATRIX_SIZE 3000 #define MAXRC 1000 typedef int Status; typedef int ElemType; typedef struct { Ele...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* nm_process_file.c :+: :+: :+: ...
C
/* ============================================================================ Name : Exercise_sheet_6.c Author : eseuteo Version : Copyright : Description : Read a text file and insert into a linked list of strings (char*) the words contained in such a file. Prevent duplicate...
C
// Ziming Dong // CSE 330 // Project 2 // Write a routine called start_thread and put it in a file called “threads.h”, // Write the routines called “yield” and “run” which cranks up the works (and put them in threads.h). #ifndef INC_330TEST_THREADS_H #define INC_330TEST_THREADS_H // Include Files // #include "q.h" /...
C
#include <stdio.h> #include <omp.h> int main(int argc,char *argv[]){ int t_id=1; double time_start; double time_now; time_start = omp_get_wtime(); printf("Hello world from thread ID %d \n", t_id); time_now = omp_get_wtime(); printf("Time: %f mSec",(time_now-time_start)*1000); return 0; }
C
#include "holberton.h" /** * times_table - Multiplication Tables * * * Return: always 0 when success. */ void times_table(void) { int x, y, z, c, d; for (x = 0; x <= 9; x++) { for (y = 0; y <= 9; y++) { z = (x * y); c = (z / 10); d = (z % 10); if (z > 9) { _putchar(','); _putchar(' '); _putchar(c...
C
/** * Roman Halik, xhalik01 * 80% zmen * 18.12.2015 **/ /******************************************************************************* main.c: LCD + keyboard demo Copyright (C) 2009 Brno University of Technology, Faculty of Information Technology Author(s): Zdenek Vasicek <vasicek ...
C
#include "heap.h" #include <stdio.h> #include <stdlib.h> #define TAM 50 struct heap_t{ void** datos; cmp_func_t cmp; size_t cantidad; size_t tamanio; }; void swap(void** a, void** b){ void* aux; aux=*a; *a=*b; *b=aux; } heap_t *heap_crear(cmp_func_t cmp){ int i; heap_t* heap=malloc(sizeof(heap_t)); if (...
C
#include <stdio.h> int main(void) { int min; int h,m; scanf("%d",&min); h=min/60; m=min%60; printf(" %d Hours",h); if(min%60==0) { printf("0 Minutes" ); } else printf(" %d Minutes",m); return 0; }
C
/*************************************************************** * FileName : delay.c * Copyright : * ModuleName : * * CPU : * RTOS : * * CreateData : * Author/Corporation : * * Description : ϵͳʱ * *------------...
C
#ifndef POSITION #define POSITION typedef struct pos_struct { float32_t abs; float32_t absOffset; float32_t absMech; float32_t lastAbsMech; } pos_t; extern pos_t pos; void rstPosAbs ( void ) ; void setPosAbs ...
C
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { //Insure used argument if (argc == 1) { printf("Usage: ./ recover.c file to recover\n"); return 1; } //insure user give one argument if (argc > 2) { printf("Use only one argument (file to recov...
C
#include <stdio.h> #include <stdlib.h> #include <locale.h> #include "dk_tool.h" int main(int argc, char *argv[]) { setlocale(LC_ALL, "RUS"); float A,B,C,result; printf("¬ведите значение переменной A : "); scanf("%f",&A); printf("¬ведите значение переменной B : "); scanf("%f",&B); printf("¬веди...
C
/* ** my_putchar.c for my_putchar in /home/tiphanys/piscine_C/jour01/portig_t/my_putchar ** ** Made by PORTIGLIATTI Tiphanys ** Login <portig_t@etna-alternance.net> ** ** Started on Mon Oct 16 14:36:50 2017 PORTIGLIATTI Tiphanys ** Last update Thu Oct 19 14:59:00 2017 PORTIGLIATTI Tiphanys */ #include <unistd.h> ...
C
#include<stdio.h> #include<string.h> #include<ctype.h> void main() { int n,s=0,i; char a[50]; gets(a); n=strlen(a); for(i=0;i<n;i++) { if(!((a[i] >= 'a' && a[i] <= 'z') || (a[i] >= 'A' && a[i] <= 'Z') ||(a[i] >= '0' && a[i] <= '9') )) { s++; } } printf("%d",s); }
C
#include <unistd.h> #include <sys/select.h> #include <sys/time.h> #include <sys/types.h> #include <unistd.h> #include <stdlib.h> int main(int argc, char *argv[]){ int n=atoi(argv[0]); typedef struct{ int pipefd[2]; pid_t chpid; }children; children child[n]; int i; for(i=0;...
C
#include "bigint.h" #include <stdio.h> #define printbig(x) printf("0x%016llx%016llx\n", x.upper, x.lower); static uint128_t fib_sequence(long long k) { /* FIXME: use clz/ctz and fast algorithms to speed up */ uint128_t f[k + 2]; f[0] = (uint128_t){.upper = 0, .lower = 0}; f[1] = (uint128_t){.upper =...
C
#include <stdio.h> int main(){ int num=1,j,i,start=1,x=0,y; here: printf("Enter size of magic square (Only odd number): "); scanf("%d",&num); if(num%2==0){ printf("Only odd number"); goto here; } int arr[num][num]; for(i=0;i<num;i++) for(j=0;j<num;j++) arr[i][j] = 0; a...
C
#include <stdio.h> int main(){ int a, b, c, d, e, f; scanf("%d%d%d%d",&e,&f,&c,&d); a = e + c ; b = f + d ; scanf("%d%d%d%d",&e,&f,&c,&d); a += e + c ; b += f + d ; scanf("%d%d%d%d",&e,&f,&c,&d); a += e + c ; b += f + d ; b *= 3 ; a += b - 1 ; a = 9 - a ...
C
// // A+B_9_15740.c // // // Created by songhee on 2018. 7. 24.. // /* 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. 첫째 줄에 A와 B (-10^10000 ≤ A, B ≤ 10^10000)가 주어진다. */ #include <stdio.h> int main() { long long A, B; scanf("%lld %lld", &A, &B); printf("%lld\n", A+B); return 0; }
C
/** * CEL(C Extension Library) * Copyright (C)2008 - 2018 Hu Jinya(hu_jinya@163.com) * * 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 version 2 * of the License, or (at your o...
C
#include <stdbool.h> #include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { FILE *fp; bool r; char c; unsigned long long int res = 0; if (argc != 2) { printf("Usage: %s [FILE]\n", argv[0]); return 1; } fp = fopen(*++argv, "r"); while (fscanf(fp, "%c", &c) != EOF) { if (c != '0') go...
C
#include <stdio.h> #include "oslabs.h" #include <string.h> #include <stdbool.h> struct MEMORY_BLOCK best_fit_allocate(int request_size, struct MEMORY_BLOCK memory_map[MAPMAX],int *map_cnt, int process_id) { struct MEMORY_BLOCK temp_memory_block, allocated_memory; allocated_memory.end_address = 0; allocated...
C
#include <stdio.h> void main() { float salario_vendedor, vendas_totais, total_salario; //variaveis declaradas printf("insira o valor do salario: ");//recebe o valor para o salario atual do vendedor scanf("%f", &salario_vendedor);//aloca o valor na variavel printf("insira o valor das vendas d...
C
#include<stdio.h> int main() { int a=0x55; int b=0x33; int c; c=a^b; printf("%x\n",c); }
C
#include <stdio.h> #include <stdlib.h> #include <time.h> void random (int *b) { srand(time(0)); int sum[40]; for(int k=0;k<40;k++) { sum[k]=0; for(int i=0;i<1000;i++) { for(int j=0;j<5;j++) { *b = (rand()%40+1); ...
C
#include "../include/fdf.h" #define MAX(a, b) ( a > b ? a : b) #define ABS(a) (a > 0 ? a : -a) static void set_isometric(float *x, float *y, int z) { *x = (*x - *y) * cos (0.8); *y = (*x + *y) * sin(0.8) - z; } void draw_line(float x, float y, float x1, float y1, void *mlx, void *win, t_map *myMap) { ...
C
#include <stdio.h> #define MAX 13 int toNumber(char); int toCard(int); int main(){ int i, j, n[MAX]; char str[MAX], temp; scanf("%s", str); for(i = 0; i < MAX; i++){ if(str[i] >= '2' && str[i] <= '9') n[i] = str[i] - '0'; else n[i] = toNumber(str[i]); } ...
C
// A program that simulates the game of craps. #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <time.h> // needed for the random function. #include <stdbool.h> #include <ctype.h> int roll_dice(void); bool play_game(void); // main will call play_game repeatedly and keep track of wins and losses. /...
C
#include <windows.h> printWordSearch(char wordSearch[25][25], int category, char name[256], int time, int wordsLeft, char categories[7][25]) { int height, width; //colour changing: HANDLE hConsole; hConsole = GetStdHandle(STD_OUTPUT_HANDLE); //prints the wordsearch with a border, aswell as remain...
C
// Write a program that reads a set of text lines and prints the longest. // Revise the main routine of the longest-line program so it will correctly // print the length of arbitrary long input lines, and as much as possible // of the text. #include <stdio.h> #define MAXLINE 1000 int getLine(char[], int); void cpLine...
C
#include <stdio.h> void main() { int array[10], i, n = 11, search, mid, high = 10, low = 0; printf("Enter element in array ascending order:"); for (i = 0; i < n; i++) { scanf("%d", &array[i]); } printf("Enter elemnent to search:"); scanf("%d", &search); mid = (low + high) / 2; ...
C
#include<stdio.h> int main(void){ double area, pi = 3.14159,raio; scanf("%lf", &raio); area = (raio * raio)*pi; printf("%.4f\n", area); return 0; }
C
#include<stdio.h> #include<stdlib.h> // getenv function int main(){ char* env = "PWD"; printf("%s\n",getenv(env)); // 없으면 NULL을 준다., ubuntu에서는 null이 아니라 segment fault가 뜬다. return 0; }
C
/*************** Question 2 - Part 1 ****************************/ /*TODO Macro with bits counter function */ #define double(a,b){\ int i,mask;\ for(i = 0,mask = 1, b = 0; i<sizeof(a) * 8-1; i++, mask <<=1){\ if((a&mask) && (a&mask <<1))\ {\ i++, mask <<= 1;\ co...
C
/* ** EPITECH PROJECT, 2019 ** matchstick ** File description: ** matchstick */ #include <stdlib.h> #include <stdbool.h> #include <unistd.h> #include "my.h" #include "matchstick.h" void display_nbr(int nb) { char *temp = myrevgetnbr(nb); if (!temp) return; printw(temp); free(temp); } static ...
C
#include <stdlib.h> #include <stdbool.h> #include <stdint.h> #include <memory.h> #include "LedDriver.h" static uint16_t * ledsAddress; static uint16_t ledsImage; enum {ALL_LEDS_ON = ~0, ALL_LEDS_OFF = ~ALL_LEDS_ON}; static uint16_t convertLedNumberToBit(int ledNumber) { return 1 << (ledNumber - 1); } static voi...
C
/* Elabore um programa que exibe ao usurio se trs valores A, B, C digitados formam um tringulo. Sabe-se que trs valores formam um tringulo se A < B + C e B < A + C e C < A + B. Utilize somente uma estrutura condicional. */ #include <stdio.h> #include <stdlib.h> int main() { int A, ...
C
/////////////////////////////////////////////////////////////////////////////// // ALL STUDENTS COMPLETE THESE SECTIONS // Title: p4A: Undestanding Caches // Files: cache1D.c cache2Drows.c cache2Dcols.c cache2Dclash.c // // Semester: CS 354 Fall 2019 // // // Author: ...
C
#include <std.h> #include "../inherits/area_stuff.h" #include <daemons.h> #include <move.h> #include "/d/common/common.h" inherit CRATER; void create() { ::create(); set_name("An obsidian chamber"); set_short("%^BOLD%^%^WHITE%^An %^BOLD%^%^BLACK%^obs%^BOLD%^%^WHITE%^"+ "i%^BOLD%^%^BLACK%^dian%^BOLD%^%^WHITE...
C
/* ============================================================================ Name : pthread_2.c Author : gurkirat Version : Copyright : Your copyright notice Description : Hello World in C, Ansi-style ============================================================================ */ #include ...
C
/* OpenGL Training by YU-LUN HSU Chapter Two - Your first triangle Purpose: 1. Understanding the default coordinate used by OpenGL is [-1, -1]x[1, 1], and the origin is in the mid of the window. 2. Understanding the MODEL_VIEW matrix in OpenGL 3. OpenGL IS A STATE MACHINE Bonus: 1. Use glRotatef to rotat...
C
/** * \file wasi.h * * C API for WASI */ #ifndef WASI_H #define WASI_H #include "wasm.h" #ifndef WASI_API_EXTERN #ifdef _WIN32 #define WASI_API_EXTERN __declspec(dllimport) #else #define WASI_API_EXTERN #endif #endif #ifdef __cplusplus extern "C" { #endif #define own #define WASI_DECLARE_OWN(name) \ typedef...
C
#include "Queue.h" int TestList1() { Queue st; QueueInit(&st,1000); for (int i = 0; i < 1000; ++i) { QueuePush(&st,i); } for (int i = 0; i < 89; ++i) { QueuePop(&st); } printf("size = %d\n",QueueSize(&st)); printf("\n"); while (!QueueIsEmpty(&st)) { ...
C
// two numbers add #include<stdio.h> void main() { int num1,num2,sum; //num1 = 12; //num2 = 13; //printf("Enter first Number : "); //scanf("%d",&num1); //printf("Enter Second Number : "); //scanf("%d",&num2); printf("Enter two numbers : "); scanf("%d%d",&num1,&num2); sum = num1 ...
C
#include<stdio.h> void main() { int a[20],i,k; printf("enter the elements"); for(i=0;i<=5;i++) { scanf("%d",&a[i]); } printf("enter the k element to check"); scanf("%d",&k); if(a[k]%2!=0) { printf("the odd no is %d",a[k]); } else { printf("kposition is...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include "lib.h" int main(int argc, char const *argv[]) { int n=3; /* number of parameters */ int k=10; /* number of experimental data */ int i; double* result=(double*)malloc(n*sizeof(double)); double x[10]={1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0}; doub...
C
/* 726. 原子的数量 给定一个化学式formula(作为字符串),返回每种原子的数量。 原子总是以一个大写字母开始,接着跟随0个或任意个小写字母,表示原子的名字。 如果数量大于 1,原子后会跟着数字表示原子的数量。如果数量等于 1 则不会跟数字。例如,H2O 和 H2O2 是可行的,但 H1O2 这个表达是不可行的。 两个化学式连在一起是新的化学式。例如?H2O2He3Mg4 也是化学式。 一个括号中的化学式和数字(可选择性添加)也是化学式。例如 (H2O2) 和 (H2O2)3 是化学式。 给定一个化学式,输出所有原子的数量。格式为:第一个(按字典序)原子的名子,跟着它的数量(如果数量大于 1),然后是第二个原...
C
#include<stdio.h> #include<stdlib.h> //дһԽһֵλżλ #define SWAP_BIT(n) (((n & 0x55555555)<<1) | ((n&0xaaaaaaaa)>>1)) //ʹúʵϴֵ #define MAX(m,n) ((m)>(n)?(m):(n)) int main() { /*int a = 0, b = 0; printf("Ҫ"); scanf_s("%d %d", &a, &b); printf("нϴΪ%d\n", MAX(a,b));*/ int num = 10; printf("%d\n", SWAP_BIT(num)); syste...
C
#if !defined(_Q8DIG_H) #define _Q8DIG_H #include "q8.h" #define Q8_NUMBER_OF_DIG_CHANNELS (32) /********************************************************************* Name: Q8_digIsNumChannelsParamOK Purpose: Checks that the number of channels is within range of the num...
C
#include <stdlib.h> #include <stdio.h> #include "tree.h" #include "../strategy/strategy.h" #include "../user_errors.h" /** * Создать новую вершину. * * @param value Данные вершины * @return Указатель на вершину */ node_t * create_node(T value) { // Выделить память под новый узел node_t *node = malloc(si...
C
#include <stdio.h> int main(void) { float pi = 3.14159; printf("The number is %f\n", pi); return 0; }
C
#include <stdio.h> int main() { int s; scanf("%i", &s); int tab1[s],tab2[s],a=0,j; printf("tab1:\n"); for(j=0;j<s;j++) { scanf("%i", &tab1[j]); } printf("tab2:\n"); for(j=0;j<s;j++) { scanf("%i", &tab2[j]); } for(j=0;j<s;j++) { a=a+tab1[j]*tab2[j]; } printf("wynik: %i\n", a); return 0; }
C
/** * add - adds two integers * @a: Character input * @b: Character input * Return: adds * On error, -1 is returned, and errno is set appropriately. */ int add(int a, int b) { int r; r = a + b; return (r); }
C
#include<stdio.h> int main() { long num,base=1,rev=0; scanf("%d",&num); while((num/base)) { rev=(rev*10)+(num/base)%10; base=base*10; } printf("%d",rev); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <limits.h> #define MAXLENGTH 1024 void retrieveStringInput(char *str, size_t buffersize); int stringToInt(char *str); void retrieveStringInput(char *str, size_t buffersize) { for (;;) { if (fgets(str, (int) buffersize,...
C
/************************************** * Autores: * * - Bruno Ribeiro [1180573] * * - Pedro Lopes [1180715] * * - Bruno Veiga [1180712] * * - João Leal [1180725] * * * **************************************/...
C
#include<stdio.h> int main() { int i,k=0,p,n,t,nq[50],q,c=0; scanf("%d",&t); while(t--) { c=0; scanf("%d %d %d",&n,&p,&q); for(i=0; i<n; i++) { scanf("%d",&nq[i]); } i=0; while(n-- && p-->0) { q-=nq[i++]; ...
C
#include "uart.h" /* UART global variables */ volatile uint8_t UART_Ready; volatile uint8_t UART_ReceivedChar; uint8_t UART_RxChar; uint8_t* pUART_Buffer; uint8_t state=0; /* UART Transmit Complete Interrupt Function */ SIGNAL(SIG_UART_TRANS) { /* Test if a string is being sent */ ...
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> #define N 20 void sort(int arr[], int n); int main(void) { int arr[N]; int n, i = 0; scanf("%d", &n); while (i < n) scanf("%d", &arr[i++]); sort(arr, n); for (i = 0; i < n; i++) { if (i != n - 1) printf("%d ", arr[i]); else printf("%d\n", arr[i]); } return 0; } void sort(int arr[]...
C
/** * collection of functions to manage a list of titles */ #include <unistd.h> #include <sys/types.h> #include <ctype.h> #include <dirent.h> #include <strings.h> #include <sys/statvfs.h> #include <string.h> #include <stdio.h> #include <errno.h> #include <sys/stat.h> #include <sys/sendfile.h> #include <fcntl.h> #incl...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* quicksort4.c :+: :+: :+: ...
C
#include <stdlib.h> #include <string.h> #include <stdio.h> #include "lists.h" /** * free_listint - function frees lists * @head: pointer to a list * * Description: function prints lists * * Return: new node */ void free_listint(listint_t *head) { listint_t *go; while (head != NULL) { go = head; head = he...
C
#include<stdio.h> int main() { int i=1; printf("The series begins here: "); while(i<=128) { printf("%d",i); i=i*2; printf("\n"); } return(0); }
C
#include <stdio.h> #include <stdlib.h> struct Array { int A[10]; int size; int length; }; void display(struct Array arr) { for (int i = 0; i < arr.size; i++) { printf("%d ", arr.A[i]); } printf("\n"); } // Append/Add: adding an item to the end (next free space) of an array void ap...
C
/* * @lc app=leetcode.cn id=80 lang=c * * [80] 删除排序数组中的重复项 II */ // @lc code=start int removeDuplicates(int* nums, int numsSize){ int *head, *tail, *p; int result = 0, count = 0; head = nums; count ++; while(count < numsSize) { if(head == nums){ tail = head + 1; ...
C
/* * Dylan Brown * The purpose of this code is to deliver a sorted array to the user. * */ #include <stdio.h> #include <stdlib.h> #include <math.h> int promptUserForInputOfArraySize(); int promptUserForArrayElements(int arraySize, float *arrayPointer); int sort(float *array, int arraySize); int printSortedArray(float...
C
#ifndef _CHECK_LOCK_H_AGH178 #define _CHECK_LOCK_H_AGH178 static unsigned int lock_mask = 0xC0000000; static unsigned int lock_x = 0x80000000; static unsigned int lock_s = 0x40000000; static int check_grant_x(CountRegion* region, lock_protocol::LockId lid) { pthread_mutex_lock(&region->count_mutex); int x = ...
C
/* AOJ 0079 * * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0079 * */ #include <stdio.h> #include <math.h> typedef struct TPoint Point; struct TPoint { double fX; double fY; }; Point V[20]; double heron(double a, double b, double c){ double z; z = (a+b+c)/2; return sqrt(z*(z-a)*...
C
#include <string.h> #include <sys/types.h> size_t strspn(char const *s, char const *accept) { const char *p; const char *a; size_t count = 0; for (p = s; *p != '\0'; ++p) { for (a = accept; *a != '\0'; ++a) { if (*p == *a) break; } if (*a == '\0') ...
C
// HEADER #include "j_list.h" void jlst_reverse(j_list **first_node) { j_list *tmpa; j_list *tmpb; j_list *cursor; if (!first_node || !*first_node) return ; cursor = *first_node; tmpb = cursor->next->next; while (tmpb) { tmpa = cursor->next; tmpb = tm...
C
/*******************快速排序******************************** * 快速排序是冒泡法排序的一种改进,基本思想:将数据分为左右两 部分,一部分数据比另外一部分的数据小,然后将所得的两部分数 据进行同样的划分,重复执行以上的划分操作,知道成为有序数据* **************************************************************/ #include <stdio.h> #define N 6 int partition(int arr[],int low,int high) { int key; key = arr[l...
C
#include <stdio.h> /* suma de factoriales */ int main () { int i,factorial=1,suma=0,n; printf("Digite la cantidad de factorial a sumar: "); scanf("%i",&n); for(i=1;i<=n;i++) { factorial *= i; suma += factorial; } printf("La suma es: %i",suma); return 0; }
C
#include <stdio.h> #include <../utils/utils.h> int main() { int A[] = { 98,97,94,23,20,16,13,12,4,109,1 }; size_t size = sizeof A / sizeof A[0]; int placement_index = 0; while (placement_index < size - 1) { int min_index = placement_index; for (int i = placement_index; i < size; i++) { if (A[i] < A[place...
C
#include <stdio.h> #include <string.h> #define NUM_STRINGS 4 #define NUM_FORMATS 4 int main(int argc, char *argv[]) { static const char *testStrings[NUM_STRINGS] = {"123", " 123", "123 ", " 123 "}; static const char *testFormats[NUM_FORMATS] = {" %u %n", " %u%n", "%u %n", "%u%n"}; unsigned ui; int i, j, nchar...
C
int m[30],n[30],result[30]; int saintseiya(int m,int n) { int z; if(m>1&&n>1&&m>=n) z=saintseiya(m,n-1)+saintseiya(m-n,n); if(m>1&&n>1&&m<n) z=saintseiya(m,m); if(m==1) z=1; if(n==1) z=1; if(m==0) z=1; return(z); } void main() { int i,d; scanf("%d",&d); for(i=0;i<d;i++) scanf("%d%...
C
#include<stdio.h> #include<stdlib.h> int main() { int count[256] = { 0 }; int k; FILE *fp = fopen("characters.txt", "r"); int c; while((c=fgetc(fp))) { if(c == EOF) break; count[c]+=1; } for(k=0; k<256; k++) { if(count[k] > 0) { printf("char %c: %d times\n", k, count[k]); ...
C
/* * Copyright lizhirui * * SPDX-License-Identifier: Apache-2.0 * * Change Logs: * Date Author Notes * 2021-05-18 lizhirui the first version * 2021-05-20 lizhirui add os debug support */ // @formatter:off #include <dreamos.h> /*! * 断言违例处理程序 * @param ex_string 出错代码 * @param ...
C
/*Header Files*/ #include <stdio.h> #include <stdint.h> //for unit32_t data type. #include <math.h> //for log function #include <stdbool.h> #include <string.h> //Get number of set bits in an integer number also called as HammingWeight. //O(logn): since loop iterates only number of set bits times. uint32_t getsetBits...
C
#include "framework_led.h" #include "cmsis_os.h" #include "gpio.h" #define G_GPIO GPIOC #define G_GPIO_PIN GPIO_PIN_1 #define R_GPIO GPIOC #define R_GPIO_PIN GPIO_PIN_2 #define ledGOn() HAL_GPIO_WritePin(G_GPIO, G_GPIO_PIN, GPIO_PIN_RESET) #define ledGOff() HAL_GPIO_WritePin(G_GPIO, G_GPIO_PIN, GPIO_PIN_SET) #define ...
C
/********************************************* * client.c * * Desc: lab-skeleton for the client side of an * client-server application * * Revised by Dag Nystrom & Jukka Maki-Turja * NOTE: the server must be started BEFORE the * client. *********************************************/ #include <stdio.h> #include <windows...
C
#include<stdio.h> #include<string.h> int main() { char s1[100],s2[100]; int i=0,length; printf("Enter the string:"); gets(s1); while(s1[i]!='\0') { s2[i]=s1[i]; i++; } s2[i]='\0'; while(s2[i]!='\0') { i++; } length=i; printf(...
C
/* This is the main file for our Breathalizer program. This handles collecting input from the MQ3 alcohol sensor, the temperature sensor, and the DIP switch, and then determining the appropriate output for the buzzer, LCD, and digital POT. */ #include "htc.h" #include "LCD.h" #include "BreathalizerDipHandler.h" #inclu...
C
/* WAP to reverse the string without using any string handling functions */ #include <stdio.h> #include <conio.h> #include <stdlib.h> #define MAX_LIMIT 100 void reverseString(char *string) { "Reverse the string porvided"; int length = 0; char *temp; temp = (char *)malloc(MAX_LIMIT * sizeof(*temp));...
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> char *ft_strncpy(char *dest, char *src, unsigned int n); int main() { char A[]= "Hello"; char B[100]; unsigned int n = 3; ft_strncpy(B, A, n); int i; for( i = 0; i < 5; i++) { printf("%c", B[i]); } return 0; }
C
/************************************************************************** * * Copyright (c) 2013 Alcatel-Lucent * * Alcatel Lucent licenses this file to You under the Apache License, * Version 2.0 (the "License"); you may not use this file except in * compliance with the License. A copy of the License is conta...
C
#include <webots/robot.h> #include <webots/led.h> #include <webots/distance_sensor.h> #define TIME_STEP 64 #define ON 1 #define OFF 0 #define NB_LEDS 10 #define NB_DIST_SENS 8 int main(int argc, char *argv[]) { WbDeviceTag led[NB_LEDS]; WbDeviceTag ps[NB_DIST_SENS]; int liczni...
C
#include<stdio.h> #define Nfois 4 int main () { int a,b,c,d,e,f,g,h,i,x,z; printf("on this programe we are going to calculate the addition of two square matrice"); printf("\nhow many colons and lines :"); scanf("%d %d",&a,&b); if (x==1 && y==1) { printf("\nenter the nummber(s) of the first matrice (fi...
C
#include<stdio.h> int main() { int n1,n2,result; printf("enter 2num: "); scanf("%d\n %d",&n1,&n2); result=n1/n2; printf("result %d",result); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include "hw6.h" #include <math.h> #include <string.h> char *category_strings[] = { "Grocery", "Office", "Pharmacy", "Hobby"}; void print_product(product_info *p, FILE *fp) { fprintf(fp,"%s (%u) %s:",p->name, p->productID, category_strings[p->category]); fprintf(fp, "curr...
C
#include <stdio.h> #include <string.h> void reverse(char [], int, int); int main() { char str1[20]; int size; printf("Enter a string to reverse: "); scanf("%s", str1); size = strlen(str1); reverse(str1, 0, size - 1); printf("The string after reversing is: %s\n", str1); ...
C
#pragma once /*! \file equation.h * Equation's properties. */ //! constant for number comparisons #define PRECISION 1e-6 //! constant for specifying root types #define INFTY 666666 //! constant for specifying root types #define NOT_A_ROOT -666666 //! \enum results /*! An enum with values for each possible roots s...
C
/* Authors: Maryann O'Connell Darrien Glasser Rosemary Greeley Computing II Final Project Description: LinkedList.c */ #include <stdio.h> #include <stdlib.h> #include "Header.h" LinkedListPtr initLinkedList(void){ LinkedListPtr list; if((list = (LinkedListPtr)malloc(sizeof(LinkedLis...
C
/* color_logo.c -- * This program demonstrates the combined use of the XView color * model/API and Xlib graphics calls. The program uses XView to * create and manage its colormap segment while doing its actual * drawing using Xlib routines. * The program draws the X logo in red, green and blue in a canvas. *...
C
// Copyright (c) Open Enclave SDK contributors. // Licensed under the MIT License. #include <openenclave/bits/safecrt.h> #include <openenclave/corelibc/stdio.h> #include <openenclave/enclave.h> #include <openenclave/internal/argv.h> #include <openenclave/internal/backtrace.h> #include <openenclave/internal/calls.h> #i...
C
#include<stdio.h> #include<string.h> #include<windows.h> struct { char province[10]; char city[10]; int num; } Info[1000]; int Sum=0; char out_province[100][20]; int out_num=0; int Find_province(char in[]) { int i; for(i=0; i<out_num; i++) { if(strcmp(in,out_province[i]...
C
/* <= Faltou importar a biblioteca "stdio.h" int main(){ int a, b, c, menor; printf("Digite o primeiro número\n"); scanf("%d", &a); printf("Digite o segundo número\n"); scanf("%d", &b); printf("Digite o terceiro número\n"); scanf("%d", &c); if (a < b && b < c) <= Faltou abrir e fechar...