language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /**
* @file
*
* The unit tests execution binary.
*
* @author Sergio Benitez
* @date 09/03/2014
*/
#include "test.h"
/**
* The main function. Simply calls the test utils begin_testing function, which
* sets up the testing world and calls the _main_test_function.
*
* @param argc Number of command line argume... |
C | #include <stdio.h>
#include <stdlib.h>
char isLetter(char a)
{
if (('a' <= a && a <= 'z') || ('' <= a && a <= ''))
{
return a;
}
else if ('A' <= a && a <= 'Z')
{
return a - ****;
}
else if ('' <= a && a <= '')
{
return a - ****;
}
else
{
retur... |
C | #include<stdio.h>
#include<conio.h>
void main()
{
int a,s,d,sum=0,i,lt;
printf("enter the first number of A.P:");
scanf("%d",&a);
printf("enter the totalnumber of A.P:");
scanf("%d",&s);
printf("enter the difference of A.P:");
scanf("%d",&d);
sum=(s*(2*a+(s-1)*d))/2;
lt=a+(s-1)*d;
printf(" %d sum of A.P series:");
for(... |
C | #include <stdio.h>
#include <stdlib.h>
#include <netdb.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <errno.h>
#define MAXRCVLEN 1024
#define PORTNUM 5555
int main(int argc, char *argv[])
{
char *ms... |
C | #include"game.h"
void menu()
{
printf("**********************************\n");
printf("***** 1.play *****\n");
printf("***** 0.exit *****\n");
printf("**********************************\n");
}
void game()
{
//printf("ɨϷ\n");//һϷɣ⡣
//1.Ϣ洢
char mine[ROWS][COLUMNS];//1.ѾúõϢ
char sh... |
C | /*
* simple shell
*/
#include "os.h"
#define MAXARGS 24
#define MAXLINE 128
void eval(char *cmd);
void parseline(char *buf, char **argv);
int buildin_command(char **argv);
int main(void) {
char cmd[MAXLINE];
while (1) {
printf("> ");
Fgets(cmd, MAXLINE, stdin);
if (feof(stdin)) {
... |
C | #include <stdio.h>
int main()
{
int l,n;
scanf("%d",&l);
scanf("%d",&n);
int w[n];
int h[n];
int i;
for(i=0;i<n;i++)
{
scanf("%d%d",&w[i],&h[i]);
}
for (i=0;i<n;i++)
{
if (w[i]<l || h[i]<l)
{
printf("UPLOAD ANOTHER\n");
}
else if(w[... |
C | #include<stdio.h>
#include<string.h>
struct k
{
char name[100];
int id;
char phno[13];
char acno[13];
long int inc;
}d;
int authent(char a[],int b,int c)
{
int cnt=0,i=0;
FILE *p;
p=fopen("C:\\Users\\user\\Documents\\file\\PR0.txt","r+");
while(i<c)
{
fscanf(p,"%s%d%s%s%*d",d.name,&d... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <fcntl.h>
#include <sys/sendfile.h>
#define BUF_SIZE 1024
#define SMALL_BUF 100
char webpage[] =
"HTTP/1.1 200 OK\r\n"
"Server:Linux Web Server\r\n"
"Content-Type: text/html; charset=... |
C | /*
Escreva programa para resolver uma equação de segundo grau, dados os valores dos coeficientes a, b, c ( equação: y = a*x*x + b*x + c)
*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main() {
float a, b, c; // variaveis de entrada
float delta, x1, x2;
printf("EQUACAO DO SEGUNDO GRAU\n");
pr... |
C | #ifndef LLIST_H
#define LLIST_H
#include <stdlib.h>
struct llist{
long type;
struct llist* next;
};
typedef struct llist llist;
llist* llist_head ;
void ll_add( llist* head, long element);
void ll_remove( llist* head, long element);
int ll_isIn( llist* head, long element);
int ll_isEmpty( ... |
C | //
// RegularExpressionExample.h
// pangu
//
// Created by King on 2017/4/15.
// Copyright © 2017年 zby. All rights reserved.
//
/*
1.验证数字:
只能输入1个数字
表达式 ^\d$
描述 匹配一个数字
匹配的例子 0,1,2,3
不匹配的例子
2.只能输入n个数字
表达式 ^\d{n}$ 例如^\d{8}$
描述 匹配8个数字
匹配的例子 12345678,22223334,12344321
不匹配的例子
3.只能输入至少n个数字
表达式 ^\... |
C |
#include <stdio.h>
#include <stdlib.h>
typedef struct temp{
int Data;
struct temp* pointer;
} Fila;
Fila* beginning = NULL;
Fila* ending = NULL;
Fila* pointer = NULL;
int head = 0 , tail = 0;
void Queue(int Data){
if(beginning == NULL){
ending = beginning = (Fila*)malloc(si... |
C | /*
* Ronald Rey Lovera (reyronald@gmail.com)
* Smailyn Peña Núñez (smailyn.p@gmail.com)
* Última modificación: Viernes 30 de agosto de 2013
* Rover bot, Hands-On Competition, Intec
* Versión Final
* Ingeniería Mecatrónica
*/
#include <Servo.h>
#include <QTRSensors.h>
#include <stdio.h>
#include <math.h>
// Rep... |
C | #include "Internal.h"
// ---------------------------------------------------
// ---------------------------------------------------
// ---------- NEPTUNE METHODS ----------
// ---------------------------------------------------
// ---------------------------------------------------
void insertWindowInto... |
C | #include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#ifndef __KERNEL__
double strtod_soft( const char *nptr, char **endptr )
{
int i, n;
char *period_at;
char *dash_at;
char *exponent_at;
char *ep = 0;
int64_t ival, frac, div, exp;
double f, f_frac;
period_at = strchr(nptr, ... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
char** split_str(char* src, const char* delim, int* length)
{
char ** res = NULL;
int n_delim = 0, i;
char * p = strtok (src,delim);
/* split string and append tokens to 'res' */
while (p) {
res = realloc (res, sizeof (char*) * ++... |
C | // P65 P66 ݿ
#define DQ_H P6OUT|=BIT5
#define DQ_L P6OUT&=~BIT5
void delay_ms1(unsigned int t)
{
while(t--)
{
_NOP();
}
}
unsigned char Read_DS(void)
{
unsigned char i=0 ,v=0;
for(i=8;i>0;i--)
{
P6DIR|=BIT5;
DQ_L;
v>>=1;
DQ_H;//setfree bus
... |
C | #pragma once
inline float32x4_t accurate_rcp(float32x4_t x)
{
float32x4_t r = vrecpeq_f32(x);
return vmulq_f32(vrecpsq_f32(x, r), r);
}
// approximation : lgamma(z) ~= (z+2.5)ln(z+3) - z - 3 + 0.5 ln (2pi) + 1/12/(z + 3) - ln (z(z+1)(z+2))
inline float32x4_t lgamma_ps(float32x4_t x)
{
float32x4_t x_3 = vaddq_f32(x... |
C | //
// main.c
// VTV4002-2
//
// Created by Chel Long on 3/2/19.
// Copyright © 2019 Chel Long. All rights reserved.
//
#include <stdio.h>
void output (int a[], int n) {
for (int i=0; i<n; i++) {
printf("%d ", a[i]);
}
}
void insertionSort(int s1[], int s2[], int n) {
int key1, key2, j1, j2;
... |
C | //Ozan Gazi onder
//windows version of homework 2
#include <stdio.h>
#include <windows.h>
int main(int argc,char *argv[])
{
HANDLE handleIn1,handleIn2;
HANDLE handleOut = GetStdHandle (STD_OUTPUT_HANDLE);
DWORD nIn=0;
DWORD nOut=0;
DWORD countbyte = 0;
char* buf;
int size = 512;
buf = (char*) HeapAlloc (GetProcessHea... |
C | #pragma once
#include <pebble.h>
#include "math_fixed.h"
#include "gtypes.h"
//! @addtogroup Graphics
//! @{
//! @addtogroup GraphicsTransforms Transformation Matrices
//! \brief Types for creating transformation matrices and utility functions to manipulate and apply
//! the transformations.
//!
//! @{
////////... |
C | #include "myapue.h"
#include <semaphore.h>
int main(int argc, char **argv)
{
int c, flags;
sem_t *sem;
unsigned int value;
flags = O_RDWR|O_CREAT;
value = 1;
while ((c = getopt(argc, argv, "ei:")) != -1) {
switch(c) {
case 'e':
flags |= O_EXCL;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
/* Puzzle B02 -- determine experimentally how often rand() returns RAND_MAX */
const int N = 1000 ;
int main(int argc, char *argv[])
{
int i, j;
int count = 0;
srand( time(NULL) );
for ( i=0; i<N; i++ )
for ( j=0; j<RAND_MAX; j++ )
... |
C | /*
* Advent of Code 2015 Day 20
*
* Brute force solution that uses Darwin's Dispatch Queues. Only compiles
* on macOS. Will use all available cores to split up the problem space.
*
* cc -Ofast day20.c && time ./a.out
*/
#include <stdio.h>
#include <dispatch/dispatch.h>
#define INPUT 33100000
#define NUM_HOUSES... |
C | /*
** EPITECH PROJECT, 2021
** B-MUL-200-RUN-2-1-mydefender-ludovic.peltier
** File description:
** tower_ai
*/
#include "game.h"
#include <stdio.h>
void func_select(game_t *game, int i, int z)
{
switch (game->place[i].state)
{
case 1:
game->enemy[z].life -= 1;
sfCi... |
C | #define _XOPEN_SOURCE 700
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/wait.h>
#define check_error(expr, userMsg)\
do{\
if(!(expr)){\
fprintf(stderr, "%s\n", userMsg);\
exit(EXIT_FAILURE);... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils.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 |
/*
Compute the factorial of the given number.
Concept: Use of recursion for finding factorial of given number
Base condition is when number<=1 then return 1
Normal flow is return product of number and factorial(number-1)
*/
// Input number only between 1 and 25 because after 25 overflow will occur while cal... |
C | #include "holberton.h"
/**
* add - func to add two integers
* @a: first int
* @b: second int
* Return: results of the addition
*
*/
int add(int a, int b)
{
int r;
r = a + b;
return (r);
}
|
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#define THRESHOLD 7
#define RAND 32
int main(int c, char * a []) {
int r;
char * x;
int d = 0;
srandom(time(0) + getpid());
if (c == 1) {
printf("c\n");
return 0;
}
for (x = ... |
C | #include <stdio.h>
int main(void)
{
char array[101][101];
int N,i,j,statue;
scanf("%d",&N);
getchar();
for(j=0;j<N;j++)
{
for(i=0;i<N;i++)
scanf("%c",&array[j][i]);
getchar();
}
scanf("%d",&statue);
if(statue==1)
{
for(j=0;j<N;j++)
{
for(i=0;i<N;i++)
printf("%c",... |
C | //
// folder_opt.c
// os_c
// 练习用
//
// Created by mac_zyf on 2018/7/2.
// Copyright © 2018年 mac_zyf. All rights reserved.
//
#include "folder_opt.h"
char* getFileType(char* folderName); //获取文件类型
long getFileSize(char* folderName); //获取文件大小
void getPermissionStr(char* folderName, char* result); //获取文件权限字符串
int is... |
C | /*
** detail.c for in /home/garrig_b/KART/me
**
** Made by a
** Login <garrig_b@epitech.net>
**
** Started on Sat Oct 25 03:52:49 2014 a
** Last update Sun Oct 26 22:10:00 2014 a
*/
#include <ncurses.h>
#include <stdlib.h>
#include "../includes/mario.h"
void tree()
{
addstr(" #----------------#\n| #----------... |
C | // gcc -c -Og act5.c
// objdump -d act5.o
// There are three loops, notice what does and does not change between them.
// Sum the elements of array x
int forLoop(int* x, int len)
{
int i, sum;
sum = 0;
for (i = 0; i < len; i++)
{
sum += x[i];
}
return sum;
}
// ... |
C | #include <stdio.h>
int main(int argc, char* argv[])
{
int i;
unsigned long int a = 0, b = 0;
for(i = 1 ; i <= 100 ; i++) {
a += i*i;
b += i;
}
b *= b;
printf("%lu\n", b - a);
return 0;
}
|
C | #ifndef LIBBIN_ENDIAN_H__
#define LIBBIN_ENDIAN_H__
#include <stdint.h>
static inline void little_big_swap(void *addr, size_t sz) {
char *p = (char *)addr;
for (size_t i = 0, j = sz - 1; i < (sz >> 1); i++, j--) {
char tmp = p[i];
p[i] = p[j];
p[j] = tmp;
}
}
#define LITTLE_BIG_SWAP(val) little_big_... |
C | /**
@file ADCDriver.c
@author Pete Bartram
@brief
The intention of this module is to collect sensor data from an ADC based upon a SENSOR_NAME.
This is low level code that directly interacts with the ADCs, therefore it also configures
the I2C bus and handled error responses from the communications nodes.
*/
#include "... |
C | #include <stdio.h>
#include <stdlib.h>
#include<string.h>
#include <ctype.h>
#include <math.h>
#include "linkedList.h"
/*This function takes in two strings for name and food group, the number of calories
the food contained and a single character representing the type of food (h for healthy, j for junk).
The func... |
C | #include<stdio.h>
int division(int, long long int *, long long int *);
int main(void)
{
int n;
int num = 0;
long long int a, b;
while(scanf("%lld %lld %d", &a, &b, &n) != EOF)
{
printf("%d.", division(num, &a, &b));
int i;
for(i = 0; i < n; i++)
printf("%d", division(num, &a, &b));
printf("\n... |
C | #include "ft_printf.h"
int int_length(unsigned int n)
{
int res;
res = 0;
while (n > 0)
{
res++;
n /= 10;
}
return (res);
}
int print_int(int n, int zeros, int spaces)
{
int res;
int i;
int len;
int sp = spaces;
len = 0;
res = 0;
i = 0;
... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<string.h>
char* my_swap(char* str,int len)
{
char* stars = str; char* end = str + len;
--end;
char tmp;
while (end > stars)
{
tmp = *end;
*end = *stars;
*stars = tmp;
stars++;
end--;
}
return str;
}
int main()
{
char str[100];
gets(str);
... |
C | #include <stdio.h>
main(){
int ano;
char sexo;
printf("Informe o ano de nascimento: ");
scanf("%d", &ano);
printf("Informe o sexo (M/F): ");
scanf(" %c", &sexo);
if((sexo == 'M') && ((2015 - ano) >= 18))
printf("Servico militar obrigatorio!");
else
printf("isento do servico militar");
}
|
C | #include <stdio.h>
// Julian canlender vs Gregorian canlender
int isLeapYear(int year)
{
if((year%4==0)&&(year%100!=0))
{
return 1;
}
if(year%400==0)
{
return 1;
}
return 0;
}
int days(int year, int month, int day)
{
int res=day;
month--;
switch(month)
{
... |
C | #include "utils.h"
//*************************************************
//! Create and bind the port to an available fd
/*!
\param port
\li The string representation of the port number
\return
\li The new fd on success, -1 otherwise
*/
//*************************************************
int create_and_bind(cha... |
C | int Solution::diffPossible(vector<int> &A, int B) {
int k=1;
for(int i=0;i<A.size()-1&&k<A.size(); ){
int dif=A[i]+B;
if(dif==A[k]&&k!=i) return 1;
if(A[k]>dif) {
i++;
}else{
k++;
}
}
... |
C | #include <stdio.h>
int main_1()
{
int test_case;
int i;
int a, b;
int temp;
int result;
scanf_s("%d", &test_case);
for (i = 0; i<test_case; i++) {
scanf_s("%d %d", &a, &b);
temp = a % 10;
switch (temp) {
case 1:
result = 1;
break;
case 2:
b = b % 4 ;
if (b == 0) result = 6;
else if(b =... |
C | //Sorgente scritto da Marco Meli. Remember, Smagen is the way.
#include <stdio.h>
int massimo (int a, int b, int c);
int main ()
{
int a,b,c, max;
printf ("Inserisci A: ");
scanf ("%d", &a);
printf ("\nInserisci B: ");
scanf ("%d", &b);
printf ("\nInserisci C: ");
scanf ("%d", &c);
max = massimo (a,b,c);
pr... |
C | #ifndef employee_H_INCLUDED
#define employee_H_INCLUDED
typedef struct
{
int id;
char nombre[128];
int horasTrabajadas;
int sueldo;
}Employee;
/** \brief creates a dynamic memory space
*
* \return Employee* returns a pointer to the created memory space
*
*/
Employee* employee_new();
/** \brief cre... |
C | //work21
#include<stdio.h>
#include<string.h>
int main(){
char basic[20][20], new_basic[20][20];
int n;
memset(basic, '\0', sizeof(basic));
memset(new_basic, '\0', sizeof(new_basic));
scanf("%s", basic);
int new_i=0, new_j=0;
for(int i=0; i<20; i++){ ///q@নG
for(int j=0; j<20; j+... |
C | #include <stdio.h>
#define MAX_SIZE 1000
void swap(int *a, int *b);
void bubbleSort(int *arr, int n);
int minSum(int *arr, int n);
int main() {
int arr[MAX_SIZE];
int N;
scanf("%d", &N);
for (int i = 0; i < N; i++)
scanf("%d", &arr[i]);
printf("%d\n", minSum(arr, N));
return 0... |
C | /*
5) Construa um algoritmo que contenha uma lista dinmica homognea para guardar
nmeros digitados pelo usurio, solicite ao usurio a quantidade de nmero e os
nmeros e depois os imprima em tela.
R.:
*/
#include <stdio.h>
typedef struct lista{
int num;
struct lista *prox;
}LISTA;
LISTA* insercao(LISTA* inicio, int n... |
C | #ifndef _MODEL_H_
#define _MODEL_H_
#include <stdint.h>
#include "Insight.h"
/*
Custom model declaration.
Is an array of 4 elements:
- 1st is the vbo id
- 2nd is the vao id
- 3nd is the ibo id
- 4th is the indices count
*/
typedef uint32_t Insight_Model[4];
/*! Returns a pointer to a model in m... |
C | #include <stdio.h>
#include <string.h>
#define MAX_LINE 80
//function main begins program execution
int main(void)
{
//initialize array string
char line[MAX_LINE];//sets
char delim[] = " ,.!;:\n";// sets up word separators
char *words, *ptr;
//counter loop initiation
int count = 0;
... |
C | //
// Created by ids on 18-4-17.
//
#include "unp.h"
void Bind(int fd, const struct sockaddr *sa, socklen_t salen) {
if (bind(fd, sa, salen) < 0) {
printf("bind error\n");
exit(1);
}
}
int Accept(int fd, struct sockaddr *sa, socklen_t *salenptr) {
int n;
again:
if ((n = accept(f... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* parse_command.c :+: :+: :+: ... |
C | #ifndef FILE_SYSTEM_H
#define FILE_SYSTEM_H
void init_bitmap();
void print_bitmap();
void print_blocks();
void init_dir();
void print_ofts();
void print_fds();
//https://stackoverflow.com/questions/389827/namespaces-in-c
typedef struct
{
//create a new file with the specified name sym_name
void (* const create)(c... |
C | /*
This program predicts whether or not a car with a given licence plate
and at a given time can be out on the road from Monday to Friday
according to Pico y Placa restriction in Quito, Ecuador
*/
#include <stdio.h>
int checkPlate(int plateNum);
int checkDate(char *d);
int checkTime(int hour, int minute);
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include "director.h"
int main ()
{
const char* szFilePath = "files//director.xml";
const int DirNum = 3;
Director directors[DirNum];
xmlDocPtr doc = xmlParseFile (szFilePath);
xmlNodeP... |
C | #include<stdio.h>
#include<string.h>
#define N 10001
int judge(int n,char ch,char b[N])
{
int i;
for(i=0;i<n;i++)
{
if(ch==b[i])return 0;
}
return 1;
}
int main()
{
char a[N],b[N];
gets(a);
gets(b);
int i;
for(i=0;i<strlen(a);i++)
{
if(judge(strlen(b),a[i],b))
printf("%c",a[i]);
}
}
|
C | /* *** Definisi ABSTRACT DATA TYPE COMMAND *** */
#ifndef COMMAND_H
#define COMMAND_H
#include "../boolean.h"
#include "../point/point.h"
#define Nil -1
typedef struct
{
/*
BUILD = 1
UPGRADE = 2
BUY = 3
UNDO = 4
*/
/*
ID WAHANA
"Candy Crush" = 11
"Chocolate ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* string.c :+: :+: :+: ... |
C | #include<stdio.h>
int mishu(int n, int x);
int main()
{
int m;
int n;
int x;
scanf("%d %d", &n, &x);
int a[n+1];
int sum = 0;
int i,j;
for(i=0; i<n; i++)
{
scanf("%d", &a[i]);
}
for(j=0; j<n; j++)
{
m = mishu(j, x);
sum = sum + a[j] * m;
... |
C | #include<stdio.h>
int bas,son,dizi[10000][10000],q[3][1000000];
int px,py,n,m,fx,fy;
void fare(int x,int y)
{
while(bas<=son)
{
fx=q[1][bas];
fy=q[2][bas];
bas++;
if(fy+1!=m+1 &&(dizi[fx][fy]+1<dizi[fx][fy+1] || dizi[fx][fy+1]==0))
{
son++;
q[1][son]=fx;
q[2][son... |
C | /**
* \file Partie1.h
* \brief dfinitions des prototypes des fonctions relatives la partie 1
*/
#ifndef FONCTIONSPARTIEUN_H
#define FONCTIONSPARTIEUN_H
#include "constantes.h"
/**
* \fn int** creePalette(DonneesImageRGB *image, int *nombreDeCouleurs)
* \brief Determine le nombre N de couleurs differentes
*
*... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int cm; cm=152.0;
int kg; kg=45.0;
float m; m=cm/100.0;
int bmi; bmi=kg/ (m*m);
printf("bmi=%d\n", bmi);
printf("m=%f\n", m);
}
|
C | #pragma once
#include "vec.h"
struct mat3
{
mat3() :
xx(1.0f), xy(0.0f), xz(0.0f),
yx(0.0f), yy(1.0f), yz(0.0f),
zx(0.0f), zy(0.0f), zz(1.0f) {}
mat3(
float _xx, float _xy, float _xz,
float _yx, float _yy, float _yz,
float _zx, float _zy, flo... |
C | #include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "proc.h"
#include "log.h"
int last_proc;
int proc_slot;
proc_t processes[MAX_PROCESSES];
int proc_spawn(spawn_proc_pt proc, void *args, char *name, int respawn)
{
int s;
pid_t pid;
spawn_proc_pt proc_tmp = proc;
void *args_tmp = args;
fo... |
C | /*
计算最高分
*/
#include <stdio.h>
#define NUMBER 5 /*学生人数*/
int tensu[NUMBER]; /*数组定义*/
int top(void); /*函数top的函数原型声明*/
int main(void) {
extern int tensu[]; /*数组的声明(可以省略)*/
int i;
printf("请输入%d名学生的分数\n", NUMBER);
for (i = 0; i < NUMBER; i++) {
printf("%d:", i + 1);
scanf("%d", &te... |
C | #include <stdio.h>
#include <stdlib.h>
int main (){
char character;
scanf ("%c", &character);
if (character == 'A'|| character == 'I' || character == 'U' || character == 'E' || character == 'O'){
printf ("Vowel");
}
else{
printf ("Consonant");
}
return 0;
}
|
C | /* Ini deklarasi fungsi */
void handleInterrupt21 (int AX, int BX, int CX, int DX);
void printString(char *string); //done
void readString(char *string); //done
void readSector(char *buffer, int sector); //done
void writeSector(char *buffer, int sector); //done
void readFile(char *buffer, char *filename, int *success);... |
C | #include <os_server.h>
#include <sys/socket.h>
#include <sys/poll.h>
#include <sys/un.h>
#include <ftw.h>
#include <worker.h>
#include <fs.h>
static ssize_t datadir_size = 0;
static ssize_t datadir_entries = 0;
void dispatcher_cleanup() {
int err = close(os_serverfd);
if (err < 0) err_close(os_serverfd);
... |
C | #include<stdio.h>
struct line
{
double c;
double x;
double y;
};
struct point
{
double x;
double y;
};
struct line line_equation(struct point p1,struct point p2)
{
struct line l1;
if(p1.x==p2.x && p1.y==p2.y)
{
l1.x=1;
l1.y=0;
l1.c=p1.x;
return l1;
}
else
{
l1.y=(p2.x-p1.x);
l1.x=(p1.y-p2.... |
C | #include "UART.h"
// transmit a char to uart
void uart_transmit( unsigned char data )
{
// wait for empty transmit buffer
while ( ! ( UCSR1A & ( 1 << UDRE1 ) ) )
;
// put data into buffer, sends data
UDR1 = data;
}
// read a char from uart
unsigned char uart_receive(void)
{
while ... |
C | /*
* Copyright (c), 2012, Braveyly
* All rights reserved
*
* File name:qstack.h
* Abstract:stack through queue api
*
* Current version:v0.1
* Author:braveyly
* Date:2012-4-10
* Modification:first version
* Revise version:
* Author:
* Date:
* Modification:
*/
#ifndef _STACK_H
#define _STACK_H
#include <s... |
C | #include "myutils.h"
int main()
{
long int num;
int i;
printf("Enter the Number");
scanf("%d",&num);
i=isPrime(num);
print("%d",i);
printf("\n Factorial of num :%ld",factorial(num));
printf("\n Palindrome :%ld",isPalindrome(num));
printf("\n Vsum is:%ld",vsum(3,3,4,5));
return 0... |
C | #include <stdio.h>
void plusandminus( int a, int b, int * c , int * d );
int main()
{
int a,b,c=0,d=0;
scanf("%d%d",&a,&b);
plusandminus( a, b, &c , &d );//此处调用 plusandminus 函数
printf("%d %d\n" , c , d ); //
return 0;
}
/* 在调试代码时候,你应该在这里完成函数的定义部分的代码,调试好之后提交这段代码 */
void plusandminus( int ... |
C | /*
* Check if assignment is available, where
* operand is structure.
*/
#include <stdio.h>
struct inner {
int a;
int b;
};
struct outer {
struct inner i;
};
int main(void)
{
struct outer o;
struct inner i = { 1, 2 };
o.i = i;
printf("o.i.a = %d, o.i.b = %d\n", o.i.a, o.i.b);
r... |
C | #include <avr/io.h>
#include <avr/interrupt.h>
void UART_putchar(unsigned char data)
{
/* Wait for empty transmit buffer */
while ( !( UCSRA & (1<<UDRE)) );
/* Put data into buffer, sends the data */
UDR = data;
} // end of UART_putchar()
void UART_putstring(unsigned char *txt)
{
uint8_t i;
for(i=0;i<255;i+... |
C | #include <stdio.h>
#include <conio.h>
int main()
{
int range,sequence;
printf("Enter the value of n : ");
scanf("%d",&range);
int a=0,b=1;
printf("%d %d",a,b);
for(int i=1;i<=range-2;i++)
{
sequence=a+b;
a=b;
b=sequence;
printf(" %d",sequence);
}
... |
C | // Copyright (C), 1998-2013, Tencent
// Author: jefftang@tencent.com
// Date: 2013-3-5
// Different implementations for GetNthPreviousDay() and GetNthNextDay() with
// different time tradeoffs. GetNthNextDay chooses which one to use based on N.
// These are in a different compilation unit because they are implementati... |
C | #include<stdio.h>
int main()
{
int n;
n=200;
while(n<=300)
{
if(n%2==0)
printf("\t%d",n);
n+=1;
}
}
|
C | #include <stdio.h>
// Quick Sort
// ð : O(n * log n)
// Ư ū ڿ ڸ ( ) .
int number = 10;
int data[10] = { 1, 10, 5, 8, 7, 6, 4 ,3 ,2, 9 };
void quickSort(int* data, int start, int end) {
if (start >= end) { // Ұ ϳ
return;
}
int key = start; // key ù°
int i = start + 1; //
int j = end; //
int temp;
... |
C | /*
** EPITECH PROJECT, 2018
** delete_env_variable.c
** File description:
** delete env variable
*/
#include <stdlib.h>
#include "include/proto.h"
void delete_env_variables(env_t **env_lst, char *prompt)
{
for (char *s = NULL ; prompt[0] != 0; prompt++) {
if (prompt[0] == ' ' && prompt[1] != ' ') {
prompt++;
... |
C | /********************************************************************************/
/* ddosĿͻ˳ */
/* ̳߳ */
/* ip:ÿһʱƶ˷ͱip */
/* :ȴƶ˷Ϳ ... |
C | /*
** EPITECH PROJECT, 2018
** number.c
** File description:
** function returns a value
*/
#include <stdlib.h>
#include <unistd.h>
char *my_revstr(char *str)
{
int i = 0;
int j = 0;
char c ;
while (str[i] != '\0') {
i++;
}
for (j; j < i - 1; j++) {
c = str[j];
str[j] ... |
C | #ifndef SHOWLINKEDLIST_H_INCLUDED
#define SHOWLINKEDLIST_H_INCLUDED
#include<stdio.h>
#include<stdlib.h>
#include "Structure.h"
void showList(){
struct LinkedList *node;
node = start;
if(start == NULL){
printf("\n UnderFlow!");
return;
}else{
printf("\n LinkedList is as follow:\... |
C | /*
============================================================================
Name : openSSL_https.c
Author : AnhPT
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================
*/
#include... |
C | #include <sys/time.h>
#include "olc.h"
#include "shared.c"
int main(int argc, char* argv[]) { return run(argc, argv); }
static void encode(void) {
char code[256];
int len;
OLC_LatLon location;
// Encodes latitude and longitude into a Plus+Code.
location.lat = data_pos_lat;
location.lon = data_pos_lon;
... |
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[]) {
float numero_horas,salario_min,salario_receber,horas_trabalhadas,salario_bruto,imposto;
printf("Insira o valor do salario minimo... |
C | #include <stdio.h>
int get_sum(int a , int b) {
// Good luck
int sum = 0;
if(a > b){
int temp = a;
a = b;
b = temp;
}
printf("a: %d; b: %d\n", a, b);
for(int i = a; i <= b; i++){
sum += i;
}
printf("%d\n", sum);
return sum;
}
int main(){
get_sum(6, 4);
get_sum(-1... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main ()
{
srand(time(0));
int number=rand()%100+1;
int count=0;
int a;
printf("Ѿһ1-100");
do{
printf("²");
scanf("%d",&a);
count++;
if(a>number){
printf("");
}else if(a<number){
printf("С");
}
}while(a!=numb... |
C | #ifndef __QUEUE_H__
#define __QUEUE_H__
#ifdef __cplusplus
extern "C"
{
#endif
typedef struct node {
struct node *prev;
struct node *next;
} node_t;
typedef struct queue {
node_t headNode;
} queue_t;
inline void vQueue_Init(queue_t *pxQueue);
inline node_t * pxQueue_First_Node(que... |
C | /*
* Program:
* Election.c
*
* Written by Li Jialong
*/
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/wait.h>
#include <signal.h>
#include <pthread.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <ctype.h>
#include <sys/time.h>
#include <semaphore.h>
#in... |
C | #include<PIC.h>
#include<stdio.h>
#define sl1 RA1
#define sl2 RC0
#define sl3 RC1
#define sl4 RC2
unsigned char disp[25]={0xfc,0x60,0xda,0xf2,0x66,0xb6,0xbe,0xe0,0xfe,0xf6};
char ds1=0,ds2=0,ds3=0,ds4=0;
void delay(unsigned int);
void display();
void incrementd();
void main()
{
TRISB=0x00;
TRISA... |
C | /*
How do you calculate the maximum subarray of a list of numbers?
Kadane Algorithm
*/
#include<stdio.h>
int max(int x, int y)
{
return (y > x)? y : x;
}
int maxSubArraySum(int a[], int size)
{
int max_so_far = a[0], i;
int curr_max = a[0];
for (i = 1; i < size; i++)
{
curr_max = max(a[i],... |
C | #include <stdio.h>
#include <string.h> // for strlen()
#include <stdlib.h> // for exit()
#include "Auxiliary.h"
#include "CreateTCPClientSocket.h"
#define RCVBUFSIZE 32 /* Size of receive buffer */
int main (int argc, char *argv[])
{
int sock; /* Socket descriptor */
char ... |
C | #include "_fmtspec.h"
#include "_scanf.h"
#include "ctype.h"
#include "errno.h"
#include "limits.h"
#include "locale.h"
#include "stdarg.h"
#include "stdbool.h"
#include "stdio.h"
#include "stdlib.h"
#include "string.h"
static size_t read_count = 0; /* Total number of characters read */
static size_t conv... |
C | #include <stdio.h>
#include<stdlib.h>
int main(){
int a, i, j, k;
scanf("%d",&a);
for(i = 1; i <= a; i++){
for(j = 1; j <= a - i; j++){
printf(" ");
}
for( k = 1; k <= 2 * i - 1; k++){
printf("*");
}
printf("\n");
}
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.