language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*
** EPITECH PROJECT, 2020
** MUL_my_rpg_2019
** File description:
** initalize sounds
*/
#include <stdlib.h>
#include <SFML/Graphics.h>
#include <SFML/Audio.h>
#include <SFML/System.h>
#include "game.h"
void destroy_sound(sounds_t *sounds)
{
sfSoundBuffer_destroy(sounds->a_buff);
sfSoundBuffer_destroy(sound... |
C | #include <calculadora_display.h>
#include <libreria1.h>
#include <libreria2.h>
char caracter[22],cadena[20];//{-2+-2:}
int flag=0;
int cont_separador=0;
int bandera1=0;
int numero1=0, numero2=0,numero3=0;
float resultado=0;
int calculo=0;
int puntero=0,puntero2=0;
float decimal1=0,decimal2=0;
char operaci... |
C | /*
˷
*/
#include <stdio.h>
#define N 100
#define min(a,b) a < b ? a : b
int matrixChainMultplication(int *p,int n)
{
int i, j, l,k, m[N+1][N+1];
for(i = 1; i <= n; i++)
{
m[i][i] = 0;
}
for(l = 2; l <= n; l++)
{
for(i = 1; i <= n-l+1; i++)
{
j = i + l - 1;
m[i][j] = (1<<21);
fo... |
C | #include<stdio.h>
#include<sys/ipc.h>
#include<sys/shm.h>
#include<unistd.h>
#include<stdlib.h>
#include<string.h>
typedef struct my_mem
{
int m_lock;
int m_unshow;
char m_buf[128];
}mem_t,*pmem_t;
void Lock(pmem_t pm)
{
while(pm->m_lock==0){
sleep(1);
}
//get lock
pm->m_lock = 0;
}
void unLock(pmem_t pm)
{
... |
C | #include <stdio.h>
#include <string.h>
#include <assert.h>
#include <math.h>
double parse_and_evaluate_expression(const char* expression,double v_x,double v_y,double v_z,double r_x,double r_y,double r_z,double t);
enum NodeID
{
OPENBRACKET,
CLOSEBRACKET,
POSITIVE,
NEGATIVE,
PLUS,
MINUS,
TIMES,
DIVIDE,
EXP... |
C | #include "ch09.h"
int main(){
pid_t i;
i=vfork();
if(i<0){
printf("Vfork faild!\n");
exit(-1);
}else if(i==0)
{
printf("child : pid = %d ppid=%d,i=%d\n",getpid(),getppid(),i);
_exit(0);
}else{
wait(NULL);
printf("parent : pid = %d ppid=%d,i=%d\n",g... |
C | //-------------------------------------------------
//Date: 27.07.2020
//Autor: Vlaimir Draga
//S. Prata. Chapter 11
// Programming exercise 2
//-------------------------------------------------
/*
Text programmming exersice.
2. Modify and test the function in exercise 1 so that it stops after n characters or after ... |
C | #include "main.h"
void DFSR(int* arr, int* curr, int n, int m, int* cache, int* sort) {
int c;
cache[m/n] = 1;
for(c=0;c<n;c++) {
if(arr[m+c] && !cache[c]) {
DFSR(arr, curr, n, c*n, cache, sort);
}
}
sort[*curr-1] = m/n;
//sort[m/n] = *curr;
(*curr)--;
}
void TopologicalSorting(int* arr,... |
C | #include <Security/Security.h>
#include <Security/SecKeyPriv.h>
#include <Security/SecItem.h>
#include <CoreFoundation/CoreFoundation.h>
#include <stdlib.h>
#include <unistd.h>
#include "testmore.h"
#include "testenv.h"
#include "testcssm.h"
#include "testleaks.h"
void AddKeyCFTypePairToDictionary(CFMutableDictionar... |
C | #include <stdio.h>
int myfunc(int a, int b)
{
// auto int var;
static int var;
var++;
printf("The value of var is %d.\n", var);
// return var;
}
int main(int argc, char const *argv[])
{
int a, b;
printf("Enter the first number:- ");
scanf("%d", &a);
printf("Enter the first number:-... |
C | #include <stdio.h>
int isprime(x){
int i;
if (x < 2) return 0;
for (i = 2; i * i <= x; i++)
if (x % i == 0) return 0;
return 1;
}
int main(){
int x;
scanf("%d", &x);
if (isprime(x)) printf("YES\n");
else printf("NO\n");
return 0;
}
|
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 | /*
* timer.c
*
* Created: 2/15/2013 11:32:19 PM
* Author: XxXx
*/
#include <stdbool.h>
#include "timer.h"
#include "general/unions.h"
//#####################################################
TimerServiceAddresses Timer_ServiceAddresses;
#ifdef TC0_BYTEM_bp
#define TC0_BYTEM_gp TC0_BYTEM_bp
#endif
#ifdef TC0_BYT... |
C | //---------------------------------------------------------------
// Bank Management System
//---------------------------------------------------------------
/*It provides functions to:
- open a new account
- close (delete) an account
- make a deposit
- make a withdrawal
- make an inte... |
C |
/* Exercise 2.7
The program uses the invert(x, p, n) function that returns x
with the n bits that begin at position p inverted. */
#include <stdio.h>
unsigned int invert(unsigned int x, int p, int n);
int main(void) {
printf("invert(0xADU, 3, 1) == %X\n", invert(0xADU, 3, 1));
return 0;
}
unsigned... |
C | #include <stdio.h>
#include <string.h>
#define Max_l 50 //单词最长长度
#define Max_n 10000 //最多单词个数
int main()
{
FILE *fp = NULL;
char tokens[Max_n][Max_l]; //存单词
char repeat[Max_n / 2][Max_l]; //存重复的单词
int i = 0;
int j = 0;
int k = 0;
int length = 0; //tokens中元素个数
int r_length = 0;... |
C | /* Dan Nelson
* Graphics Package
* polyline.c
*/
#include "cb_graphics.h"
//////////////////////////////////
///////// POLYLINE FUNCTIONS /////
//////////////////////////////////
/* returns an allocated Polyline pointer initialized so that numVertex is 0 and vertex is NULL. */
Polyline *Polyline_create(void) {... |
C | #include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <sys/sysinfo.h>
#include <gmp.h>
#define SUM_THREADS_PER_CALC 9
typedef struct _CALC_THREAD_CONTEXT
{
unsigned long long st;
unsigned long long end;
pthread_t id;
int threadIndex;
} CALC_THREAD_CONTEXT, *PCALC_THREAD_CONTEXT;
... |
C | #include <stdio.h>
#include <math.h>
int main() {
int n;
scanf("%d", &n);
int result = 0;
for (int i = n ; i > 0; i--) {
int temp = 0;
if (i >= 10 && i < 100) {
temp = i + i / 10 + i % 10;
}
if (i >= 100 && i < 1000) {
temp = i;
int t = temp;
for (int j = 2; j >= 1; j--) {
temp += t / (int... |
C | #include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include "util.h"
/* Christopher Prince [cmp670@nyu.edu], 2017
*
* A naive numerical solver for solving the 2-D Laplace boundary value problem
* -u'' = f,
* u_boundary = 0
* f = 1
*
* Goodness of fit at the k'th iteration is r... |
C | #ifndef INCG_AP_IS_WITHIN_H
#define INCG_AP_IS_WITHIN_H
/*!
* \def AP_IS_WITHIN(v, lower_bound, upper_bound)
* \brief Expands to true if the expression 'v' is within the bounds delimited by
* 'lower_bound' and 'upper_bound', otherwise expands to false.
**/
#define AP_IS_WITHIN(v, lower_bound, upper_bound) \
... |
C | /*Programme to flip bits of a binary number*/
#include<stdio.h>
int main()
{
int num,flip;
printf("Enter a number");
scanf("%d",&num);
flip = ~num;
printf("after flipping bits %d",flip);
return 0;
}
|
C | /**
******************************************************************************
* @file Project/STM32F2xx_StdPeriph_Template/main.c
* @author MCD Application Team
* @version V1.1.0
* @date 13-April-2012
* @brief Main program body
***************************************************************... |
C | def isomor(str1,str2):
m=len(str1)
n=len(str2)
map=[-1]*256
marked=[False]*256
if m!=n:
return False
for i in range(n):
if map[ord(str1[i])]==-1:
if marked[ord(str2[i])]==True:
return False
marked[ord(str2[i])]=True
map[ord(str1[i])]=str2[i]
elif map[ord(str1[i])]!=str2[i]:
return False
... |
C | #include <cs50.h>
#include <stdio.h>
int main(void)
{
int height;
do
{
printf("What is the height?\n");
height = get_int();
}
while (height < 0 || height > 23);
// For each row
for (int row = 0; row < height; row++)
{
// Left side spaces
for (int spaces = 0; spac... |
C | #include <stdio.h>
int main(void) {
// Problem 1
int age = 18;
printf("%d\n", age);
// Problem 2
int oldAge = 2020 - 1962;
printf("%d\n", oldAge);
// Problem 3
int ageDiff = oldAge - age;
printf("%d\n", ageDiff);
}
|
C | /*
* LedBlinkLib.c
*
* Created on: 202076
* Author: 23864
*/
#include "LedBlinkLib.h"
#define LED_BLINK_NUM 8
LedBlinkStruct *gLedBlinks[LED_BLINK_NUM];
int gLedBlinksNum = 0;
void LedBlinkInit(LedBlinkStruct* led, LedBlinkSwitch on, LedBlinkSwitch off)
{
led->on = on;
led->off = off;... |
C | #include "stdafx.h"
#define MAXNUM 999999
//Returns the length of the Collaz sequence starting at a given nuber
//Cache implemented for faster lookups
int computeCollaz(long long int num, int * collCache){
//Check if we will be beond the bounds of the cache
if (num <= MAXNUM){
//Check if cache value not filled
i... |
C | #include"holberton.h"
/**
* _isdigit - print 1 if c is a digit and 0 otherwise
* @c: takes int
* Return: return 0 or 1
*/
int _isdigit(int c)
{
if (c >= '0' && c <= '9')
return (1);
else
return (0);
}
|
C | #include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<fcntl.h>
#include<string.h>
// O_RDONLY Read
// O_WRONLY Write
// O_RDWR Read + Write
int main()
{
char Fname[20];
int fd = 0; // File descriptor
printf("Enter file name to open\n");
scanf("%s",Fname);
fd = open(F... |
C | #include "memory.h"
uint32_t align_up(uint32_t n, uint32_t a)
{
uint32_t m = n % a;
if (m == 0) {
return n;
}
return n + (a - m);
}
uint32_t align_down(uint32_t n, uint32_t a)
{
return n - (n % a);
}
|
C | #include "jalaali.h"
static inline int mfloor(double d)
{
return (int)d;
}
static inline int leap_solar(int year)
{
return ((year % 4) == 0) && (!(((year % 100) == 0) && ((year % 400) != 0)));
}
static inline double mod(double a,double b)
{
return a - (b * mfloor(a / b));
}
static inline ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int N, binCapa, objSize;
void Init(int *tree, int *player) {
int k, p;
for (k = 1; k <= N; k += 2) {
p = (k + N - 1) / 2;
tree[p] = k;
}
for (k = (N - 1) / 2; k > 0; k--)
tree[k] = tree[k * 2];
for (k = 1; k <= N; k++)
player[k] = binCapa;
}
v... |
C | /*
* Console.c
*
* Created on: 22.01.2017
* Author: Erich Styger
*/
#include "Console.h"
#include "ConsoleRx.h"
#define CONSOLE_USE_LPUART 0 /* LPUART or debug console */
#define CONSOLE_USE_UART 1
#if CONSOLE_USE_LPUART
#include "fsl_lpuart.h"
#elif CONSOLE_USE_UART
#include "fsl_uart.h"
#elif... |
C | #include "comparaisons.h"
#include <time.h>
int main()
{
// lecture et creation d'une instance de Chaines et de Reseau
FILE* f = NULL;
f = fopen("00014_burma.cha", "r");
Chaines *c = lectureChaines(f);
fclose(f);
// construction du reseau, hachage et arbre
// avec calcul du temps, et son e... |
C | /* https://stackoverflow.com/questions/215557/how-do-i-implement-a-circular-list-ring-buffer-in-c */
#include <stdio.h>
#include <assert.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdint.h>
typedef uint8_t fifo_data_t;
typedef struct {
size_t head;
size_t tail;
size_t size;
fifo_data_t *buffer;
} fifo_... |
C | /*
* LE TAN PHUC
* MSSV: 50902003
* MT09KTTN
*
* LAB 2 Parallel Programming witH MPI
* PROBLEM 3.2 RING PROCESS
*/
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#define N 50
#define TARGET 10
int main(int argc, char **argv){
int rank,size;
int numberPerProc... |
C | #include <stdio.h>
#include <sys/stat.h>
int
main(void) {
struct stat st;
int r;
printf("offset __pad1 %d\n", (void *) &st.__pad1 - (void *) &st);
printf("offset st_ino %d\n", (void *) &st.st_ino - (void *) &st);
printf("sizeof stat %d\n", sizeof(st));
r = stat(".", &st);
if (r == 0) {
printf("is dir %d\n", ... |
C | //
// Created by Mohammad Rashedul Islam on 2018-12-14.
//
#include<stdio.h>
int main() {
for (int i = 2; i <= 100; i+=2) {
printf("%d\n", i);
}
return 0;
}
|
C | #include "main.h"
I2C_HandleTypeDef hi2c1;
#define slaveaddress 0xD0 // Address of MPU6050 sensor
int16_t ax,ay,az; // To save the 16 bit data from sensor
float xaccel,yaccel,zaccel;// Which will contain the final output values
void SystemClock_Config(void);
static void MX_GPIO_Init(void);
static... |
C | #include <stdio.h>
#include <time.h>
int main(int argc, char *argv[]){
time_t tim;
struct tm *localtim;
if(time(&tim) != (time_t)-1){
localtim = localtime(&tim);
if(localtim != NULL){
printf("Year: %d\n", localtim->tm_year + 1900);
}
}
return 1;
}
|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* unique_solution.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <ctype.h>
#ifndef MAX_NAME_LENGTH
#define MAX_NAME_LENGTH 65
#endif
#ifndef MAX_PHONE_NR_LENGTH
#define MAX_PHONE_NR_LENGTH 15
#endif
typedef struct patient
{
char name[MAX_NAME_LENGTH];
short unsigned year;
char pho... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_set_ant_path.c :+: :+: :+: ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* philosopher_state.c :+: :+: :+: ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_read_dir.c :+: :+: :+: ... |
C | /*********************************************************************/
/* MovieLab.c: source file for the main function */
/* */
/*********************************************************************/
#include <stdio.h>
#include <st... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <netdb.h>
#include <netinet/in.h>
#include <string.h>
#include <dirent.h>
#include <stdbool.h>
#include <wchar.h>
/*
*P
* Programm erkennt nicht das wirkliche Ende eines Files oder Übertragunsproblem
* Pr... |
C | #include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#ifdef __unix__
#include <unistd.h>
#elif __MSDOS__ || __WIN32__ || _MSC_VER
#include <io.h>
#endif
int main(void)
{
int fh;
char puffer[100];
strcpy(puffer, "Dieser Text steht in \"test.txt\n");
if((fh=open("text.txt", O_RDWR | O_C... |
C | #include <bgbsvm.h>
bsjVar BSVM_J2Arith_BinaryOpVarTy(bsjContext ctx,
bsjVar larg, bsjVar rarg, int op, bsjType ty)
{
BSVM_Jit2_StubError(ctx);
return(NULL);
}
bsjVar BSVM_J2Arith_AddVarTy(bsjContext ctx,
bsjVar dst, bsjVar src, bsjType ty)
{
return(BSVM_J2Arith_BinaryOpVarTy(ctx, dst, src,
BSVM_JIT2_BINOP_ADD... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
char* capitalAlphabetGenerator(){
char* capital_alphabets = malloc(27 * sizeof(char));
int i = 0;
capital_alphabets[i] = 'A';
for(i=1; i<26; i++){
capital_alphabets[i] = (char)((int)capital_alphabets[i-1] + 1... |
C | /*
* Lattice Panel: LED display interface
*
* Output ports are configured in system_init()
*
* Control Lines:
*
* DIN PC6 Display Inhibit - driven by PWM for dimmer
* TOP PC7 Data for panel top shift reg
* BOT PC8 Data for panel bottom shift reg
* CLK PC9 Panel shift register clock
* LCH PC10 Panel shift reg... |
C | /***********************************************************************************************************************************
Error Handler
Implement a try ... catch ... finally error handler.
TRY_BEGIN()
{
<Do something that might throw an error>
}
CATCH(Error1)
{
<Handle Error1>
}
CATCH(Error2)
{
... |
C | //
// Convert a binary file to a PNG image and then decrypt it back to binary.
//
// Binary to PNG :
// Each bytes of the binary file are converted to numbers (0-255), which will then define a pixel color.
// For each bytes will be a grayscale pixel in the final PNG image.
// The PNG image can have more pi... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
char dic[100005][105];
char word[105];
int candicate[100005];
int n,q, count = 0;
int isIn(char word[]){
for(int i = 0; i < n; i++){
if(strcmp(dic[i], word) == 0){
return 1;
}
}
return 0;
}
int check1(char* str1, char* str2, int alen){
... |
C | #include<stdio.h>
int main()
{
int num,i,quant=1;
printf("Os 5 primeiros multiplos de 3: \n");
for(i=0;i<=4;i++)
{
num=3*quant;
printf("%i\n",num);
quant++;
}
return 0;
}
|
C | #include<stdio.h>
#include <unistd.h>
// 学生数と学生の名前の最大文字数を定義
#define NUMBER 5
#define NAME_LEN 64
// Student構造体
typedef struct {
char name[NAME_LEN];
int height;
float weight;
long schols;
} Student;
void sort_by_height(Student a[], int n);
// Student構造体のソート
void main() {
Student s[NUMBER];... |
C | #include <stdio.h>
#define PAY_RATE 12
#define TAX_300 .15
#define TAX_150 .20
#define TAX_REST .25
#define OVER_TIME 40
#define PAY_EXTRA 18
int main()
{
int hours;
double gross_pay, net_pay, taxes;
printf("Enter the number of hours worked in this weak:\n");
scanf("%d", &hours);
if(hours <= 40)
{
gross_pa... |
C | //******************************************************************************
//
// KS10 Console Microcontroller
//
//! FATFS Directory Command
//!
//! This function generates a directory listing.
//!
//! \file
//! dir.c
//!
//! \author
//! Rob Doyle - doyle (at) cox (dot) net
//
//***************************... |
C |
// === Libraries and header files ===
#include <stdio.h>
#include <stdlib.h>
#include "callib.h"
#include <string.h>
/// @privatesection
// === Constants and Macro definitions ===
// === Enumerations, structures and typedefs ===
// === Global variables ===
// === Function prototypes for private functions with fi... |
C | #include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<stdbool.h>
#define loop(i,n) for(i=0; i<n; ++i)
#define inp(x) scanf("%d",&x)
#define PCOUNT 5
#define RCOUNT 3
int processCount , resources , i, j, k;
int available[RCOUNT];
int maxNeed[PCOUNT][RCOUNT];
int need[PCOUNT][RCOUNT];
int allocated[PCOUNT][RC... |
C | /* ヘッダファイルのインクルード */
#include <stdio.h> /* 標準入出力 */
#include <locale.h> /* ロケール */
#include <wchar.h> /* ワイド文字 */
/* main関数の定義 */
int main(void){
/* ロケールのセット. */
setlocale(LC_ALL, "ja_JP.EUC-JP"); /* setlocaleでLC_ALL, "ja_JP.EUC-JP"をセット. */
/* ファイルを開く. */
FILE *fp = fopen("test.txt", "w"); /* fopenで"test.txt... |
C | #include <stdio.h>
#include <stdlib.h>
int *compare(const void *x, const void *y) {
return *(int*)y - *(int*)x;
}
int main(int argc, char *argv[]) {
int array[argc - 1];
for (int i = 1; i < argc; i++) {
array[i - 1] = atoi(argv[i]);
}
qsort(array, argc - 1, sizeof(int), compare);
for (... |
C | /**
* \file sauvegarde.c
* \brief Fichier gérant la sauvegarde et le chargement d'une partie
* \author Tony Marteau, Dimitri Bernot, Marvin Jean
* \version 1.0.0
* \date 18 décembre 2015
*/
#include "../inc/general.h"
void Sauvegarde(t_carte carte, t_personnage personnage) {
FILE * sauvegarde;
int i,j;
sauvegar... |
C | #include <stdio.h>
#include <math.h>
void pieceOfCake(){
double a,b,c,s1,s2;
scanf("%lf %lf %lf\n",&a,&b,&c);
s1 = a - b;
s2 = a - c;
if(b > s1){
s1 = b;
}
if(c > s2){
s2 = c;
}
printf("%d\n",(int)(s1*s2*4));
}
void loop(int iter){
int i;
... |
C | #include <stdio.h>
int jdz(int x)
{
if(x<0)
return(-x);
else
return x;;
}
int main(void)
{
int a,b;
int temp;
int i,j;
int x[100];
do{
scanf("%d",&a);
for(i=0;i<a;i++){
scanf("%d",&x[i]);
}
for(i=0;i<a-1;i++){
for(j=i+1;j<a;j++)
if(... |
C | /* solution to labs
display 1-10 in reverse order(seperate line)
21/10/2015
*/
#include <stdio.h>
main()
{
int i= 10;
while(i>0)
{
printf("%d\n", i);
i --;
}//end while
}//end main |
C | #include <stdio.h>
main() {
int c,count;
while ((c=getchar())!=EOF) {
if (c==' ' || c=='\t' || c=='\n')
count++;
}
printf("Special count: %d\n",count);
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
int main(int argc, char *argv[]){
if(argc>2) perror("Too many arguments");
//opening the file with URLs and read every URL
FILE *urls=fopen("URLs.txt","r+");
char ... |
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 | /*
Libreria di Debug
*/
#include <stdio.h>
#define critical 5
#define error 4
#define warning 3
#define notice 2
#define info 1
int dbcurrent=4;
typedef struct errore errorstack;
struct errore
{
int livello;
errorstack* next;
};
void printdebug(errorstack* head)
{
if(head->livello>=dbcurrent)
{
printf("%d",... |
C | #include<stdio.h>
#include<sys/stat.h>
#include<stdlib.h>
#include<fcntl.h>
#include<string.h>
#include<unistd.h>
#include<sys/types.h>
int main(int argc,char *argv[]){
if(argc != 3){
printf("Usage: ./a.out [input_filename] [output_filename]\n");
return 0;
}
int fd1,fd2;
of... |
C | #include<stdio.h>
int main()
{ int inc;
printf("Enter the yearly income in lakhs\n");
scanf("%d", &inc);
if (inc >= 10) {
printf("you have to pay 20 percent tax");
}
else if (inc < 10 && inc >=5 ) {
printf("you will have to pay 10 percent tax \n");
}
else if (inc < 5 && inc... |
C | // Número de finais, L1c - 14
#include <stdio.h>
main(){
int nTimes, k = 1, i = 1, j = 2, partidas;
scanf("%d", &nTimes);
if (nTimes < 2){
printf("Campeonato invalido!\n");
return 0;
}
// Fórmula da combinação, com n = nTimes e sempre p = 2.
partidas = ((nTimes) * (nTimes - 1)) / 2;
for (k;... |
C | /*******************************************************************************
*
* *This program takes an expression as input and parses it for balanced
* *parentheses, brackets, and curly braces.
*
* ****************************************************************************/
#include <stdbool.h>
#include <st... |
C | /**
* \file include/types.h
* \brief Contains several architecture independant types definitions.
*
* Includes the types header of the target architecture.
*/
#ifndef TYPES_H
#define TYPES_H
#ifdef __ARCH_x86__
#include <x86/types.h>
#else
#error "Target architecture undefined for types.h"
#endif
#define NULL ((voi... |
C | // vista.h
//
//
// Created by Mauricio de Garay on 15/02/2021.
//
//
#include <stdio.h>
#include <stdlib.h>
#ifndef vista_h
#define vista_h
#ifndef vista_IMPORT
#define EXTERN
#else
#define EXTERN extern
#endif
/* Function prototypes. */
/*
* La función vistaLimpiaBuffer se encarga de limpiar el buffer ... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct{
int year;
int month;
int day;
char category[32];
int expense;
}Expense;
int compare(const void* a, const void* b){
Expense ea = *(Expense*)a;
Expense eb = *(Expense*)b;
if (ea.year != eb.year) return ea.year - eb.y... |
C | #include<stdio.h>
#include<string.h>
int main()
{
char a[102],b[102];
int i,j,p,k,N,n,m,max;
scanf("%d",&N);
while(N--)
{
scanf("%s %d",a,&m);
n=strlen(a);
for(i=p=k=0;i<n-m;i++,k++)
{
max=-1;
for(j=p;j<=m+k;j++)
{
if(a[j]>max)
{
max=a[j];
p=j+1;
}
}
b[k]=max;
}
b[k]='\0';
print... |
C | /*
** EPITECH PROJECT, 2018
** my_print
** File description:
** display
*/
#include "../../rush3.h"
#include <unistd.h>
void my_putchar(char c)
{
write(1, &c, 1);
}
void my_putstr(char *str)
{
int i = 0;
while (str[i]) {
my_putchar(str[i]);
i++;
}
}
void my_put_nbr(int nb)
{
int... |
C | #include <stdio.h>
/* This program demonstrates a few builting math functions of C.
* sqrt() = returns square root of a floating-point value
* pow() = returns the result of a floating point value raised to
* a certain power
* abs() = returns tha absolute value (positive) of an integer
* floor() = rounts up a fl... |
C | #include<stdio.h>
#include<stdlib.h>
void main() {
/*Reading four file continuously using fopen() function file name are datasetLR1,datasetLR2,
datasetLR3 And datasetLR4. where x1,x2,x3,x4 are the X data of each file, y1,y2,y3,y4 are
the Y data of each file, x1sq, x2sq, x3sq, x4sq X square data of each file, y1sq, ... |
C | //
// Javier Abelln. 22 Mayo 2002
// Programa para demostracin del uso de semforos
//
#include <stdio.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/sem.h>
#include <stdlib.h>
//
// Esta union hay que definirla o no segn el valor de los defines aqui
// indicados.
//
#if defined(__GNU_LIBRARY__) ... |
C | /******************************************************************************
GHAAS F Function Library V1.0
Global Hydrologic Archive and Analysis System
Copyright 1994-2013, UNH - CCNY/CUNY
FData.c
Unknown
*******************************************************************************/
#include <cm.h>
#include <... |
C | #include <stdio.h>
int main () {
int input;
printf("양수를 입력하시오.\n");
scanf("%d", &input);
if (input >= 0){
if (input % 2 == 0)
printf("입력한 수 %d는 짝수입니다.\n", input);
else
printf("입력한 수 %d는 홀수입니다.\n", input);
}
else{
printf("입력한 수 %d는 음수입니다.\n", input);
}
return 0;
}
|
C |
#include <stdio.h>
void main()
{
int i,num, orginal_num, sum, largest_sum = 0, largest_number;
for(i = 1; i <= 5; i++)
{
printf("Enter a number :");
scanf("%d",&num);
sum = 0;
orginal_num = num;
while(num) {
sum += num % 10;
num /= 10;
... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>
int main() {
printf("%d ", K_PowerOf_N(3, 4));
system("pause");
}
int K_PowerOf_N(int n,int k) {
if (k == 1) {
return n;
}
else {
return K_PowerOf_N(n, k - 1) * n;
}
} |
C | #include "funciones.h"
int main(int argc, char** argv){
//Creacion pipe
int *pipe1 = (int*)malloc(sizeof(int) * 2);
if(pipe(pipe1) == -1){
printf("Error en syscall PIPE\n");
exit(-1);
};
//Recibe imagen mediante pipe de la etapa anterior
JPG* img = (JPG*)malloc(size... |
C | #include "client.h"
CLIENT* newClient(char* id)
{
CLIENT* n=(CLIENT*)calloc(1,sizeof(CLIENT));
if(n)
{
n->id=id;
n->online=0;
}
return n;
}
void put_online(CLIENT* su,int socket)
{
su->socket=socket;
su->online=1;
sendS(su,NULL,NULL);
}
void put_offline(CLIENT* su)
{
su->online=0;
su->socket=-1;
}
lis... |
C | #include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <errno.h>
#define FLAT_INCLUDES
#include "../array/range.h"
#include "../array/buffer.h"
#include "path.h"
#include "../log/log.h"
#include "../keyargs/keyargs.h"
#include "../buffer_io/buffer_io.h"
/*
static... |
C | /*
exponenciacao.c
Funções que calculam integrais através de Exponenciacao simples e dupla*/
#include "exponenciacao.h"
#include <stdio.h>
#include <stdlib.h>
#include <cmath>
#define E 2.71828183
//Cria a lista de termos do Polinômio
TipoLista* crialista()
{
TipoLista* Lista = (TipoLista*) malloc(sizeof(Tip... |
C | /*-------------------------------
Author - Rohit Kumar Bindal
Roll Number - 2017Btechcse306
------------------------------*/
#include<stdio.h>
#include <process.h>
#define SIZE 5
int q[SIZE];
int f=0;
int r=0;
void display(){
int temp,i;
temp=f;
printf("The Queue is: ");
for(i=temp;i<r;i++){
p... |
C | //
// Population Synthesis of Planet Formation
//
// trap.c
//
//
// Created by Takanori Sasaki
// 2016/05/03
//
//
#include "header.h"
void trap(int *n, double a[], double Mp[], double *M, int type[])
{
int i, j, k;
double a_m, rH, l1, l2, ll, ll2;
for (i=0; i<(*n)-1; i++) {
if (type[i] == 0 || type[... |
C | #include<stdio.h>
int main(){
double s0,s,v0,v,a,t;
printf("Insira o valor do S0:");
scanf("%lg",&s0);
printf("Insira o valor do V0:");
scanf("%lg",&v0);
printf("Insira o valor da aceleração:");
scanf("%lg",&a);
printf("Insira o valor do tempo:");
scanf("%lg",&t);
s=s0+v0+(a*t*t)/2;
v=v0+a*t;
printf("O s se... |
C | /*
** ftp_port.c for my_ftp in /home/vencat_a/rendu/PSU/PSU_2015_myftp/src/server
**
** Made by Axel Vencatareddy
** Login <vencat_a@epitech.net>
**
** Started on Sat May 14 14:13:53 2016 Axel Vencatareddy
** Last update Sat May 14 14:13:53 2016 Axel Vencatareddy
*/
#include "functions_ptr.h"
#include "socket.h"
... |
C | #include <windows.h>
#include <stdio.h>
#include <errno.h>
int main(int argc, char* argv[])
{
int i;
if (argc < 3) {
fprintf(stderr, "tup-cp [sources...] [destination]\n");
exit(-1);
}
for (i = 1; i < argc - 1; i++) {
if (!CopyFileA(argv[i], argv[argc-1], FALSE)) {
perror("copy");
}
}
return 0;
}
|
C | #include<stdio.h>
int main()
{
char Szstr[50]="hello,world";
char s[100];
printf("enter your string ");
gets(s);
printf("%s\n%s",Szstr,s);
return 0;
}
// we use %s format specifier scanf read input upto but not first void space charcter (tab,in space ) it apand NULL charrater \0 then store in our memory whole a... |
C | /*
Patrick Copp
1007602
Assignment 2
February 2019
*/
#include <stdio.h>
#include <time.h>
void bruteForce2(double values[30000][2]);
int bruteForce(int [50000]);
int mergeSort(int arr[], int temp[], int left, int right);
int mergeArrays(int arr[], int temp[], int left, int mid, int right);
void convexHull(double valu... |
C | #include <stdio.h>
/*
** ұ߿ʼλΪ1ĸ
*/
int count_bit_1(int m)
{
int count = 0;
while(m)
{
if(m & 1)
count++;
m = m >> 1;
}
return count;
}
/*
** ߿ʼλΪ1ĸ
*/
int count_bit_2(int m)
{
int count = 0;
while(m)
{
count++;
m = ... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i = 0;
int j = 0;
for (i = 0; i <= 6; i++)//ϰ벿
{
for (j = 0; j <= 6-i; j++)
{
printf(" ");//ո
}
for (j = 0; j < 2 * i + 1; j++)
{
printf("*");//Ǻ
}
printf("\n");
}
for (i = 0; i <= 6; i++)//°벿
{
for... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.