language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include<math.h> #include<stdio.h> int main() {int n=0,no,cp,r,ans=0; printf("ENTER A NO\n"); scanf("%d",&no); cp=no; while(no>0) { no=no/10; n=n+1; } no=cp; while(cp>0) { r=cp%10; ans=ans+pow(r,n); cp=cp/10; } if(ans==no) pr...
C
#include <mouse.h> double g_coge_mouse_pos_x; double g_coge_mouse_pos_y; double g_coge_mouse_last_pos_x; double g_coge_mouse_last_pos_y; double g_coge_mouse_dx; double g_coge_mouse_dy; double g_coge_mouse_scroll_dx; double g_coge_mouse_scroll_dy; int g_coge_is_first_mouse; int g_coge_mouse_buttons[GLFW_MOUSE_BUTTON_...
C
#include<stdio.h> void using_if(void); void using_switch(void); void using_while(void); int main() { using_if(); using_switch(); using_while(); return 0; } void using_if(void) { if(printf("Hello world \n ")){} } void using_switch(void) { switch(printf("Hello world \n")){} } void using_while(voi...
C
#include <stdio.h> #include <stdlib.h> #include <omp.h> int main(int argc, char **argv) { int i; double x, sum, pi = 0; long num_steps = atol(argv[1]); int threads = atoi(argv[2]); double step = 1.0 / num_steps; double start, finish; FILE *fp; omp_set_num_threads(threads); start = ...
C
/* * motor.c * * Created on: Dec. 28, 2020 * Author: damien sabljak */ #define MOTOR_ARMED 1 #define MOTOR_DISARMED 2 #define MOTOR_ARMING_PULSE_WIDTH 7 #include"stm32f1xx_hal.h" TIM_HandleTypeDef htim4; uint8_t timChannels[] = {TIM_CHANNEL_1,TIM_CHANNEL_2,TIM_CHANNEL_3,TIM_CHANNEL_4}; void Motor_Arm() { ...
C
#include "monty.h" int val = 0; /** * main - receives arguments and then passes to stack * @argc: argument count * @argv: argument vector * Return: 0 if success */ int main(int argc, char **argv) { char *l, *symbol; unsigned int line_num; size_t len; stack_t *stack; FILE *ar; if (argc != 2) arguments_e...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* uinteger.c :+: :+: :+: ...
C
#define _XOPEN_SOURCE 700 #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdio.h> #include <stdbool.h> #include <inttypes.h> #include <unistd.h> #include <errno.h> #include <stdlib.h> #include <string.h> #include <utime.h> #include <limits.h> #include <sys/...
C
/** * @file * VuoVerticalAlignment implementation. * * @copyright Copyright © 2012–2020 Kosada Incorporated. * This code may be modified and distributed under the terms of the MIT License. * For more information, see https://vuo.org/license. */ #include <string.h> #include "type.h" /// @{ #ifdef VUO_COMPILER V...
C
#include <stdio.h> #include <math.h> void main(){ typedef struct Puntos{ int xy[3][3]; }Punto; int i; int j; Punto pun[3]; for(i=0;i<2;i++){ for(j=0;j<1;j++){ printf("\nIngrese el punto [x][y] %i,%i: ",i,j); scanf("%i",&pun[i].xy[i][j]); } } }
C
#include<stdio.h> main() { int t; scanf("%d",&t); while(t--) { int n,m,k; scanf("%d%d%d",&n,&m,&k); int diff = (n>m)?n-m:m-n; int left=0,actual; if(k<diff) { printf("%d\n",diff-k); } else { printf("%d\n",left); } } }
C
#include<stdio.h> #include<math.h> #define LAMBDA 0.001 int main(){ double t; float r; int i,R; for(i=1;i<=27;i++){ printf("--"); } printf("\n"); for(t=0;t<=3000;t+=150){ r=exp(-LAMBDA*t); R=(int)(50*r+0.5); printf(" |"); for(i=1;i<=R;++i){ printf("*"); } printf("#\n"); } for(i=1;i<3;++i){ printf(" |\n"); } }
C
#include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> #ifdef ioctl void my_err(const char *err_string,int line) { fprintf(stderr,"line:%d",line); perror(err_string); exit(1); } int main(){ int ret; int access_mode; int fd; if((fd=open("exampl...
C
/*http://pages.cs.wisc.edu/~remzi/OSTEP/threads-sema.pdf*/ /*page 13*/ #include <stdio.h> #include <pthread.h> #include <semaphore.h> #define PHILS 5 sem_t forks[PHILS]; void think(int name) { printf("\nthinking - %d", name); } void eat(int name) { printf("\neating - %d", name); } int left(int p) { ...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> /* whiplace: multiple stream replacement USAGE: whiplace keyfile targetfile */ void exit_memory_failure(void) { fprintf(stderr, "memory error\n"); exit(EXIT_FAILURE); } void exit_no_sep_failure(char *s) { fprintf(stderr, "character separator not f...
C
/* ********************************************** * C program to convert Hexadecimal to Decimal * ************************************************/ #include <stdio.h> #include <math.h> int main() { int hex[20], dec, i, j, ch, p; i = 0; p=0; dec=0; // Read a Hexadecimal value printf("Enter a Hexadecimal v...
C
#include<stdio.h> #include<math.h> int main(){ float a,b,c; printf("Enter the first Number:\n"); scanf("%f",&a); printf("Enter the second Number:\n"); scanf("%f",&b); c=(a+b)/2; printf("The Sum of the two numbers are: %f", c); }
C
/* Penguin */ /* * Copyright (C) Argonne National Laboratory * * Argonne does not guarantee this software in any manner and is * not responsible for any damages that may result from its use. * Furthermore, Argonne does not provide any formal support for this * software. This is an experimental p...
C
int gcd(int a, int b){ while (b > 0) { int c = a; a = b; b = c % b; } return a; } bool hasGroupsSizeX(int*deck, int deckSz){ int f[10001] = {0}; for(int z=0;z<deckSz;z++){int d = deck[z]; f[d]++; } int g = 0; for(int z=0; z<10001; z++){int v = f[z]; ...
C
#pragma once #pragma pack(push, 1) struct RGBColor { unsigned char blue; unsigned char green; unsigned char red; RGBColor() : blue(0), green(0), red(0) {} RGBColor(unsigned char red, unsigned char green, unsigned char blue) : blue(blue), green(green), red(red) {} }; #pragma pack(pop)
C
#include <stdio.h> #include <stdlib.h> #include <errno.h> #include <fcntl.h> #include <string.h> #include <unistd.h> #define DEVICE_NAME "/dev/debug_driver_device" int main(int argc, char **argv){ int ret, fd, read_length; read_length = atoi(argv[2]); char *message = malloc(sizeof(char)*read_length); if (argc < 2...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* list2.c :+: :+: :+: ...
C
/* basic prototype for data definition structual organization and operations on the network datatype Custom defined datatype with structures which allows us to do the following: 1. have a structure for storing data as well as the node information 2. have a way to add new node with connection which we c...
C
#include "holberton.h" /** * puts_half - prints half of a string * * @str: pointer parameter * * Return: void */ void puts_half(char *str) { long length_st; int second_half = 0; int second_half2 = 0; length_st = 0; while (*(str + length_st) != '\0') { length_st++; } if (length_st % 2 == 0) { second_...
C
#define WIN32_LEAN_AND_MEAN #include <winsock2.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <conio.h> #define MAX_BUF_SIZE 4000 char Buffer[MAX_BUF_SIZE]; void main(void){ unsigned short port = 5000; int socket_type = SOCK_STREAM; struct sockaddr_in server; int ret,retval=0,temp =0; cons...
C
#include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <pthread.h> #include <time.h> int N, M; pthread_mutex_t *mutexes; pthread_barrier_t barrier; void *f(void *a) { int j = *((int*)a); int i; printf("Thread %d is waiting...\n", j); pthread_barrier_wait(&barrier); for (i = 0; i < M;...
C
#include <stdio.h> #include <stdlib.h> //function to print RGB and alpha of a given 32bit color value void printEachColor(uint32_t colorInt){ uint8_t Red,Green,Blue,Alpha; Alpha=(uint8_t)colorInt&255;colorInt>>=8; Blue=(uint8_t)colorInt&255;colorInt>>=8; Green=(uint8_t)colorInt&255;colorInt>>=8; Re...
C
// RUN: %clang_cc1 -fsyntax-only -verify %s #if !__has_extension(pragma_clang_attribute_namespaces) #error #endif #pragma clang attribute MyNamespace.push (__attribute__((annotate)), apply_to=function) // expected-error 2 {{'annotate' attribute}} int some_func(); // expected-note{{when applied to this declaration}} ...
C
#include <stdio.h> #include <stdlib.h> #include <unistd.h> int main(){ pid_t pid; int mypipefd[2]; int ret; char buf[20]; ret = pipe(mypipefd); if(ret==-1){ perror("pipe"); exit(1); } pid = fork(); if(pid==0){ /*chiled process*/ printf("child process \n"); write(mypipefd[1],"Hello the...
C
// ڷκ Է¹ 2 Ͽ #pragma warning (disable : 4996) #include <stdio.h> int main(void) { // int x, y, sum; // ϳ Է¹޾ x printf("ù° ڸ ԷϽÿ:"); scanf("%d", &x); // ϳ Է¹޾ y printf("ι° ڸ ԷϽÿ:"); scanf("%d", &y); // sum = x + y; printf(" : %d", sum); return 0; }
C
unsigned char degerler[5]= {0}; void dht_start(){ output_float(PIN_A0); restart_wdt(); delay_ms(1000); } unsigned char get_byte(){ unsigned char s = 0; unsigned char value = 0; for(s = 0; s < 8; s += 1) { value <<= 1; restart_wdt(); while(!input(PIN_A0)); rest...
C
#include "mymath.h" #include <stdlib.h> #include <stdio.h> #include <math.h> #include <assert.h> void v3d_set(v3d *v, double x, double y, double z) { assert(v != NULL); v->x = x; v->y = y; v->z = z; } void v3d_minus(v3d *a, v3d *b, v3d *res) { assert(a != NULL); assert(b != NULL); assert(res != NULL); re...
C
/* * example.c - readline example */ #include "readline.h" void example () { int fp; int l; char buf [255]; fp = open ("pipe", O_RDONLY); l = readline(fp, buf, 244); printf("read\n\t %s\n", buf); close(fp); return; } int main(int argc, char **argv) { example(); return 0; }
C
#include<stdio.h> int main() { int i, limit, sum = 0, x, c = 0, time_quantum; int wait_time = 0, tat = 0, a_time[10], b_time[10], temp[10]; float average_wait_time, average_tat; printf("Enter Total Number of Processes:"); scanf("%d", &limit); x = limit; for(i = 0; i <...
C
/* Game Tentang Agmal dan Iraj */ #include<stdio.h> #include<stdlib.h> #include<string.h> #define SISOP B10 #include<pthread.h> #include<stdlib.h> #include<unistd.h> int WakeUp_Status=0; int Spirit_Status=100; int p_agmal=0, p_iraj=0; // inisialisasi nilai awal int flag=0; int count_WakeUp=0; int count_Spirit=0; void...
C
#include<stdio.h> int main() { int n; int num[100]; int l; int desnum[100],k; int i,j,temp; printf("Enter the total number of marks to be entered: "); scanf("%d",&n); for(l=0;l<n;l++) { printf("Enter the marks of student %d: ", l+1); scanf("%d",&num[l]); } ...
C
#ifndef ENTERED_HERE #define ENTERED_HERE #pragma once #include "expDefines.h" #define MAXIMCHAR 28 struct Num { int leftOE; int rightOE; }; struct Modul { int poz; int dest; }; extern CString Valide; extern Modul m_moduli[101]; //search the character c within the string str. if str=valide, it searches whe...
C
#include <stdio.h> #include <string.h> #define NEW_NULL '\0' #define LENGTH 100 // Declarar las funciones char *new_strncpy(char *string, char *stringt, int n); char *new_strncat(char *string, char *stringt, int n); int new_strncmp(char *string, char *stringt, int n); int main() { // Declarar cadenas de caracteres...
C
#include "codegen.h" #include "parser.h" #include "ast.h" #include "lexer.h" // functions to add, remove, modify entries in code table and // to write codetable to MIPS output file static void generate_table_start(FILE *out); //hard code start part static void print_table_row(FILE *out, table_row *table_row);//print e...
C
/*========================================================================= * ode78_cr3bp.c mex file to generate * a Runge-Kutta 7/8 integrator of the CR3BP vector field. * * author: BLB * year: 2015 * version: 1.0 *=======================================================================*/ //----------------...
C
#include<stdio.h> #define MONTHS 12 #define YEARS 5 void qb(int a,int b,float ar[a][b]); void bf(float ar2[][MONTHS],int a); int main(void) { float rain[YEARS][MONTHS]={ {4.3,4.3,4.3,3.0,2.0,1.2,0.2,0.2,0.4,2.4,3.5,6.6}, {8.5,8.2,1.2,1.6,2.4,0.0,5.2,0.9,0.3,0.9,1.4,7.3}, {9.1,8.5,6.7,4.3,2.1,0.8,0.2,0.2,1.1,2.3...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> void cesar_cifrado(char cipher[], int shift); void cesar_descifrado(char cipher[], int shift); int main () { char *buffer; size_t bufsize = 256; size_t n; buffer = (char *)malloc(bufsize * sizeof(char)); if( buffer == NULL) { ...
C
//Pesquisa e Classificação de Dados - Atividade Semi-Presencial 03 - 21/05/18 // Jiovana Sousa Gomes - gomesjiovana@gmail.com // #include <stdio.h> #include <stdlib.h> #include "aluno.h" int main() { Lista *lst = criarLista(); int opt; do{ printf("Escolha opcao:\n0- Sair\n1-\n2- Inserir Aluno\n...
C
/* Astrid Moore (Bruce Maxwell) Fall 2014 Example of a 3D scene model Draws a city with 3 different kinds of buildings */ #include "graphics.h" #include <time.h> #include <stdlib.h> int main(int argc, char *argv[]) { // initialize fields const int rows = 500*2; const int cols = 550*2; Lighting *light; Image *...
C
#include "../include/skip_segment.h" void skip_segment(uint32_t *cpt, FILE *movie) { uint16_t size = read_block_size(cpt,movie); skip_size(size-2,cpt,movie); uint8_t oct = read_byte(cpt,movie); assert(oct == 0xff); } /* void skip_segment(uint32_t *cpt, FILE *movie) { uint32_t oct = read_byte(cpt,movie); while...
C
/* 问题1:实现pow(int x, int y) ,即x的y次方 x的y次方就是有y个x连续乘机,代码如下: */ #include <stdio.h> #include <stdlib.h> int my_pow(int x,int y){ if(x==0) return 0; int ret=x,i=1; for(;i<y;i++){ ret=ret*x; printf("y=%d;ret=%d\n",i+1,ret); } return ret; } int main(){ int...
C
#include <pthread.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> pthread_mutex_t lock; int j; //Funktio jonka kukin thread suorittaa funktion parametrina thread saa pakattavan tiedoston nimen. void *do_process(void* file) { char *filename = file; FILE *fp = fopen(filename, "r"); ...
C
#include <stdio.h> #include <stdlib.h> int main (int argc, char** argv[]){ int i,x,fat, flag = 0; while (flag == 0){ printf ("Insira o numero: "); scanf("%d", &x); system("cls"); if (x<0){ }else{ printf ("\n%d! => ", x); i=1; fat = 1; while (i<=x){ fat = fat*(x-i+1); printf("%d ", (x...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* put_t_x.c :+: :+: :+: ...
C
/* Test that the proper error is triggered when we initialize a global with another non-const global's rvalue. Using gcc_jit_global_set_initializer_rvalue() */ #include <stdlib.h> #include <stdio.h> #include "libgccjit.h" #include "harness.h" void create_code (gcc_jit_context *ctxt, void *user_data) { gcc...
C
#include<stdio.h> #include<stdlib.h> #include<limits.h> int findPeakElement(int* nums, int numsSize) { int start = 1; if(numsSize == 1){ return 0; }else if(numsSize == 2){ if(nums[0]>nums[1]){ return 0; }else{ return 1; } } else{ if(num...
C
#include<stdio.h> #include<string.h> int isnum(char str[32]) { int l,i,flag=0; l=strlen(str); for(i=0;i<=l;i++) { if((str[i]>='A'&&str[i]<='Z')||(str[i]>='a'&&str[i]<='z')) { return 0; flag=1; } } if(flag==0) { return 1; } } int mai...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> char S1[10050]; char S2[10050]; char ans[10050]; int main(){ int t,i,n,j; char tmp; int carry=0; int sum; scanf("%d",&t); for(i=0;i<t;i++){ scanf("%d",&n); tmp=getchar(); for(j=0;j<n;j++){ tmp=getchar(); S1[j]=tmp; ...
C
// // File: config.h // Description: This file contains configurations that a user // can change, such as colors for objects, number of mines, etc. // After making changes, it is necessary to recompile the program. // #ifndef CONFIG_H #define CONFIG_H #include <SFML/Graphics.hpp> // // Base Color configurat...
C
#include <stdio.h> #define LIMIT 1000000 #define QUANT 78498 void main() { int i, j, k, max, sum, nums[LIMIT]={0}, primes[QUANT]={0}; //add 2 to the array, since the loop will not nums[1]=2; //fill the array with numbers of the form 3+2n for (i=3; i<LIMIT; i+=2) { nums[i]=i; } /...
C
#include<stdio.h> main() { int n,i,cpt=0,som1=0,som2=0; float moy; puts("entrer un nombre entier positif"); scanf("%d",&n); if(n<=0) do { puts("entrer une valeur positif"); scanf("%d",&n); }while(n<=0); for(i=1;i<=2*n;i++) { if(i%2==0) som1=som1+i; ...
C
/********************************************* Name : Mohamed Rafat Mohamed E-Mail : Eng.MohammedRafaat@gmail.com PH : +201014859309 Facebook : www.facebook.com/MohamedRafat29 ********************************************/ #include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> int main() { int i ...
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <string.h> //<>: ϵͳĿ¼ //"": ӵǰĿ¼ңûҵٴϵͳĿ¼Ѱ #include "cfg.h" #define CFGNAME "./mycfg.ini" void MyMenu() { printf("================================\n"); printf("1 дļ\n"); printf("2 ļ\n"); printf("3 \n"); printf("4 ˳\n"); printf("...
C
#include <stdio.h> int main() { int n,i,j,temp,min=0,max=0,minsum=0,maxsum=0; int a[100]; scanf("%d", &n); for(i=0;i<n;i++) { scanf("%d\t",&a[i]); } min=a[0]; for(i=0;i<n;i++) { if(a[i]<min) { min=a[i]; } } max=a[0]; for(i=0...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> int main(){ int x = 0, e, j, d, k, space = 0; char a[50], b[15][20], c[15][20]; printf("Read a string:\n"); fflush(stdin); scanf("%[^\n]s", a); for (x=0;a[x]!='\0';x++){ if (a[x] == ' '){ space++; ...
C
/* ** ptr_cmd_move.c for PSU_2016_zappy in /home/kleinh/Documents/PSU_2016_zappy/server/src/ptr_cmd_move.c ** ** Made by Arthur Klein ** Login <arthur.klein@epitech.eu> ** ** Started on Fri Jun 23 14:37:54 2017 Arthur Klein ** Last update Sun Jul 2 17:48:49 2017 yan */ #include <stdbool.h> #include "zappy_server...
C
/** * @file list.h List API * @ingroup core */ /* * Hamlog * * Copyright (C) 2011, Jan Kaluza <hanzz.k@gmail.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...
C
/* * Test the ANSI terminal * * 15/4/2000 Stefano Bodrato * * Compile with zcc +zxansi ansitest.c */ // t for text s for screen #include "stdio.h" main() { int x; /* A stupid CSI escape code test (normally no use uses CSI) CSI n J Clears part of the screen. If n is zero (or mis...
C
#include <stdio.h> #include<stdlib.h> int main(){ int num1,num2; num1 = 540; num2 = 243; if (num1 > num2) printf("\n The greater number is: %d", num1); else printf("\n The greater number is: %d", num2); return 0; }
C
/* name: Alex Austin Lab Section: 03 Student ID: 001424250 Lab: 3 Question: 1 */ #include <stdio.h> #include <stdlib.h> #include <string.h> char *my_strcat( const char * const str1, const char * const str2); int main(void) { printf ( "%s\n", my_strcat( "HELOOO", "WERLDF" )); return 0; } char *my_strcat...
C
/* ** EPITECH PROJECT, 2019 ** my_printf ** File description: ** Unit tests for printing strings */ #include <stddef.h> #include <criterion/criterion.h> #include <criterion/redirect.h> #include "my.h" Test(my_arg_to_str, basic_usage, .init = cr_redirect_stdout) { char *str = "escape from reality"; char expect...
C
/* SPDX-License-Identifier: BSD-2-Clause */ /*********************************************************************** * Copyright (c) 2017-2018, Intel Corporation * * All rights reserved. ***********************************************************************/ #ifdef HAVE_CONFIG_H #include <config.h> #endif #includ...
C
/* * Example of do while loop */ /* * while (condition) * { * do something; * } * * do * { * something * } * while(condition); */ #include <stdio.h> int main() { int num; // user input printf("Enter a number:"); scanf("%i", &num); do //while(num > 0) { printf("%i\n", num); num -= 1...
C
enum { __FILE_NUM__ = 0 }; #include "app_queue.h" void AppQueueIn(QUEUE_P QueuePtr, void *pQueueElement) { ELEMENT_P QueueElementPtr = (ELEMENT_P)pQueueElement; ELEMENT_P LastPtr; if ((LastPtr = QueuePtr->Last) == (ELEMENT_P)0) /* if queue is empty, */ QueuePtr->First = QueueElementPtr; ...
C
int findMaxConsecutiveOnes(int* nums, int numsSize) { int count = 0, max = 0; for (int i = 0; i < numsSize; ++i) { if (nums[i] & 1) count++; else count = 0; if (max < count) max = count; } return max; }
C
// Author:Zheng Jun // Date:2018/1/10 // E-mail:zhengjun1987@outlook.com #include <stdio.h> #include <memory.h> #define NAME "NAME:ZHENGJUN'S Inc." #define ADDRESS "ADDRESS:101 MEGABUCK PLAZA" #define MOBILE "MOBILE:17131420668" #define WIDTH 70 #define SPACE ' ' void show_n_char(char, int);//函数原型声明时可以省略形式参数的名称,只...
C
//Struct of Runways struct outerNode { int value; int numChildren; struct outerNode* next; struct innerNode* child; }; //Taking Off Aircraft struct innerNode { int value; int flightNo; struct innerNode* next; }; //Incomming Aircraft struct incomingNode { int fuel; int time; int wait; ...
C
#include <stdio.h> #include<math.h> long long s1(int n){ long long sum=0; int i=0; while(i<n){ sum=sum+pow(10, i); i++; } return sum; } int main() { int a,b,i1=0,i2=0; long long c,d,sum; scanf("%lld%d%lld%d",&c,&a,&d,&b); while(c>0){ if(c%10==a){ i...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <sys/stat.h> #include <sys/time.h> #include <sys/resource.h> #include <fcntl.h> #include <unistd.h> #include <signal.h> #include <syslog.h> #include "xmalloc.h" #include "unix.h" #define DEFAULT_TCP_BUFLEN (1024 * 8) int write_lo...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_TERMS 10 typedef struct { int row; // 행의 정보 int col; // 열의 정보 int value; // 행렬의 값 }term; int shape; typedef struct { term data[MAX_TERMS]; int rows; // 행의 개수 int cols; // 열의 개수 int terms; // 항의 개수 }SparseMatrix; Spars...
C
#include<stdio.h> int main() { int i,num; while(scanf("%d",&num)!=EOF) { if(num==2) printf("prime number\n"); else { for(i=2; i<=num-1; i++) { if(num%i==0) break; } if(num==...
C
#include "stdio.h" int main() { char s[] = "Anurag Saraswat"; int i = 0; int temp; while (s[i] != '\0') { temp = s[i]; if (temp >= 'A' && temp < 'a') { s[i] = s[i] - 'A' + 'a'; } else if (temp >= 'a' && temp <= 'z') { s[i] = s[i] + 'A' - 'a'; } i++; } puts(s); return 0; }
C
#ifdef _WIN32_ #include <windows.h> #include "win_semaphor_thread.h" #endif #include "pthread.h" #include "../locker_pthread.h" #include "stdlib.h" #include "string.h" #include "../Locker.h" #include "../nested_locker.h" #include "../dlist.h" //#include "log.h" dlist list = NULL; int eq(void* data1,void* data2) { ...
C
#ifndef TRAJECTORY_H #define TRAJECTORY_H #include "../../common/2d/2d.h" #include "../../common/io/outputStream.h" #include "../../device/device.h" #define TRAJECTORY_THRESHOLD_NOTIFY_DEFAULT_VALUE true // 5 cm of threshold #define TRAJECTORY_THRESHOLD_DISTANCE_MM_DEFAULT_VALUE 50.0f...
C
/** * @file lv_style.c * */ /********************* * INCLUDES *********************/ #include "lv_obj.h" #include "../lv_misc/lv_mem.h" #include "../lv_misc/lv_anim.h" /********************* * DEFINES *********************/ #define STYLE_MIX_MAX 256 #define STYLE_MIX_SHIFT 8 /*log2(STYLE_MIX_MAX)*/ ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> //行列を出力 void disp(double **a,double *b,int N){ int i,j; printf("A,b=\n"); for (i=0;i<N;i++){ for (j=0;j<N;j++){ printf("%7.2f ",a[i][j]); } printf("| %6.2f\n",b[i]); } } //ガウスの消去法 void gdeletion(double **a, double *b,int N){ int i,j,...
C
/** \brief Apertura del archivo y llamado a funcion parser. * * \param path char* Ruta del archivo. * \param pArrayListEmployee LinkedList* * \return int 1 apertura y carga correcta, 0 error. * */ int controller_loadFromText(char* path , LinkedList* pArrayListEmployee); /** \brief Apertura del archivo y llamado...
C
/***************************************************************************************** * Author: Jacob Karcz * Date: 5.29.2017 * Course: CS372-400: Intro to Computer Networks * Program 2: ftserver.c - file transfer servce application * Description: This is the server for a file transfer service application....
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <ctype.h> // Rozważamy wyrażenia arytmetyczne zbudowane z liczb rzeczywistych, operatorów dodawania (+), // odejmowania (-), mnożenia (*) i dzielenia (/) oraz nawiasów. Operatory są lewostronnie łączne, // a mnożenie i dzielenie mają wyższy priorytet...
C
#include<stdio.h> #include<stdlib.h> #define INITSTRLEN 50 #define ERROR 0 #define OK 1 typedef struct{ char * ch; int length; int strsize; }HString; typedef int Status; int replace = 0; Status StrInit(HString * s) { s->ch = (char*)malloc(INITSTRLEN * sizeof(char)); if(!s->ch) return ERROR; ...
C
/* * mcu-threads: threading library for embedded systems. * * Copyright (C) 2014 Vladislav Levenetz - octal.s@gmail.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 3 ...
C
#include "I2C_devices.h" const char currDate[7] = { 0x00, // 00 Seconds 0x20, // 28 Minutes 0x02, // 24 hour mode, set to 5:00 0x01, // Sunday 0x026, // 4th ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_putnbr_base.c :+: :+: :+: ...
C
/** * vigenere.c * * Deep Chaudhary * deepdeepDOTac@gmail.com * * Encrypts messages using Vigenere’s cipher. */ #include <cs50.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> int main(int argc, string argv[]) { // ensure proper usage if (argc != 2) { ...
C
#include<stdio.h> #include<string.h> int main() { int n, i, j, tam, valido, a; char linha[128], pilha[128]; scanf("%d", &n); char vetor[n]; for(i=0; i<n; i++) { scanf("%s", linha); tam = strlen(linha); a=0; valido=1; for(j=0; j<tam&&valido; j++) { if(linha[j]=='(' || linha[j]=='[') { ...
C
#include <stdio.h> int main() { int n, i, a[10000], x, j, m; scanf("%d", &n); for(i=1; i<=n; i++) scanf("%d", &a[i]); scanf("%d", &x); j=0; m=0; for(i=1; i<=n; i++) if(j<x) { m++; if(a[i]%2==0) j++; } ...
C
/* * Turing Machine prototype * Main source file * * format: * '<name>:<input><output><+/-/N><next>,<input><out(...)\n' * * * Copyright Tiago Teixeira, 2017 */ #include "fileio.h" char* do_state(struct state s,char*input,int*next) { int act = 0; while(*(s.ins+act)!=0) { if(*(s.ins+act)==*input) { // ...
C
#include <stdio.h> #include <sys/types.h> #include <unistd.h> #include <stdlib.h> #include <signal.h> #include <time.h> static void handler(int signo){ printf("Child %d sending signal to parent\n", getpid()); kill(getppid(), SIGRTMIN + rand()%(SIGRTMAX - SIGRTMIN)); } int main(){ signal(SIGUSR1, handler); s...
C
/* * lzw15v.c * * The LZW algorithm. * * Referencias: * * T. A. Welch, IEEE Computer, Vol. 17, pp 8-19. 1984. * M. Nelson and J.-L. Gailly, The Data Compression Book. 1995. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "bitio.h" /* * Nmero mximo de bits de un cdigo ...
C
#include <stdio.h> #include <string.h> #include <ctype.h> char encrypt(char ); int main() { char text[100]; scanf("%[^\n]s", text); int i; for (i = 0; i < strlen(text); i++) { putchar(encrypt(text[i])); } putchar('\n'); return 0; } char encrypt(char t) { const char *uppercase = "IWGZVFUTHSOJLKDECNMRQPY...
C
#include "my.h" #include <setjmp.h> static jmp_buf g_stack_env; static void fun1(void); static void fun2(void); int main(void) { if(0==setjmp(g_stack_env)) { printf("Normal flow\n"); fun1(); } else{ printf("long jump flow\n"); } return 0; } static void fun1(void) { printf("enter fun1\n"); fun2...
C
#include <stdio.h> #include <string.h> int main() { int A; int B; int C; scanf("%d %d %d",&A, &B, &C); int array[4]; int temp; array[0] = A; array[1] = B; array[2] = C; int i,j; for (i = 0; i < 2; ++i) { for (j = i + 1; j < 3; ++j) { if (array[i] < array[j]) { t...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* damier.c :+: :+: :+: ...
C
#include "Stack.c" /*----------------------------------------------------------------------------- * Driver Program *-----------------------------------------------------------------------------*/ int main() { DLL* miLista = DLL_Create (); int tablero[TAM][TAM]; int Conjunto_x[TAM...
C
#include "common.h" #include <ctype.h> #include <sys/stat.h> #include <dirent.h> #include <unistd.h> #include <libgen.h> #include <stdlib.h> pid_t safe_fork(void) { pid_t pid = fork(); assert(pid != -1); return pid; } int safe_creat(const char *pathname, mode_t mode) { int fd = creat(pathname, mode); assert(f...