language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include<stdio.h>
#include<stdlib.h>
#define MAX_SIZE 1024
#define PUSH(lcs_stack, cur_pos, size,ele) \
do { \
if (cur_pos > size-1) { \
printf("\n Some error occurred \n"); \
exit(0); \
} \
lcs_stack[cur_pos++] = ele; \
}while(0)
int main(int argc, char *argv[])
{
int arr[MAX_... |
C | /*
1800 - Onde Estão Minhas Chaves
> Cassiano Rodrigues
> 27/11/2020
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
main()
{
int vetor[1100], i, j, q, e, csi;
while (scanf("%d %d", &q, &e) != EOF)
{
for (i = 0; i < e; i++)
{
scanf("%d", &csi);
vetor[cs... |
C | #include<sys/socket.h>
void gameHandle(int *clntSock){
int flag[2] = {0,1};
int turn=0;
int coord;
int isGameset;
while(1){
// broadcast turn
send(clntSock[turn], &flag[0],4,0);
send(clntSock[!turn], &flag[1],4,0);
//coordinate 0-> 1
recv(clntSock[turn],&coord,4,0);
send(clntSock[!turn],&coord,4,0);... |
C | #include <stdio.h>
#include <string.h>
#include <pcre.h>
extern int check_ipv4_valid(char *s);
//return 0: invalid 1:valid
int check_ipv4_valid(char *s)
{
if (s == NULL || strlen(s) == 0)
return -1;
pcre *code;
int rc;
int ovector[2*3];
const char *errptr;
const char *ip;
int erroffet;
char *p;
char buf[20... |
C | #include <pebble.h>
#include "weekday.h"
#include "string.h"
const char* WEEKDAY_ES[] = {
"Dom",
"Lun",
"Mar",
"Mie",
"Jue",
"Vie",
"Sab",
};
const char* WEEKDAY_EN[] = {
"Sun",
"Mon",
"Tue",
"Wed",
"Thu",
"Fri",
"Sat",
};
const char* WEEKDAY_DE[] = {
"Son",
"Mon",
"Die",
"Mit",
"D... |
C | #include<stdio.h>
#include<math.h>
int main(){
float a, b, c, delta, x1, x2;
printf("Valor de a: ");
scanf("%f", &a);
printf("Valor de b: ");
scanf("%f", &b);
printf("Valor de c: ");
scanf("%f", &c);
delta = pow(b,2) - 4*a*c;
x1 = (sqrt(delta)-b)/(2*a);
x2 = (-sqrt(delta)-b)/(... |
C |
#include<stdio.h>
void main() {
int eng, mar, chem, bio, maths;
int total_marks;
printf("Please Enter Your Marks :\n");
printf("Marks in English outof 100:\n");
scanf("%d",&eng);
printf("Marks in Marathi outof 100:\n");
scanf("%d",&mar);
printf("Marks in Chemistry outof 100:\n");
scanf("%d",&chem... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "fun.h"
void ShellSort(char *aArray, long length)
{
int g, H = 1;
while(H <= length / 3)
{
H = H * 3 + 1;
}
while(H > 0)
{
for(int i = H; i < length; i++)
{
int tmp = aArra... |
C | #include "mh.h"
#include <signal.h>
#include <stdio.h>
int g_sigint; /* sensed an interrupt */
int g_sig();
char **getans(prompt, ansp)
struct swit *ansp;
{
static char ansbuf[128];
register char *cp, **cpp;
register int i;
struct swit *ap;
signal(SIGINT, g_sig);
for(;;) {
printf("%s", prompt);
fflush(st... |
C | #include <iostream>
using namespace std;
int main(void)
{
int arr[6] = { 34, 45, 56, 67, 78, 89 };
for (int i = 0; i < 6; i++)
{
printf("%d ", arr[i]);
}
printf("\n");
int A[2][2] = { { 1, 1 }, { 0, 1 } };
int B[2][2] = { { 2, 0 }, { 3, 0 } };
int C[2][2] = { {},{} };
for (int i = 0; i < 2; i++)
{
for (i... |
C | #include "mpi.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/times.h>
#define min(x, y) ((x)<(y)?(x):(y))
double* gen_matrix(int n, int m);
int mmult(double *c, double *a, int aRows, int aCols, double *b, int bRows, int bCols);
void compare_matrix(double *a, double *b, int nRows, in... |
C | #include<stdio.h>
int main(){
char c='4';
int result = (c =='f') ? 4 : 0;
printf("Result is %d\n",result);
return 0;
} |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "spreadsheetintro.h"
#include "spreadsheetfunctions.h"
void invokeFunctions(int mainchoice, int subchoice)
{
int val;
char arr[100];
switch (mainchoice)
{
case 1:
switch (subchoice)
{
case 1:
... |
C |
#include "ad_mik2455_def.h"
#define MIK2455_FAST_SWITCH (0)
#define MIK2455_CHN_PER_CHIP (4)
static unsigned char MIK2455_WRITE(int chip,
unsigned char addr, unsigned char data)
{
gpio_i2c_write(MIK2455_DEV[chip],addr,data);
udelay(75);
return 0;
}
static unsigned char MIK2455_READ(int chip, unsigned... |
C | float converte_float(const char *str){
float num_float, frac, div_frac;
char cop_str[30], separ[2] = ".", *parte;
memcpy(cop_str, str, strlen(str));
parte = strtok(cop_str, separ);
num_float = atoi(parte);
parte = strtok(NULL, separ);
if(parte == NULL)
parte = "0";
frac = atoi(parte);
div_frac = strl... |
C | #include <stdio.h>
int mjir4d_sentence1()
{
printf("Alas he was now as old as the ancient Linus Torvald.\n");
return 1;
}
int mjir4d_sentence2()
{
printf("Thus Agent Buckwald set forth on the great engineering feat that was making a time machine out of a Delorean.\n");
return 1;
} |
C | // dorm.c
#include <GL/glut.h>
#include <stdlib.h>
#include <stdio.h>
#include <jpeglib.h>
#include <jerror.h>
#define BED 1 // height of 10, 2.5 above, 7.5 below
#define CHAIR 2 // height of 9, 4.5 above, 4.5 below
#define DESK 3 // height of 11, 1 above origin, 10 below
#define LAMP 4 // height of 5, 5 above origin... |
C | #include <stdio.h>
#define PI 3.14 //
int main()
{
//const
/*
double pi = 3.14;
pi = 4.14;
int aaa = 1;
int bbb = 2;
//const int* p = NULL; //*p
//int* const p = NULL; //p
const int* const p = NULL; //Ѵ
p = &aaa;
printf("1.pǰ : %d\n", *p); //1
aaa = 100;
printf("2.pǰ : %d\n", *p); //100
*p ... |
C | #include <stdio.h>
#include <stdlib.h>
#define dimN 16
#define dimM 8
#define ELEM(Mat,i,j) Mat[i*dimN+j]
#define PRINTMAT(MAT) \
do { \
printf("Stampo la matrice %s:\n", #MAT); \
for(size_t i=0;i<dimN;++i) { \
for(size_t j=0;j<dimM;++j) \
printf("%4ld ", ELEM(MAT,i,j)); \
... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct NO{
int info;
int altura;
struct NO *esq;
struct NO *dir;
};
typedef struct NO* ArvAVL;
int nivelBuscaAVL=0;
int altura_NO(struct NO* no){
if(no == NULL) return -1;
else
return no->altura;
}
int fatorBalanceamento_NO(struct NO* no){
retur... |
C | /*
* This is a driver to test pass1 and the Label Table functions.
*
* Author: Alyce Brady
* Date: 2/18/99
* Modified by: Caitlin Braun and Giancarlo Anemone to test pass2 of the assembler.
*/
#include <stdio.h>
#include <string.h>
#include "LabelTable.h"
LabelTable pass1 (char * filename);
LabelTable pass2 (c... |
C | #include <stdio.h>
#define MAX 20
int search(char t[][20], int i, int j, int l, int w, int c)
{
if(i >= 0 && i < l && j >=0 && j < w && t[i][j] == '.')
{
t[i][j] = '#';
c++;
}
else
return c;
c = search(t, i-1, j, l, w, c);
c = search(t, i, j-1, l, w, c);
c = search(... |
C | #include<stdio.h>
#include<stdlib.h>
int main()
{
int r1,r2,c1,c2;
int i,j,k,p;
int md;
char go;
//========frist Matrices input=========
printf("First Matrices Rows: ");
scanf("%d",&r1);
printf("First Matrices Colloms: ");
scanf("%d",&c1);
float arr1[r1][... |
C | #include<stdio.h>
int main()
{
int i,j,n,temp;
int arr[1000];
printf("Enter array size : ");
scanf("%d",&n);
printf("Enter array elements : \n");
for(i=0;i<n;i++)
{
scanf("%d",&arr[i]);
}
printf("Before sorting : \n");
for(i=0;i<n;i++)
{
printf(... |
C | #include<stdio.h>
#include<string.h>
#include<ctype.h>
void push(char ele,char s[100],int *t);
char pop(char s[100],int *t);
int is_operator(char e);
int precedence(char e);
int main()
{
char stack[100],infix[100],postfix[100],x;
int i=0,j=0,top=-1;
printf("enter infix exp\n");
scanf("%s",infix);
whil... |
C | /*
* File: termometro.c
* Author: USER
*
* Created on 11 de octubre de 2020, 01:35 PM
*/
#include <xc.h>
#include<stdio.h>
#include "config.h"
#define _XTAL_FREQ 4000000
#include "LCD.h"
#pragma config PLLDIV=1
float volt,temp,tempK,tempF;
int adc;
char str[20];
void configurar_puertos(void)
{
//Configurac... |
C | #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<ctype.h>
void* my_memcpy(void* dest, const void* src, int num)
{
char* p1 = (char*)dest;
const char* p2 = (char*)src;
while (num--)
{
*p1++ = *p2++;
}
return dest;
}
void test1()
{
int arr1[] = { 1, 2, 3,4, 5,6,7,8... |
C | #include <stdio.h>
int main(){
int a, b;
int *p;
a=10;
p=&a;
b=20;
printf("Zmienna p (wskazuje adres a): %d \n", p);
*p=b;
printf("Zmienna p (wskazuje adres a): %d \n", p);
printf("Wartosc zmiennej p po '*p=b': %d \n", p);
printf("Wartosc zmiennej p po '*p=b': %d \n", *p);
printf("\nWartosc zmiennej a po '*p=b': ... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef enum { False, True } Boolean;
typedef struct dish {
char* name;
int price;
int quantity;
int startQuantity;
char premium;
struct dish* next;
} dish;
typedef struct dishes {
dish* head;
dish* tail;
}dishes;
type... |
C | /* comment 1 with a '/' inside it */
#include <stdio.h> // for using printf and scanf */
/* a
comment
occupying separate
lines
*/
int main(){
// hello how are you? (a single line comment)
int a, b; /* declaring two variables for storing user input */
printf("Enter two numbers for addition: "); /* prompt ... |
C | //-----------------------------------------------------------------------------
// DictionaryTest.c
// Pattawut Manapongpun
// pmanapon
// CMPS-12M
// Date: 2-20-2018
// Tests Dictionary ADT.
//-----------------------------------------------------------------------------
#include<stdio.h>
#include<stdlib.h>
#include<... |
C | #include <stdio.h> // INtegral DUplo
#include <math.h>
double function(double x, double y)
{
return sin(x+y);
}
double int_duplo(double a, double b, double A, double B, int n_int)
{
double S0=0, S1=0, S2=0, sum=0;
double hx = (A-a)/n_int;
double hy = (B-b)/n_int;
double x1=a, y1=b, i=0;
//pon... |
C |
#include <stdio.h>
int main5(){
char a;
int b;
float f;
double d;
a=7;
b=-13;
f=0.1;
d=42.5;
printf("nombre: %c,\t direccion:%p, \tvalor:%d\n",'a',&a,a);
return 0;
}
|
C | #include "../../ft_putchar.c"
#include <stdio.h>
int sum(int lower, int upper)
{
int total;
total = 0;
while (lower < upper)
{
total += lower;
lower += 1;
}
return (total);
}
int total_lines (int total_levels) { return sum(3, total_levels + 3); }
int lines_in_level (int level) { return level + 3; ... |
C | #include <stdio.h>
int main()
{
/* Declare variables */
int i1, i2;
int retVal;
/* Prompt for and get user input */
printf("Enter two integers:\n");
retVal = scanf("%d%d", &i1, &i2);
/* Check for valid user input. If the user entered the correct types,
* retVal will be 2, since two values w... |
C | #include <stdio.h>
int main_3(void)
{
float pi = 3.141592f;
float volume, r;
printf("Enter the radius: ");
scanf("%f",&r);
volume = (4.0f / 3.0f) * pi * r * r * r;
printf("Volume : %.1f\n", volume);
return 0;
}
|
C | #include <stdio.h>
#include "holberton.h"
#include <stdlib.h>
/**
* main - multiply 2 numbers, prints result
* @argc: number of arguments
* @argv: list of arguments
* Return: 1 if number of arguments is not 3, 0 otherwise
*/
int main(int argc, char *argv[])
{
if (argc != 3)
{
puts("Error");
return (1);
}
... |
C | #include "holberton.h"
/**
* mul - funtion to multiply two numbers
* Description: A function to multiply
* two integer numbers.
* @a: The first factor
* @b: The second factor
* Return: the multiply result.
*/
int mul(int a, int b)
{
return (a * b);
}
|
C |
internal c_struct
ParseStruct(memory_arena *Arena, tokenizer *Tokenizer, string Name)
{
c_struct Result =
{
.Type = PushString_(Arena, Name.Size, Name.Data),
.Name = PushString_(Arena, Name.Size, Name.Data),
.Members = 0
};
c_member *CurrentMember = 0;
ToUpperCamelCase(&Res... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* utils_vector2.c :+: :+: :+: ... |
C | /* pphs - a pretty printer for Haskell code */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAXLINELENGTH 256
enum face {KW, ID, IS, SU, ST, CO, NU, MA, SP, LC, RC, CR, BF, FQ, EQ, DQ, QD, EE, DC, DP, CP, LE, GE, LA, RA, RR, TI, BE};
/* Possible values of typeface */
int widecolons = 0; ... |
C | /*
* File: timetable_entry.h
* Author: Jannis Diekmann
*
* Created on 31. Januar 2021, 12:22
*/
#ifndef TIMETABLE_ENTRY_H
#define TIMETABLE_ENTRY_H
#ifdef __cplusplus
extern "C" {
#endif
#include <time.h>
#include <stdint.h>
// Id to select a specific timetable
typedef uint8_t timetable_id;
/********... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* instructions.c :+: :+: :+: ... |
C | /********************************************/
/* */
/* OL 61 */
/* Fixed Size Allocator */
/* */
/********************************************/
#ifndef OL61_FSA
#define OL61_FSA
#include <stddef.h> /* size_t */
typedef struct fsa_t fsa_t;
/*
* O(n)
* return value - pointer to admi... |
C | #include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include "header_sort.h"
/**
* Given two pointers, this function switches the content:
* e1: pointer to the first value
* e2: pointer to the second value
*/
void swap(void** e1, void** e2) {
void* tmp = *e1;
*e1 = *e2;
*e2 = tmp;
}
/*-----MERGE SOR... |
C | // /wizards/kalinash/bin/_langs.c
// Shows what languages a player knows
// Also shows numeric proficiency values
// By Kalinash@Nightmare on 16 Dec 93
#include <std.h>
inherit DAEMON;
int cmd_langs(string str)
{
string *lang, tmp;
int amt, x;
object ob;
if(!str || str=... |
C | #include <string.h>
#include "builtins.h"
#include "macros.h"
lval* builtin_lambda(lenv* e, lval* a)
{
/* \ {x y} {+ x y}*/
/* Need 2 args, both Q-Expr */
LASSERT_NUM("\\", a, 2);
LASSERT_TYPE("\\", a, 0, LVAL_QEXPR);
LASSERT_TYPE("\\", a, 1, LVAL_QEXPR);
/* First Q-EXPR is set of params / formals, check it co... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
//%e %f e %lf %g double
//%i %o %u %x para int
//%c para char
double valor_investido,juros,meses,ganho_juros;
printf("Digite o valor do investimento: ");
scanf("%lf",&valor_investido);
printf("Digite a taxa de j... |
C | #ifndef _SCRATCHPAD_H
#define _SCRATCHPAD_H
/* Tim Hollebeek
*
* The data must also consist of zero terminated chunks, with lengths in the
* range 0 < len < 256. Longer things can be handled, but they're just
* malloc'ed.
*
* Designed to be used by the compile stack (if pointers get popped off due
* t... |
C | // Write a program that calls `fork()` and then calls some form of `exec()`
// to run the program `/bin/ls`. Try a few variants of `exec()`, such as
// `execl()`, `execle()`, `execv()`, and others. Why do you think there
// are so many variants of the same basic call?
#include <stdio.h>
#include <unistd.h>
#include ... |
C | #include<stdio.h>
void main()
{
int a,b,c,sum,perc;
printf("1st side of triangle a\n");
scanf("%d",&a);
printf("2nd side of tringle b\n");
scanf("%d",&b);
printf("3rd side of trianglec\n");
scanf("%d",&c);
if((a+b>c)||(b+c>a)||(c+a>b))
printf("triangle is valid\n");
else
printf("triangle is not valid\n");
}
|
C | #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
//һṹ嶨 ṹеijԱ ڴ沼־
//ͨ ageַ ȥĽṹڴַ
typedef struct AdvTeacher
{
char name[64];
int age;
char*pname;
}AdvTeacher;
int main561()
{
AdvTeacher t1;
AdvTeacher*p = NULL;
p - 1;//ͨ ͨ 仰 CPUм
p - 2;
int offsize = (int)&(p->age);
p... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_display_list.c :+: :+: :+: ... |
C | /*
exercicios
ordenados
*/
int main(){
int numeros[10];
int i, fim;
int aux;
for(i=0;i<10;i++){
printf("numeros[%i]: ",i);
scanf("%i",&numeros[i]);
}
for(fim=9;fim>0;fim--){
for(i=0;i<=fim;i++){
... |
C | /*
*Compute factorial of a number using iterative method
*
* */
#include <stdio.h>
int main()
{
int n, i;
long long int sum = 1;
printf("Input a number to compute the factorial\n");
scanf("%d", &n);
if (n <= 1) {
printf("Input No = %d\tFactorial(%d) = 1\n", n, n);
}
else {
for(i = n; i > 1; i--) {
su... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstmap.c :+: :+: :+: ... |
C |
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "SMO.h"
#include "uart_term.h"
static void SMO_Event_init(SMO_Event *Event);
static void SMO_Event_setTime(SMO_Event *Event, uint8_t AlarmHour, uint8_t AlarmMin);
static int SMO_Event_addMed(SMO_Event *Event, uint8_t nCmptmt, uint8_t nPills);
stati... |
C | #ifndef _myQuadEEPROM_
#define _myQuadEEPROM_
#include <Arduino.h>
#define CALSENS_DATA_VALID 0x15fc
#define CALSENS_DATA_VALID_LOW 0xfc // pattern to detect valid config - low byte
#define CALSENS_DATA_VALID_HIGH 0x15 // pattern to detect valid config - high byte
#define CALMOTOR_DATA_VALID 0xEA03
#define CAL... |
C | #include <mqueue.h>
#include "messages.h"
#include <pthread.h>
#include "database.h"
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
typedef struct Data Data;
Data new_data(char * value1, float value2);
/* Create a fresh empty database */
Response process_init(Request request);
/* Ad... |
C | /* KR 5-17: Add a field-handling capability, so sorting may be done on fields
* within lines, each field sorted according to an independent set of options.
*
* Solution Notes:
* The inline flag is passed with -i. If a field has inline flag set, then
* individual elements are sorted with a , delimiter.
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#define prodN 100
// O trabalho foi divido em fun��es pois seria mais simples de organizar as rotinas
// As vari�veis foram declaradas fora do main() para que elas sejam globais e possam ser acessadas por diferentes fun��es
/... |
C | // Dimensions.h
#ifndef DIMENSIONS_H
#define DIMENSIONS_H
#include <kernel/OS.h>
#include <game/WindowScreen.h>
// the possible resolutions
extern uint32 color_spaces[];
// the names of the resolutions
extern char *color_space_names[];
// the number of color spaces
extern size_t color_spaces_count;
e... |
C | #include<stdio.h>
#include <stdlib.h>
int i = 3;
typedef struct node
{
int value1;
struct node *nxt;
} node ;
typedef struct stack
{
node *top;
} str;
void push(str *,int);
int pop(str *);
void display(str *);
str initStack() {
str st ;
st.top = NULL ;
return st ;
}
int main(... |
C | /****************************************************************************/
/* _FSSetDate.c
**
** Created by FileSystem VectorPort tool. (FSVPTool 53.23)
**
** :ts=4
**
*/
/****************************************************************************/
#include "all_includes.h"
... |
C | #include <iostream.h>
#include <conio.h>
int a[50];
void merge(int,int,int);
void merge_sort(int low,int high)
{
int mid;
if(low<high)
{
mid=(low+high)/2;
merge_sort(low,mid);
merge_sort(mid+1,high);
merge(low,mid,high);
}
}
void merge(int low,int mid,int high) ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* write_dir_label_fd.c :+: :+: :+: ... |
C | #ifndef POSPOPCNT_H
#define POSPOPCNT_H
#include <stdint.h>
#if defined(__clang__)
#pragma clang loop vectorize(disable)
#elif defined(__GNUC__)
__attribute__((optimize("no-tree-vectorize")))
#endif
// given a stream of len 16-bit words (in data), generates
// an histogram of 16 counts stored in flags, corresponding
... |
C | #include<stdio.h>
// ϱ ռ, Լ ϳĴ
// ǹ ִµ ص
// Լ ˰ ־ ذ ȴٰ ؼ
// Լ մϴ.
// ! ! !
// mainȿ ִ оּ!
int a; // ʱȭ X
int b = 10; // ʱȭ O
char c = 'P';
// Լ ˾ƺ!
void fuc();
int main()
{
// ?
//
// Ư ڵ ȿ ϸ
// main , ٸ Լ ̰
// for(int i = 0 ; i < 10; i++) i for ȿ
// ... |
C | //
// Created by Xiaowei Min on 2019-02-13.
//
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <memory.h>
#include <unistd.h>
#include "ncurses.h"
#include "window.h"
bool window_init(window_t *rval, int num_rows, int num_cols) {
rval->num_rows = num_rows;
rval->num_cols = num_cols;
r... |
C | #include<stdio.h>
int main(void){
printf("%d\n", 5/3);
printf("%f\n", 5/3);
printf("%f\n", (float)5/3);
}
|
C | #include "sim.h"
#include "util/cfgParser.h"
#include "util/algebra.h"
int main(int argc, char *argv[])
{
char *cfg;
char *m;
int mode = 0; // simulator mode: 0 = simulate, 1 = render
if (argc < 3) {
printf("No config file!\n");
printf("Usage: ./Vortexy <-s / -r> <sim.cfg>\n");
cfg = "sim.cfg"; // default... |
C | # include <stdio.h>
# include <cs50.h>
int main (void) {
int i;
i = GetInt();
int numBits = sizeof(int) * 8;
bool start = false;
for( int j = numBits - 1;j >= 0;j--) {
if ((i & (1 << j)))
start = true;
if (start)
printf("%s", i & (1 << j)? "1":"0");
... |
C | /*
* CSE 109
* Calvin Tong
* cyt219
* implements the getopts prototype defined in prog2.c, parses the args the user enters
* Program #2
*/
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
/*
* parses the users command line argument and returns them in a string array
* @param command that the user ty... |
C | #include <stdio.h>
int main()
{
int n; // number of lines and columns
int i, j; // aux variables
scanf("%d", &n);
int matrix[n][n];
for (i = 0; i < n; i++)
{
for (j = 0; j < n; j++)
{
scanf("%d", &matrix[i][j]);
}
}
int pdiag_sum = 0, sdiag_sum = 0, sum_line, sum_column; // vari... |
C | #include "thermometer.h"
#include "one_wire.h"
#include "crc.h"
#include <stdio.h>
#include <string.h>
//----------------------------------------------------------------//
// Класс термометра //
//----------------------------------------------------------------//
typedef... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include "evaluator.h"
#include "kev/kev_eval.h"
int main(void)
{
int a, b, c, d, e, f, g;
int count = 0;
for(a=0; a<46; a++)
{
for(b=a+1; b<47; b++)
{
for(c=b+1; c<48; c++)
{
for(d=c+1; d<49; d++)
{
for(e=... |
C | /* Exercise 5.5: Finding perfect numbers
Alistair Moffat, March 2013.
*/
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
/* function prototypes */
int isperfect(int n);
int nextperfect(int n);
int sumfactors(int n);
int
main(int argc, char *argv[]) {
int n;
/* scaffolding to fetch an input value */... |
C | #include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#define BUFFER_LEN 256
static char recv[BUFFER_LEN] = {0};
int main(int argc, char** argv)
{
(void) argc;
(void) argv;
char sentStr[BUFFER_LEN] = {0};
printf("Starting test of a char device!\n");
... |
C | #include<strings.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<arpa/inet.h>
#include<netinet/in.h>
#include "basic.h"
#include "socketComm.h"
#define BACKLOG 200
/*创建一个socket,侦听pscAddr及port对应的ip和端口 */
int createSocketListen(int port, char *pscAddr)
{
int ret;
int sockfd;
struct s... |
C | #include <CUnit/CUnit.h>
#include <CUnit/Basic.h>
#include "../src/board.h"
void init_board_test()
{
board_t board;
int i, j;
init_board(&board);
for (i = 0; i < BOARD_SIZE; i++)
{
for (j = 0; j < BOARD_SIZE; j++)
{
if (board.grid[i][j].value)
{
CU_FAIL("All of board.grid's value... |
C | #include "lists.h"
/**
* delete_nodeint_at_index - delete
* @head: pointer
* @index: int
* Return: Always 0.
*/
int delete_nodeint_at_index(listint_t **head, unsigned int index)
{
unsigned int i = 1;
listint_t *remove, *tmp;
if (head == NULL)
return (-1);
tmp = *head;
if (index == 0)
{
if (tmp == NULL)
return (-1)... |
C | /********************************
Author: Sravanthi Kota Venkata
********************************/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "segment.h"
#ifndef M_PI
#define M_PI 3.141592653589793
#endif
// dissimilarity measure between pixels
float diff(F2D *r, int x1, int y1, int x2, int y2... |
C | #include<stdio.h>
#include<math.h>
#define N_MAX 100000
#define False 0
#define True 1
int Max(const int a, const int b);
void IsPrime(const int l, const int r, const int n);
int main(void)
{
IsPrime(100, 200, test);
return 0;
}
/**
* l 到 r 为区间
* n 为 l 到 r 区间的数
*/
void IsPrime(const int l, const int r,... |
C | #include <SDL2/SDL.h>
#include <stdio.h>
#include <stdlib.h>
#include "check_score.h"
#include "collision.h"
#include "init.h"
#include "main.h"
#include "move_paddle.h"
// Program globals
ball_t ball;
paddle_t paddle[2];
int width, height; // used if fullscreen
SDL_Window *window = NULL; // The window we'll be rend... |
C | #include <stdio.h>
int main (int argc,char **argv)
{
int i=0;
if(argc-1 != 2)
{
printf("Il faut 2 arguments.\n");
return 1;
}
if(atoi(argv[2]) <= 0)
{
printf("Il faut que le deuxième arguments soit un entier strictement positif\n");
return 1;
}
for (i=0;i<atoi(argv[2]);i++)
{
printf("%s\n",argv[1]);
... |
C | /**
* @file
* @brief D(ata) S(tructure) Int(erfaces)
* pronounced "decent," "descent," or "dissent" */
#ifndef _DSINT_H_
#define _DSINT_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <glitter.h>
/*
#ifndef DOXYGEN
#define ATTRIBUTE(attr) __attribute__ (attr)
#else
#define ATTRIBUTE(attr)
#endif
*/
/** @retu... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* split_tetris.c :+: :+: :+: ... |
C | #include "learnuv.h"
#include "../deps/libuv/include/uv.h"
#define BUF_SIZE 37
static const char *filename = __MAGIC_FILE__;
/* Making our lifes a bit easier by using this global, a better solution in the next exercise ;) */
static uv_fs_t open_req;
static uv_buf_t iov;
void read_cb(uv_fs_t *read_req) {
int r = ... |
C | #pragma once
#include <stddef.h>
#include <stdbool.h>
//#define VDBG
struct Vector {
#ifdef VDBG
int elements[100];
#else
void *elements;
#endif
size_t size;
size_t capacity;
size_t element_size;
void (*freefn)(void *);
};
typedef struct Vector *VECTOR;
typedef bool (*VECTOR_ITERATO... |
C | #include "../../shared/header/shared.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void editScore(float*** scoresPtr, char** assignmentNames, char** studentNames) {
float** scores = *scoresPtr;
short assignmentIdx = getAssignmentIdx(assignmentNames);
short studentIdx = getStudentIdx(student... |
C |
int execBuiltInCommand(char** args);
int handleUserDefinedCommands(char *data,char **commandArgs);
int executeCollonCommands(char *input1,char *input2,char** command1Args,char** command2Args){
pid_t pid1=fork();
if(pid1==0){
if(handleUserDefinedCommands(input1,command1Args)){
exit(0);
}
else{
... |
C | #include <Python.h>
#include <numpy/arrayobject.h>
#include "heron.h"
#include "segment.h"
#include "areas.h"
static char module_docstring[] =
"This module is used to calcuate the areas of geometric shapes";
static char heron_docstring[] =
"Calculate triange area with only the lengths known.";
static char segm... |
C | //---------------------------------------------------------------
//
// 4190.308 Computer Architecture (Fall 2020)
//
// Project #2: FP12 (12-bit floating point) Representation
//
// September 28, 2020
//
// Injae Kang (abcinje@snu.ac.kr)
// Sunmin Jeong (sunnyday0208@snu.ac.kr)
// Systems Software & Architecture... |
C | #include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <fcntl.h>
#include <pthread.h>
int receive_file(int cl,char fname[32])
{
int sum=0, csum=0, bytes=0, fdwr;
char buffer[4];
bzero(buffer,sizeof(buffer));
creat(fname,0777);
if ((fdwr=open(fname, O_CREAT|O_WRONLY, 0777))<0... |
C | #ifndef VALIDATE_H
#define VALIDATE_H
#include <stdbool.h>
#include "definitions.h"
static inline bool squareOnBoard(const int square) {
return filesBoard[square] != OFFBOARD;
}
static inline bool boardSideValid(const int boardSide) {
return (boardSide == WHITE || boardSide == BLACK);
}
static inline bool file... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int i;
int *p;
int a[5] = { 3, 6, 7, 1, 4 };
for (p = a; p<a + 5; p++)
{
*p = 100;
}
for (i = 0; i<5; i++)
printf("a[%d]=%d\n", i, a[i]);
system("pause");
}
|
C | /**********************
* Hello Webcam
* OpenCV Demo
* Cooper Bills (csb8@cornell.edu)
*********************/
#include <stdio.h>
#include <unistd.h>
#include <math.h>
#include <time.h>
#include <opencv/highgui.h> // highgui.h contains openCV gui elements
#include <main.h>
// Main function
int main()
{
CvCapture... |
C | /* 4
使用嵌套循环,按下面的格式打印字母:
A
BC
DEF
GHIJ
KLMNO
PQRSTU
如果你的系统不使用以数字顺序编码的代码,请参照练习3的方案解 决。
*/
#include <stdio.h>
#define SIZE 27
int main(int argc, char const *argv[])
{
int x = 65;
for(int i = 0; i < 6; i++) {
for(int j = 0; j <= i; j++) {
printf("%c", x++);
}
printf("\n");
... |
C | #include <stdio.h>
#include <stdlib.h>
typedef int Item;
#define key(A) (A)
#define less(A, B) (key(A) < key(B))
#define exch(A, B) { Item t = A; A = B; B = t; }
#define compexch(A, B) if (less(B, A)) exch(A, B)
void insertion(Item a[], int l, int r) {
int i;
for (i = r; i > l; i--) compexch(a[i-1], a[i]);
for (... |
C | /*
===========================================================================
File: system_main.c
Author: Clinton Freeman
Created on: Sep 29, 2010
===========================================================================
*/
#include "headers/SDL/SDL.h"
#include "headers/SDL/SDL_main.h"
#include "headers/SDL/SDL_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.