language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include "printformat.h"
void printLogo(){
printf("\n");
printf("\n");
printf(" ██████╗ █████╗██████████████████╗ ███████╗ ███████╗██████╗██████╗\n " );
printf(" ██╔══████╔══██╚══██╔══╚══██╔══██║ ██╔════╝ ██╔════██╔═══████╔══██╗\n " );
printf(" ██████╔███████║ ██║ ██║ ██║ █████╗... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "math1.h"
#include "stringutils.h"
void reset(char *c, int len) {
int i;
for (i = 0; i < len; i++) {
c[i] = '\0';
}
}
int length (char *c) {
int len = 0;
while (c[len] != '\0') {
len++;
}
return len;
}
string new_string (char *s) {
stri... |
C | /*************************************************************************
> File Name: waitofWNOHANG.c
> Author: huangjia
> Mail: 605635529@qq.com
> Created Time: 2017年07月18日 星期二 02时55分05秒
************************************************************************/
#include<stdio.h>
#include<unistd.h>
#include<sys... |
C | #include "holberton.h"
/**
* cap_string - check the code for Holberton School students.
* @p: pointer
* Return: string.
*/
char *cap_string(char *p)
{
int i;
i = 0;
while (p[i] != '\0')
{
if (p[i] == ' ' || p[i] == ';' || p[i] == '\n' || p[i] == '\t'
|| p[i] == ',' || p[i] == '.' || p[i] == '!' || p[i... |
C | #ifndef MENU_H
#define MENU_H
#include <stdbool.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_ttf.h>
#include "game.h"
#include "app.h"
//Menu button creation struct consisting of SDL_Rect, SDL_Texture and SDL_Color.
typedef struct Screen_item {
SDL_Rect rect;
SDL_Texture *texture, *background;
SDL_Color co... |
C | #pragma once
#include "SDL_gpu.h"
#include "../src/anim_data.h"
struct AnimationData
{
const int frames;
const GPU_Rect rect[16];
const int timer[16];
};
extern AnimationData anim_lib[];
struct Animation
{
AnimationType anim_type;
int anim_timer;
int current_frame;
bool loopable = true;
bool complete = fa... |
C | #include<stdio.h>
#include<stdlib.h>
#include<malloc/malloc.h>
struct node
{
struct node * left ;
int data ;
struct node * right ;
};
struct node * root = NULL;
struct node * insert(struct node * , int );
void preorder(struct node *);
void inorder(struct node *);
void postorder(struct node *);
void smalles... |
C | /*
** EPITECH PROJECT, 2019
** rra_action.c
** File description:
** rra_action.c
*/
#include "my.h"
#include "pushswap.h"
list_info rra_action(list_info list)
{
int tmp = 0;
int i = 0;
tmp = list.list_a[list.size_a - 1];
i = list.list_a[list.size_a - 1];
while (i > 0) {
list.list_a[i] = l... |
C | // shape.c
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "image.h"
#include "array.h"
#include "shape.h"
#include "constant.h"
// Helper functions to compute the shape area, perimeter, and shape index
void loadData(ShapeAnalyser* ana, double** data);
void computeCM(Image* image, double* xcm, doubl... |
C | /*
* Licensed to Systerel under one or more contributor license
* agreements. See the NOTICE file distributed with this work
* for additional information regarding copyright ownership.
* Systerel licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this
* file except ... |
C | #include "graph.h"
/**
* print_graph - prints the graph information
*/
void print_graph(struct graph *g)
{
int i, j;
struct node *n;
printf("graph size: %d\n", g->sz);
printf("graph roots:");
for (i = 0; i < g->root_count; i++)
printf("%d ", g->roots[i]->id);
printf("\ngraph root_cou... |
C | #include <string.h>
#include <assert.h>
#include <stdlib.h>
#include "pokemon_trainer.h"
#define POKEMON_TRAINER_MIN_LENGTH_LOCAL 1
#define POKEMON_TRAINER_MIN_LENGTH_REMOTE 0
/**
* Create an empty PokemonList, with the given max and min length properties.
* The min property is only enforced by pokemonListRemove,... |
C | #ifndef PROJECT_UTILS_H
#define PROJECT_UTILS_H
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
typedef uint32_t ui;
typedef uint64_t ul;
typedef uint8_t uc;
typedef uint16_t us;
#ifndef EXTERN
#define EXTERN extern
#endif
// Logger of a simple message
#define log(message) printf((message));
// Logger... |
C | // The code is adapted from https://github.com/imsure/parallel-programming/blob/master/matrix-multiplication/mpi-mm.c
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
const int TAG = 777;
int main(int argc, char ** argv) {
double **A, **B, **C, *tmp;
double elapsed_time;
int numElement... |
C | //Program in C to reverse a linked list of size n
#include <stdio.h>
#include <stdlib.h>
struct Node
{
int data;
struct Node *link;
};
void main()
{
//user input to take size of linked list
int n;
printf("Enter the number of elements: ");
scanf("%d", &n);
//user input to take first el... |
C | /*
* (c) copyright 1995 by the Vrije Universiteit, Amsterdam, The Netherlands.
* For full copyright and restrictions on use see the file COPYRIGHT in the
* top level of the Panda distribution.
*/
#include "pan_sys_cache.h"
#include "pan_sys.h"
#include <assert.h>
#define TAIL (entry_p)1 /* Illegal pointer at ta... |
C | #include <stdio.h>
#include<stdbool.h>
#define MAX 10
/*
Author: Bhoj Bahadur Karki
purpose : Selection Sort algorithm.
date: 2020-March-26th
*/
// array initialization
int array_storage[MAX] = {2,99,33,44,11,55,55676,77,85,6};
void DisplayItem(){
printf("[");
int c;
for(c = 0; c < MAX;c++){
p... |
C | #include "buf.h"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define NOVERLAP(buf, b, n) \
if (b + n >= (buf)->buf && b < (buf)->last) { \
errno = EINVAL; ... |
C | /**
******************************************************************************
* @file drv_iic.cpp
* @author Sweet
* @brief STM32F4gpioģiic
* @version 1.0
* @date 2019.06.23
* @editby
==============================================================================
##### ... |
C | #include <stdio.h>
#include "utils.h"
/*
[3, 8, 2, 1, 5, 4, 6, 7]
*/
int
partition(int *arr, int left, int right, int pivot)
{
int i, j;
swap(arr, pivot, right);
i = left;
j = right - 1;
while (1) {
while (arr[i] < arr[right]) i++;
while (arr[j] > arr[right]) j--;
... |
C | #include "libft.h"
#include <stdio.h>
int main(void)
{
t_llst *pt_begin;
pt_begin = NULL;
st_put(&pt_begin, "cactus", 10);
st_put(&pt_begin, "moonlight", 8);
st_put(&pt_begin, "thunder dragon", 777);
print_st(pt_begin);
st_destroy(&pt_begin);
print_st(pt_begin);
printf("%s\n", (pt_begin == NULL) ? "PASS" :... |
C | #ifndef INTER_CODE_HEAD
#define INTER_CODE_HEAD
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#include"semantic.h"
typedef struct Operand Operand;
typedef struct InterCode InterCode;
typedef struct InterCodes InterCodes;
typedef struct ValueList ValueList;
typedef struct ArgsList ArgsList;
typedef enum{EQ,NEQ... |
C | #include<stdio.h>
int main()
{
int a,b;
printf("insert two number");
scanf("%d %d",&a, &b);
if(a>b)
printf("a is greatest number ");
else if(b>a)
printf("b is the greatest number");
else
printf("leave");
return 0;
}
|
C | #import <stdio.h>
void main() {
int a = 5, b = 4, c = 2;
printf("%s", a>b || a<c && !c!=4?"Verdadeiro":"Falso");
}
|
C | /* this is the second example from the permutations chapter in
* the GSL reference manual */
// The next example program steps forwards through all possible third order permutations, starting from the identity,
#include <stdio.h>
#include <gsl/gsl_permutation.h>
int main (void)
{
gsl_permutation *p = gsl_pe... |
C | #include <stdio.h>
#include <omp.h>
static long num_steps = 100000;
double step;
#define NUM_THREADS 2
void main ()
{
int i;
double pi=0.0;
double sum=0.0;
double x=0.0;
step = 1.0/(double) num_steps;
omp_set_num_threads(NUM_THREADS); //设置2线程
#pragma omp parallel for reduction(+:sum) private(x) //每个线程保留一份私有拷贝su... |
C | #include<stdio.h>
int C(int n,int r)
{
if(r==n || r==0)
return 1;
return C(n-1,r-1)+C(n-1,r);
}
int main()
{
int n,r;
printf("Enter 'n' and 'r' :");
scanf("%d %d",&n,&r);
printf("%dC%d = %d\n",n,r,C(n,r));
return 0;
}
|
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "graphic.h"
#include "helper_function.h"
#define SELF(name) GRAPHIC_##name
static Style_Access SELF(malloc) (Style_Pool_Access pool_access) {
int8_t start = pool_access->max_size - pool_access->current_size;
Style_Access result = &(pool_access-... |
C | //ܣ༭ؼĩβı
//1༭
//2ַָ
//3ӺǷ
BOOL AddTextToEdit(HWND hEdit,char *szTxt,BOOL bNextLine)
{
static char NextLine[]={13,10,0};
SendMessage(hEdit,EM_SETSEL,-2,-1);
SendMessage(hEdit,EM_REPLACESEL,0,(long)szTxt);
if(bNextLine)
SendMessage(hEdit,EM_REPLACESEL,0,(long)NextLine);
return 1;
}
//ܣִCMDܵţִһԵ̣
/... |
C |
/* pvwrite2 -- write an HDF vdata
*
* returns -1 on error, 0 on success
*
* H. Motteler
* 12 Jan 01
*/
#include <stdio.h>
#include "hdf.h"
#include "pvdefs.h"
int pvwrite2(int32 vdata_id, /* HDF vdata ID IN */
int nrec, /* number of records in buffer IN */
char *buf /* ou... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "Compara.h"
int main(){
struct aluno a[LETRAS] = {{"A"}, {"C"}, {"C"}, {"A"}};
Pilha* x = cria_Pilha();
Pilha* y = cria_Pilha();
int i;
for(i = 0; i < LETRAS; i++)
insere_Pilha(x, a[i]);
printf("Pilha X = ");
impri... |
C | /*-------------------------------------------------------------------------
*
* network_spgist.c
* SP-GiST support for network types.
*
* We split inet index entries first by address family (IPv4 or IPv6).
* If the entries below a given inner tuple are all of the same family,
* we identify their common prefix ... |
C | #ifndef lint
static const char RCSid[] = "$Id: ra_skel.c,v 2.13 2006/03/10 19:40:13 schorsch Exp $";
#endif
/*
* Skeletal 24-bit image conversion program. Replace "skel"
* in this file with a more appropriate image type identifier.
*
* The Rmakefile entry should look something like this:
* ra_skel: ra_skel.o
... |
C | #include <stdio.h>
extern int mymin(int a , int b , int c ) ;
int main() {
int a;
int b;
int c;
alarm(2);
a = 1;
b = 0;
c = -1;
mymin(a, b, c);
return 0;
}
|
C | #include <stdio.h>
#include <stdlib.h>
/*
* Typedef: node / node_t
* ----------------------
* used as one piece of the linked list
*
* int data
* - data stored in the node
* struct node *next
* - pointer to next node in the chain
* - set to NULL if this is the last node in the list
* struct node *prev
* -... |
C | /*
2
0̻ 100 ߿ ¦ ϴ α ϵ,
do~while غ. 2550 Ǿ Ѵ.
*/
#include <stdio.h>
int main()
{
int num = 0, total = 0;
do {
total += num;
num += 2; // num 0 ϰ 2 ָ鼭 ¦ ǥ
} while (num <= 100);
printf("0 100 ¦ : %d\n", total);
return 0;
} |
C | /* djikstra-graph.c */
// Michael Mei
// Linux Mint 18(Sarah) with gcc
// U. of Illinois, Chicago
// CS251, Fall 2016
// HW #14
//
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <assert.h>
#include <limits.h>
#include "avl.h"
#include "stack.h"
... |
C | //Program that converts a string like "124" to an integer 124.
#include<stdio.h>
#include<string.h>
int main()
{
char str[100];
int i;
printf("Enter the string: \n");
gets(str);
i=atoi(str); //"atoi" is a function to convert a string into an integer.
printf("integer=%d",i);
... |
C | #include <stdio.h>
#include <string.h>
int main()
{
char str[10];
printf("Enter name of the card\n");
scanf("%s", &str);
if (strcmp(str, "J") == 0 || strcmp(str, "Q") == 0 || strcmp(str, "K") == 0 || strcmp(str, "10") == 0)
printf("10\n");
else if (strcmp(str, "A") == 0)
printf("11\... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <ctype.h>
int fOption = 0;
int cmpCount = 0;
// Uses XOR 42 and makes uppercase if F option
char decode(char x){
x = (x ^ 42);
if(fOption)
x = toupper((unsigned char)x);
return x;
}
... |
C | //header che rappresenta strutture e operazioni su una coda generica
typedef struct n{
void *info; //contenuto informativo del nodo
struct n *next; //puntatore al successivo
}GenericNode; //nodo generico
typedef struct q{
GenericNode *head; //testa della coda
GenericNode *tail; //fine della coda
}Queue; //per av... |
C | #include <stdio.h>
#include <stdlib.h>
#include "combinaisons.h"
int valeur_combinaison(int iCartes_joueur[2], int iCartes_communes[5])
{
int iValeur_combinaison = 0;
int iTableau_cartes[7];
// Remplissage du tableau avec les valeurs de chaque cartes.
for(int i = 0; i < 2; i++)
{
iTablea... |
C |
#include "extname.h"
#include <string.h>
const char *extname(const char *filename)
{
const char *slash = strrchr(filename, '/');
const char *loc = strrchr(slash? slash : filename, '.');
return loc? loc : "";
}
|
C | #include <assert.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "node.h"
struct janus_node *janus_node_alloc (struct janus_node *parent,
const char *name, int value)
{
struct janus_node *n;
assert (parent != NULL);
assert (name != NULL);
if ((n = malloc (sizeof (*n))) == NULL)... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* client.c :+: :+: :+: ... |
C | #include "pilaestatica.h"
int
main (int argc, char *argv[])
{
struct Pila pila;
crear (&pila);
agregar (&pila, 9);
agregar (&pila, 8);
agregar (&pila, 7);
agregar (&pila, 6);
agregar (&pila, 5);
agregar (&pila, 4);
agregar (&pila, 3);
agregar (&pila, 2);
agregar (&pila, 1);
agregar (&pila, 0);
... |
C | /*
* A blinker that uses the systick interrupt
* to be a bit more accurate.
*
* Copyright (C) 2018, Charles McManis
* Contributed to the Public Domain, July 2018 by Charles McManis
*/
#include <libopencm3/stm32/rcc.h>
#include <libopencm3/stm32/gpio.h>
#include "../util/clock.h"
int
main(void)
{
/* Call clock ... |
C | #include <stdio.h>
int main()
{
int n;
int i;
for (n = 1; n <= 100; n++)
{
for (i = 2; i < n; i++)
{
if (n%i == 0)
{
break;
}
}
if (i == n)
{
printf("%3d", i);
}
}
printf("\n");
return 0;
} |
C | #define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<conio.h>
void tabs(FILE *fp) {
char c;
if (fp == NULL) { printf("error opening"); }
c = fgetc(fp);
while (c != feof(fp)) {
if (c == '\t')
{
fputc(fp, "/t");
}
c = fgetc(fp);
}
} |
C | /*
--------------------------------------------
Up to 20% marks will be allotted for good programming practice. These include
- Comments: for non-trivial code
- Indentation: align your code properly
- Function use and modular programming
- Do not include anything in the header other than what is already given i... |
C | #if defined(T) && defined(T_EQUALS)
#define OOC_V1
#include "ooc_template.h"
//can't define this as Set since name collision
#define SET CAT(Set, T)
#define SETNODE CAT(SetNode, T)
#define SetVFTable CAT(SET, VFTable)
#define setVFTable CAT(CAT(Set, T), vfTable)
SetVFTable setVFTable =
{
NULL_OBJECT_VFTABLE,
.ad... |
C |
#include "tm4c123gh6pm.h"
#include "keypad.h"
#include "lcd.h"
#include <stdint.h>
#include <stdbool.h>
unsigned char exp[5];
bool flag = false;
int i ;
bool calc =false;
bool contact= false;
bool isOperand(unsigned char c) {
return (c >= '0' && c <= '9');
}
// utility function to find value of and oper... |
C | /******************************************************************************
* @file FlashManager.h
* @author Adam Johnson
* @remarks Contains functions for EEPROM emulation using two pages of
* Flash memory. Based on code from NXP's app note AN11008,
* titled "Flash based non-volatile storage." Originall... |
C | #include <stdio.h>
#include <string.h>
#include <ctype.h>
void clean_stdin(void) {
int c;
do {
c = getchar();
} while (c != '\n' && c != EOF);
}
char *read_stdin(char * str, size_t size) {
char *result = fgets(str, size, stdin);
if (result != NULL) {
char *lf = strchr(str, '\n');... |
C | #pragma once
#include "memory.h"
#include "geometry.h"
struct Monster;
struct Bullet;
struct Weapon;
struct EntityModel;
Pool<ConvexInSector, 0x10000> convexInSectorPool;
struct EntityPoint : Point3D
{
Point3D initialP;
float tx,ty;
};
struct Entity
{
int inProcess;
SPoint c... |
C |
const unsigned int Bitime = 104; //9600 Baud, SMCLK=1MHz (1MHz/9600)=104
unsigned char BitCnt; // Bit count, used when transmitting byte
// Function Transmits Character from TXByte
void Transmit()
{
CCTL0 = OUT; // TXD Idle as Mark
TACTL = TASSEL_2 + MC_2; ... |
C | #include<stdio.h>
#define S 10
void insertion(int *, int);
int main()
{
int n, i, a[S];
printf("Enter the size: ");
scanf("%d", &n);
printf("Enter the elements: ");
for(i=0; i<n; i++)
scanf("%d", &a[i]);
insertion(a, n);
printf("The sorted elements: ");
for(i=0; i<n; i... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* readline.c :+: :+: :+: ... |
C | #include<stdio.h>
#define R 2
#define C 3
void input(char arr[][C])
{
printf("size:%d\n",sizeof(arr)); //4
int i,j;
printf("please input:\n");
for(i=0;i<R;i++)
{
for(j=0;j<C;j++)
{
scanf("%d",&arr[i][j]);
}
printf("\n");
}
}
void output(int arr[][C])
{
int i,j;
for(i=0;i<R;i++)
{
for(j=0;j<... |
C | #include <stdio.h>
int main(){
int num_visitors[3][7] = {
{50, 10, 14, 7, 25, 30, 70},
{30, 24, 14, 9, 87, 63, 25},
{100, 52, 82, 89, 36, 78, 22}
};
char * day_names[7] = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
for(int week_index = 0; week_index < 3; week_index+... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* pf_signed.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
void main(){
int* arr;
int size=7;
// on some systems, malloc will assign garbage values to the array
arr=(int*)malloc(size*sizeof(int));
for(int i=0; i<size; i++){
printf("%d\n", arr[i]);
}
free(arr);
// on some system, calloc will assign 0 to all the values of the arr... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_float2.c :+: :+: :+: ... |
C | #include<stdio.h> // header file
int main(){
int a,b,c;
printf("Enter 3 no.");
scanf("%d %d %d",a,b,c); // enter 3 no.
if(a>b&&a>c){
printf("A is the greatest");
}
else {
if (b>c)
{
printf("b is the greater");
}
else{
... |
C | #include "message.h"
void sigHandle(int sigNo);
void listenMsg();
void excuteRequest();
int insertRequest(int floor);
void nextRequest();
void changeRequest();
void sendCurrentfloor();
int requests[MAX_REQUEST], requests_size = 0, current_floor = 1, can_send = 1,
old_begin_floor, old_end_floor;
int main(int argc, ... |
C | //Modular or Procedural Programming
int add(int a,int b)
{
int c;
c = a + b;
return c;
}
int main(){
int x,y,z;
x=10;
y=5;
z=add(x,y);
printf("Sum is %d",z);
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define SIZE 4000
#define MAX 200
#define R 35
#define ARR 15
typedef struct node {
int adr;
struct node* next;
}node;
typedef struct {
char *name;
node* head;
int value;
}ht;
typedef struct {
int *queue;
int *parent;
int rear... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <memory.h>
#include <time.h>
#include <openssl/sha.h>
#include <openssl/evp.h>
#include <assert.h>
#include "Init.h"
#include "convNum.h"
#include "stringConv.h"
#include "fastpbkdf2.h"
#include "hashFct.h"
void choice1(char* hexIn... |
C | #include "ush.h"
/*
* Splits string (arg) in array {NAME,VALUE}
* Splits by equal sign.
*/
char **mx_splitter(char *arg) {
char **arr = mx_new_strarr(2);
int index_eq_sign = mx_char_index(arg, '=');
// If no '=' in arg or '=' is last element
// Case: export a= || export a
if (index_eq_si... |
C | /************************************************************************
Author: Eyal Noy
Creation date: 11.11.12
Last modified date: 13.11.12
Description: my malloc implementation memmory management insert and remove
Text Editor: gVim
***************************************************************... |
C | /* Nama/ NIM : Dharma Kurnia Septialoka/ 13514028
* Nama file : queue.h
* Topik : ADT QUEUE
* Tanggal : 3 November 2015
* Deskripsi : List linier queue
*/
#ifndef QUEUE_H
#define QUEUE_H
#include "boolean.h"
#include <stdio.h>
#include <stdlib.h>
/* Modul Queue
Direpresentasikan dengan... |
C | //
//
//
// Created by NAMAN GARG on 10/20/20.
//
#include <openssl/aes.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
#include <assert.h>
extern int OPENSSL_cleanse(void *ptr, size_t len);
u_int32_t OPENSSL_ia32cap_P[4] = { 0 };
unsigned char const_Rb[16] =
... |
C | #include <stdio.h>
void main()
{
int rec[10][10];
int att = 0, cls = 0;
int name = "Ram"; //Error in structure
flat rat; //Misspelled keywords
while(cls <= 40)
{
cls++;
rec[cls][0]] = 0; //Unba... |
C | #include "c01/ex00/ft_ft.c"
#include "c01/ex07/ft_rev_int_tab.c"
#include "c01/ex08/ft_sort_int_tab.c"
#include <stdio.h>
int main()
{
/*
* ft_rev
int i = 0;
int size = 15;
int str[15] = {1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15};
ft_rev_int_tab(str, size);
while(i < size)
{
printf("rev tab 1 = %d\n", s... |
C | #include<stdio.h>
#include<conio.h>
void main ()
{
// clescr();
float a, b, sum, avg;
printf("write any two numbers");
scanf("%f%f", &a, &b);
sum = a+b;
avg = (a+b)/2;
printf("sum = %f", sum);
printf("average = %f", avg);
getch();
} |
C | #include "killzone.h"
static Killzone *killzoneHead = NULL;
const SDL_Color killzoneColor = {155, 0, 155, 255};
void initKillzone(Entity where)
{
where.color = killzoneColor;
Killzone *newKillzone = malloc(sizeof(Killzone));
newKillzone->structure = where;
newKillzone->next = killzoneHead;
killzo... |
C | #include<stdio.h>
main()
{
int arr[]={1,2,3,4,5,12,7,8,9,10};
int i,j;
int num=;
int sum=0,kum=0;
for(i=0;i<10;i++)
{
if(arr[i]==num){
printf("%d",arr[i]);
printf("\n%d is index ",i+1);
break;
}
}
for(i=0;i<10;i++)
{
if(ar... |
C |
#include <stdio.h>
#include <string.h>
void trof_pripew(char *a1)
{
char *s; // [rsp+8h] [rbp-18h]
char *i; // [rsp+18h] [rbp-8h]
s = (char *)a1;
if ( a1 )
{
for ( i = (char *)&a1[strlen(a1) - 1]; s < i; --i )
{
*s ^= *i;
*i ^= *s;
*s++ ^= *i;
}
}
}
int main(int argc, char ... |
C | #include "header.h"
void min_max(int data[], int jumlah_data, int *min, int *max){
int i;
*min=data[0];
*max=data[0];
for(i=0;i<jumlah_data;i++){
if(*max<data[i]){
*max=data[i];
}
else if(*min>data[i]){
*min=data[i];
}
}
}
int min_max_gap(int... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "timedate.h"
#include "tools.h"
#include "datastructure.h"
#include "escapesequenzen.h"
TTime *addTime(TTime start, TTime * Duration)
{
TTime * endTime = calloc( 1, sizeof( TTime ));
if( !endTime )
return NULL;
int checkTime = 0,
... |
C |
#include <stdio.h>
int main(void)
{
printf("%d", 15 + 37 );
printf("%d", 15 - 37 );
printf("15と37の和は%dです", 15 + 37 );
printf("15と37の差は%dです\a\a\a\n\n\n", 15 - 37);
printf("天\n地\n人\n");
int vx = 57;
int vy = vx + 10;
printf("vxの値は%dです\n", vx);
printf("vyの値は%dです\n", vy);
int xx = 3.14;
int yy = 5.7;
... |
C | #include<stdio.h>
#include "../list.h"
void green(){
printf("\033[1;30m");
}
void red(){
printf("\033[0;31m");
}
void white(){
printf("\033[1;0m");
}
void print_result(int passed,char *message){
if(passed){
green();
printf(" ✔ %s\n",message);
}else{
red();
printf(" ✘ %s\n",message);
... |
C | #include <stdio.h>
#include <stdlib.h>
typedef enum{
FALSE,
TRUE
}BOOL;
typedef struct{
int *entryArray; //用于指向对内存的数组指针
int arrayLen; //保存数组的最大长度
int heapLen; //保存堆长度
}*Heap_t;
//二叉堆初始化
void initHeapEntry(Heap_t heap, int len)
{
heap->entryArray = (int *)malloc(sizeof(int)*len);
if(he... |
C | #include <brdkSTR_func.h>
signed long brdkStrAppendUdintToA(unsigned long value, unsigned long pString, unsigned char base, signed long position) {
signed long i,cnt=0,len = brdkStrLen(pString);
signed long start = position > -1 ? position :len+position+1;
unsigned char tmp;
i=start;
tmp = 0x30;
base = !base ? 1... |
C | #include<stdio.h>
#include<conio.h>
void _strcpy(char m[],char n[]){
int a;
for(a=0;n[a]!='\0';m[a]=n[a],a++);
m[a]='\0';
}
void main(){
char str1[100],str2[100];
clrscr();
printf("\nEnter any two string:");
fflush(stdin);
gets(str1);
fflush(stdin);
gets(str2);
_strcpy(str1,str2);
printf("\nCoppyed string=%s",str1);
g... |
C | #include <stdio.h>
int main()
{
int arr[5] = {1, 2, 3, 4, 5};
int *ptr=&arr[4];
int i, sum=0;
for(i=0; i<5; i++)
{
sum += *ptr;
*ptr--;
}
printf("합 계 : %d \n", sum);
return 0;
} |
C | #include "hcsr04.h"
extern int echo_time;
static void Hcsr04_GPIO_Config()
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(HCSR04_GPIO_CLK, ENABLE);
GPIO_InitStructure.GPIO_Pin = Trig_Pin;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
... |
C | #include <stdio.h>
float average(int a, int b, int c);
int main()
{
float result;
result = average(4, 6, 9);
printf("Average : %f", result);
return 0;
}
float average(int a, int b, int c)
{
float avg = (a + b + c)/3.0;
return avg;
} |
C | <Recipe> ::=
<Recipe Title>
[<Comments>]
<Ingredient List>
<Method>
<Recipe Title> ::= <String>.
<Comments> ::= <String>.
<Ingredient List> ::=
Ингредиенты.
{<ingredient-name> <initial-value> [<measure>]}
<ingredient-name> ::= <String>
<initial-value> ::= <Integer>
<measure> ::= г | кг | ч.л. | шт. // сух... |
C | /*
* main.c
*
* Created on: 2015年5月1日
* Author: zjh
*/
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include "relay.h"
int main(int argc, const char *argv[])
{
char group = 0;
char ioport = 0;
char i = 0;
if (argc != 3)
{
printf("Usage:\n");
printf("\tre... |
C | /*
编写一个程序,用来模拟称为“掷双骰”游戏。程序要通过随机选择1到6之间的两个数来“滚动”一对
模拟的骰子。如果两个数的和是7或11,那么程序显示信息 player wins 。如果和为2、3或12,则
显示 Player lose 。否则,程序要重复滚动骰子直到再一次达到原始和(Player wins)或者骰子
合计为7(Player lose)为止。程序需要在每次模拟滚动后显示一下骰子的值。
*/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main(int argc, char const *argv[])
{... |
C | #include<stdio.h>
main()
{
char grade;
int mark;
printf("Enter the mark of the student:\n");
scanf("%d",&mark);
if(mark>=85)
{
grade='A';
}
else if(mark>=70)
{
grade='B';
}
else if(mark>=55)
{
grade='C';
}
else if(mark>=40)
{
grade='D';
}
else
{
grade='F';
}
printf("The grade of the stude... |
C |
#include "djxattr.h"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/xattr.h>
#include <linux/xattr.h>
#include <sys/types.h>
void ListXAttr(const char * path, char* buffer[MAX_XATTR])
{
char* lst = NULL;
char* chr = NULL;
char* start = NULL;
ssiz... |
C | /* while-enter */
#include <stdio.h>
#include <stdlib.h>
#include <conio.h> //ϥgetche
int main(void)
{
int number=0;
printf("@Ӧr@ӦrJ([Enter]~):");
while(getche() != '\r'){ // \r[Enter] , ]iאּ^r,p Q
number = number + 1; // whileu@, iٲ { }
}
printf("\n@J%dӦr\n", number);
sys... |
C | #include <stdio.h>
int main(){
int t, v[10], i, max = -1, j;
char web[10][101];
scanf("%d", &t);
for( i = 0; i < t; ++i ){
max = -1;
for( j = 0; j < 10; ++j ){
scanf("%s %d", web[j], &v[j]);
if( max < v[j] ) max = v[j];
}
printf("Case #%d:\n", i+1);
for( j = 0; j < ... |
C | #include <stdio.h>
int main(void) {
// 宣言と同時に初期化する方法
int int_arr1[5] = {0, 1, 2, 3, 4};
// 全ての要素をゼロで初期化する方法
int int_arr2[5] = {};
for(int i = 0; i < 5; i++) {
if(i < 4) {
printf("%d,", int_arr2[i]);
} else {
printf("%d\n", int_arr2[i]);
}
}
... |
C | #include "latin.h"
/*#define NUM_TYPE unsigned short int
void setBit(NUM_TYPE *LSVector,int n,int i,int j);
int Isbit(NUM_TYPE *LSVector,int n,int i,int j);*/
int pickcols(NUM_TYPE *tempcolsx,NUM_TYPE *tempcolsy,NUM_TYPE *S,NUM_TYPE *P,NUM_TYPE *LSVector1,NUM_TYPE *LSVector2,NUM_TYPE *Jx,NUM_TYPE *Jy,int *lev,int n)
... |
C | #include<stdio.h>
#include<stdlib.h>
#include<time.h>
#define N 1000
#define M 10000000
typedef struct Nameval Nameval;
struct Nameval{
int value;
Nameval *left;
Nameval *right;
};
Nameval *create(int n){
Nameval *newp =(Nameval*)malloc(sizeof(Nameval));
newp->value = n;
newp->left = NULL;
newp->right = NU... |
C | #include <stdio.h>
int main(void)
{
int prev, next;
prev = getchar();
if (prev != EOF) {
while ((next = getchar()) != EOF) {
if (prev == ' ' && prev == next)
continue;
putchar(prev);
prev = next;
}
putchar(prev);
}
return 0;
}
|
C | #include <stdlib.h>
#include <string.h>
#include "include/leveldb_queue.h"
#include "src/leveldb/structs.h"
#include "src/scheme.h"
#include "src/errors.h"
kvqueue_leveldb_queue_t* kvqueue_leveldb_queue_create()
{
kvqueue_leveldb_queue_t* self = malloc(sizeof(kvqueue_leveldb_queue_t));
self->parent = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.