language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | //
// main.c
// 6--循环作业6--输入一个数,判断是否是质数
//
// Created by YanTianFeng on 15-10-15.
// Copyright (c) 2015年 qianfeng. All rights reserved.
//
#include <stdio.h>
int main(int argc, const char * argv[])
{
// 输入一个数,判断是否是质数(****)(质数,只能被1和它本身整除的数)
int x;
scanf("%d",&x);
int i;
for( i = 2;i <... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define LEN 10000
#define NUM_COMMANDS 2
void bubbleSort(double *array, int lenOfArr){
double temp = 0;
for(int i = lenOfArr; i > 1; i--){
for(int j = 0; j < i-1; j++){
if(array[j] > array[i+1]){
temp = array[i]; ... |
C | /*
* pressure.c
*
* Created: 13.08.2015 17:25:50
* Author: tonik_000
*/
#include "pressure.h"
static volatile uint16_t pressure_mass[window];
static volatile uint32_t pressure_temp = 0;
void pressure_Init()
{
for (uint8_t i =0; i<window; i++)
{
pressure_mass[i] = pressure_midle();
}
}
uint16_t middle_o... |
C | /*
Newsgroups: mod.std.unix
Subject: public domain AT&T getopt source
Date: 3 Nov 85 19:34:15 GMT
Here's something you've all been waiting for: the AT&T public domain
source for getopt(3). It is the code which was given out at the 1985
UNIFORUM conference in Dallas. I obtained it by electronic mail
directly... |
C | /*
* Author: Anca Barbu
*/
#ifndef FlowerPlatformMathManip_h
#define FlowerPlatformMathManip_h
int getNumberOfDigitsBeforeDecimal(double num){
if (abs(num) < 1) {
return 1;
}
return floor (log10 (abs (int(num)))) + 1;
}
// doesn't work properly, it must be enhanced
int getNumberOfDigitsAfterDe... |
C | /*
Sabe-se que o quilowatt de energia custa um quinto do salário mínimo.
Faça um programa que receba o valor do salário mínimo e a quantidade de quilowatts consumida por uma residência. calcule e mostre:
a) o valor de cada quilowatt;
b) o valor a ser pago por essa residência;
c) o valor a ser pago com d... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* core.c :+: :+: :+: ... |
C | #include "terminal.h"
#include "../lib/spinlock.h"
#include "../memory/paging.h"
/* Line buffer */
typedef struct {
spinlock_t lock;
uint32_t index;
char buf[TERMINAL_BUF_SIZE];
int reading;
int terminal_x;
int terminal_y;
} line_buf_t;
/* Multiple terminals */
static uint32_t active = 0;
sta... |
C | /*
** EPITECH PROJECT, 2021
** Visual Studio Live Share (Workspace)
** File description:
** mouvement
*/
#include "my_rpg.h"
sfVector2f get_enemy_vector(float angle)
{
float ac = sinus(angle);
float cb = sqrt(1 - pow(ac, 2)) * ((angle < 270 && angle > 90) ? -1 : 1);
return (sfVector2f) {cb, ac};
}
float ... |
C | main()
{ int i;
i =3 ;
printf (i) ;
i=(i+i)*(i-i/i) ;
printf (i) ;
if(i==3){i=i+1;}else{i=i+2;}
while(i<15){i=i+3;}
printf(i);
}
|
C | #include <stdio.h>
int main(void){
int hours, minutes;
printf("Please enter a 24-hour time: ");
scanf("%d:%d", &hours, &minutes);
if(hours==0){
printf("Equivalent 12-hour time: 12:%.2dAM", minutes);
}
else if(hours==12){
printf"Equivalent 12-hour time: 12:%.2dPM", minutes);
... |
C | /*
* STM32F103ZETB led.c
*
* Author: David Yang, <yangxiaohua2009@outlook.com>
* Copyright: (C) 2020 David Yang
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* N... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* tokenizer.c :+: :+: :+: ... |
C | /* include rwlockh */
#ifndef __mypthread_rwlock_h
#define __mypthread_rwlock_h
#include <pthread.h>
typedef struct {
pthread_mutex_t rw_mutex; /* basic lock on this struct */
pthread_cond_t rw_condreaders; /* for reader threads waiting */
pthread_cond_t rw_condwriters; /* for writer threads waiting */
int ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <Windows.h>
#include <process.h>
#define TIMES 100
#define TOTAL_STAFF 5
HANDLE hMutex;
UINT __stdcall Staff(PVOID lp)
{
INT Staff_Number = *(INT*)lp;
for(INT i = 0;i < TIMES;i++)
{
WaitForSingleObject(hMutex,INFINITE);
printf("Staff %d ent... |
C | /*
Project Credit Card
TODO: document
Use Luhn algorithm to check the validity of certain credit card numbers.
1. get input
2. validate type
3. validate length
4. validate start character
5. run Luhn algorithm
6. print result: valid or invalid?
*/
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
int main()
{
int fd;
int result;
fd = open("/sys/class/gpio/export", O_RDWR);
if (fd < 0) {
perror("Open");
return 1;
}
result = write(fd, "2", 1);
if (result < 0) {
perror("Write for GPIO2");
return 1;
}
result = write(fd, "3", 1);
if (result... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.c :+: :+: :+: ... |
C | #include "lists.h"
/**
* free_list - Will add a node at the end of the list.
* @head: variable.
* Return: head.
*/
void free_list(list_t *head)
{
list_t *j;
while (head)
{
j = head->next;
free(head->str);
free(head);
head = j;
}
}
|
C | /*
* Author: Ato Jackson-Kuofie
* File: unittest2.c
* Description: Random test generator for DiscardCard function in game of dominion
* Summer 362
*/
#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <math.h>
#include "rng... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct Employee {
int id;
char name[100];
char surname[100];
} Employee;
typedef struct Node {
Employee employee;
struct Node *next;
} Node;
void printList(Node *head);
void reorderBasedOnFrequency(Node *head);
void swap(struct ... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "include/variables_manipulate.h"
#define NUMBER_SIZE 15
static variable intVariablesSum(variable v1, variable v2, int sign);
static variable floatVariablesSum(variable v1, variable v2, int sign);
static variable intVariablesProd(variable v1, variabl... |
C | /*
* @Author: Aaron Earl
* 5/27/19
*
* From Freenove RPi tutorials
* Ch.7 AD/DA Converter
*
* Task: convert analog voltage to digital
* output voltage
*
* Note: My kit came with PCF8591T IC Chip
*
* Pin Notes: the IC diagram wasn't very clear so
* I've wrote out the pin values as follows;
*
* Left Pins
* AIN0: Potentio... |
C | //Name: Alekh Maheshwari
//ID: 2015A7PS0097P
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <ctype.h>
#include <math.h>
#include "lexer.h"
#include "parser.h"
//stack functions
void push (struct mystack *stack, int ele)
{
struct snode *link=(struct snode*)malloc (sizeof(... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define Nodo struct nodo
#define ListDob struct listadoble
struct nodo{//------------------------------------------------------------------Definicin de las partes del nodo
int dato;
Nodo* siguiente;
};
struct listadoble{//-----------------------... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.c :+: :+: :+... |
C | //Header files
#include<reg51.h>
//sbit pin declarations
sbit ir_left=P0^0;
sbit ir_right=P0^1;
sbit rf=P2^0;
sbit rb=P2^1;
sbit lf=P2^2;
sbit lb=P2^3;
//Global variables declarations
int var_left=0,var_right=0,var_back=0;
//Function Prototypes
void stop();
void forward();
void backward();
void le... |
C | #include <stdio.h>
int main()
{
int n,i,s[10],min=99,max=0;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&s[i]);
}
for(i=0;i<n;i++)
{
if(s[i]>max)
{
max=s[i];
}
}
for(i=0;i<n;i++)
{
if(s[i]<min)
{
min=s[i];
}
}
prin... |
C | #include "pedido.h"
#include "fabrica.h"
#include "maquina.h"
// Definindo as prioridades
#define BAIXA 1
#define MEDIA 2
#define ALTA 3
typedef struct pedido {
char id;
int prioridade;
float tempo;
float tempoChegada;
float estadiaTorno;
float estadiaFresa;
float estadiaMandril;
Maquina *maquinas... |
C | #include <stdio.h>
#include <stdlib.h>
/* shape, color, number */
void get_roots(char *in, char *out_1, char *out_2, char *out_3) {
int ret;
ret = sscanf(in, "%[^,],%[^,],%[^,]", out_1, out_2, out_3);
if (ret != 3) {
puts("problem in parsing first word");
exit(-1);
}
}
int main(int argc, char **argv... |
C | #include <stdio.h>
#include <stdlib.h>
void findExtrema(const int *pA, int Sz, int *pMin, int *pMax) {
*pMin = *pMax = pA[0]; // prime the min/max values
for (int idx = 1; idx < Sz; idx++) {
int Current = pA[idx]; // avoid extra array
// index opera... |
C | /*
* The main file for the game of Noah's Arkaid!
*/
#include <gb.h>
#include "BungBkg\bungbkg.h"
#include "Splash\Splash.h"
#include "MainMenu\MainMenu.h"
#include "Story\Story.h"
#include "Game\Game.h"
#include "Record\Record.h"
void main(void)
{
UWORD randSeed;
unsigned int menuChoice;
UBYTE firstRun;
... |
C | #include <stdio.h>
int main() {
//ǽ 2 - 3
float x; //Ǽ x Ѵ
x = 1.23456e-46; // Ǽ 1.23456e-46 ִ´
printf("20184071 赵\n");
printf("x = %10.20f\n", x); /*
Ǽ ڿ κ
10ڸ Ҽκ 20ڸ µǰԲ
x Ѵ.*/
return 0;
}
|
C | #include <stdio.h>
int main(void)
{
char str[20];
FILE * fp=fopen("simple.txt", "rt");
if(fp==NULL)
{
puts("파일오픈 실패");
return -1;
}
fgets(str, sizeof(str), fp);
puts(str);
fclose(fp);
return 0;
}
|
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<arpa/inet.h>
#include<errno.h>
#include<fcntl.h>
#include<unistd.h>
void main(){
struct sockaddr_in server,client;
int sock,clientSocket;
char receivedBytes[1024],sendBytes[1024];
int bytes... |
C | /*
dfsPhase2.c
Ben Donn
pa3
This file contains sweep function to find new roots and dfsPhase2() which runs on the transposed graph and calculates scc.
*/
#include <stdio.h>
#include <stdlib.h>
#include "intVec.h"
#include "dfsTrace1.h"
#include "loadGraph.h"
#include "dfsPhase2.h"
#include "scc03.h"
int rootCount = ... |
C | /*********************************************************************
*
* ANSI C Example program:
* TDMS-ContAcq-IntClk-LogOnly.c
*
* Example Category:
* AI
*
* Description:
* This example demonstrates how to continuous acquire data and
* stream that data to a binary TDMS file. The log only setting is
* ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
FILE *pFile = NULL;
int lineCount = 0;
char *filename = "test.txt";
int c;
pFile = fopen(filename, "r");
while((c=fgetc(pFile)) != EOF){
if(c == '\n'){
lineCount++;
}
}
fclose(pFile... |
C | #include "minishell.h"
int create_file(char *file, int mode)
{
int fd;
fd = open(file, O_RDONLY | O_CREAT | mode, 0644);
if (fd == -1)
{
printf("minishell: %s: %s\n", file, strerror(errno));
return (1);
}
close(fd);
return (EXIT_SUCCESS);
}
int check_input(char **files, int i)
{
int error;
error = 0;
... |
C | #define _CRT_SECURE_NO_WARNINGS 1
#include "highgame.h"
//̳ʼ
void high_InitBoard(char board[HIGH_ROWS][HIGH_COLS], int row, int col, char set)
{
int i = 0;
int j = 0;
for (i = 0; i < row; i++)
{
for (j = 0; j < col; j++)
{
board[i][j] = set;//鶨ʼΪҪַset
}
}
}
//̴ӡ
void high_DisplayBoard(char board[HIGH_R... |
C |
#include <stdio.h>
list *kreverse(list *head, int k) {
if(k <= 1) // nothing to reverse
return head;
list *p = head, *tail = 0;
while(p != 0) {
// remember where we start this piece
list *start = p, *prev = 0, *temp;
int c = k;
while(p != 0 && c-- > ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* label.h :+: :+: :+: ... |
C | #include<stdio.h>
#include<string.h>
#include<assert.h>
char* BF_CMP(const char* src1,const char* src2)
{
int i,j;
i=0;
int len1=strlen(src1);
int len2=strlen(src2);
while(i!=len1)
{
j=0;
while(src1[i]==src2[j]&&j!=len2&&i!=len1)
{
++i;
++j;
}
if(len2==j)
return &src1[i-j];
else
i=i-j+1;
... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.h :+: :+: :+: ... |
C | #pragma once
struct BinaryTreeNode
{
int m_value;
BinaryTreeNode* m_pleft;
BinaryTreeNode* m_right;
}; |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
int main()
{
int i, j;
int a=-2e16, b=2e16-1;
scanf("%d", &i);
while (scanf("%d", &i)==1) {
if (i>a) {
a=i;
}
if (i<b) {
b=i;
}
}
printf("The max... |
C | /* ----------------------------------------------
The goal of this program is to calculate the
sum of numbers in a row of a matrix, for all the
rows in that matrix. Also, the diagonal sum is
calculated. The matrix itself was given in the
assignment and is formatted into C by a 4x4 double
array (2 dimensional).... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_get_next_line.c :+: :+: :+: ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* math.c :+: :+: :+: ... |
C | /*
* This function calculates approximately (whole + num/den) * sf.
* No need for real extreme accuracy; one twenty thousandth of an
* inch should be sufficient.
*
* No `sf' parameter means to use an old one; inches are assumed
* originally.
*
* Assumptions:
*
* 0 <= num < den <= 20000
* ... |
C | #include <stdio.h>
int main()
{
int p, n;
float si, r;
p = 1000;
r = 8.5;
n = 3;
si = p*r*n/100;
printf("%f \n", si);
return 0;
} |
C | #include <stdio.h>
long dp[10][101];
int solve(int i, int n) {
if (n == 1) return 1;
if (dp[i][n] > 0) return dp[i][n];
dp[i][n] = 0;
if (i < 9)
dp[i][n] += solve(i + 1,n - 1);
if (i > 0)
dp[i][n] += solve(i - 1, n - 1);
dp[i][n] %= 1000000000;
return dp[i][n];
}
int main() {
int n;
long result = 0... |
C | #include <stdio.h>
#include <stdlib.h>
/***************
* Jeffrey Marple
* Lab 7, 2400
****************/
void merge(int array1[], int length1, int array2[], int length2, int result[]);
int main(){
int arr1Size = 0;
int arr2Size = 0;
int* arr1;
int* arr2;
int newNum[1];
int* resultArr;
printf("Enter how many... |
C | #include<stdio.h>
#include<conio.h>
static int arr[] = {2, 5, 8, 3, 7, 9};
void merging(int l, int m, int h)
{
int n1 = m+1, n2 = (h-m)+1;
int *L, *R;
int i;
L = (int *)calloc(sizeof(int), n1);
R = (int *)calloc(sizeof(int), n2);
for(i=l;i<m-1;i++)
L[i] = arr[i];
for(i=m;i<h;i++)
R[i] = ... |
C | #include<stdio.h>
/* Implemente um programa que solicita ao usuário um valor inteiro correspondente à idade
de uma pessoa em dias e informea em anos, meses e dias.
Obs.: apenas para facilitar o cálculo, considere todo ano com 365 dias e todo mês com 30 dias. Nos
casos de teste nunca haverá uma situação que permite 12 ... |
C | /*
* File: nfa.h
* Creator: George Ferguson
* Created: Thu Sep 1 17:54:41 2016
* Time-stamp: <Mon Sep 5 15:42:16 EDT 2016 ferguson>
*/
#ifndef _nfa_h_gf
#define _nfa_h_gf
#include <stdbool.h>
// Assume input is 7-bit US-ASCII characters
#define NFA_NSYMBOLS 128
// Assume we start in state 0
#define NFA_START... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* rush04.c :+: :+: :+: ... |
C | // This program impliments matrix tiling to compute the product of two randomly populated N X N matrices, A and B.
// The tile size is H X H
// N and H are hardcoded
// The order of the for-loops is also hardcoded
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <sys/time.h>
float A[2050][2050];
flo... |
C | #include <linux/init.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/miscdevice.h>
#include <linux/fs.h>
#define DRIVER_NAME "hello_ctl"
#define DEVICE_NAME "hello_ctl123"
MODULE_LICENSE("Dual BSD/GPL");
MODULE_AUTHOR("cqx");
static int hello_open(struct inode *inode, stru... |
C | #include <unistd.h>
int main()
{
// become root
setuid(0);
// run bash
system("bash");
return 0;
}
|
C | #include<unistd.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<sys/fcntl.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<netdb.h>
#include <time.h>
#include <sys/time.h>
#include<stdlib.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#define SERVER_PORT 33333
#define MAXLEN 65535
void ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/select.h>
#include <pthread.h>
#include <dirent.h>
#in... |
C | #include<stdio.h>
void main()
{
int a,b,c;
printf("˷ھ\n");
for(a=1;a<10;a++)
{
for(b=1;b<=a;b++)
printf("%2d*%d=%d",a,b,a*b);
printf("\n");
}
} |
C | #include<stdio.h>
#include<string.h>
#include "mpi.h"
main (int argc, char* argv[]){
int my_rank;
int p;
int source;
int dest;
int tag = 0;
char message[100];
MPI_Status status;
long long int i;
long long int sum;
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
MPI_Comm_size(MPI_COM... |
C | /* bopt.h
* - public domain getopt library
* - no warranty implied; use at your own risk
*
* LICENSE
*
* This software is in the public domain. Where that dedication is not
* recognized, you are granted a perpetual, irrevocable license to copy,
* distribute, and modify this file as you see fit.
*/
#ifndef bop... |
C | /**
* @defgroup TM_USART_Typedefs
* @brief USART Typedefs
* @{
*/
/**
* @brief USART PinsPack enumeration to select pins combination for USART
*/
typedef enum {
TM_USART_PinsPack_1 = 0x00, /*!< Select PinsPack1 from Pinout table for specific USART */
TM_USART_PinsPack_2, /*!< Select PinsPack2 from ... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
typedef struct node
{
int data;
struct node *left,*right;
}node;
node* parent(node* tree,node* temp)
{if(tree->data==temp->data)
return NULL;
else
{
while(tree->data!=temp->data)
{ if(tree->data<temp->data)
if(tree->right->data==te... |
C | #include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <termios.h>
#include <time.h>
#include <util.h>
//-----------------------------------------------------------------------------
int main(int argc, char *argv [])
{
char * port1 = NULL;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
// #define PI 3.1415
#define MAX 20
int main() {
char buffer[MAX]; // set radius to temp char
double volume = 0;
printf("Specify the radius of the sphere: ");
fgets(buffer, MAX, stdin); // ask from standard input and set temp to whatever stdin... |
C | #include "binary_trees.h"
/**
* binary_tree_insert_right - insert node at right node
* @parent: parent node
* @value: value of new node
* Return: new node
**/
binary_tree_t *binary_tree_insert_right(binary_tree_t *parent, int value)
{
binary_tree_t *new;
if (parent == NULL)
return (NULL);
new = malloc(sizeof(binar... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct NODE_S NODE;
struct NODE_S
{
NODE *next;
int n;
};
NODE *last(NODE *node)
{
return (!node->next) ? node : last(node->next);
}
void push(NODE *node, int n)
{
NODE *p = (NODE *)calloc(1llu, sizeof(NODE));
p->n = n;
last(node)->next = p;
}
N... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct node node;
typedef struct stack stack;
struct node
{
int item;
node *next;
};
struct stack
{
node *head;
};
int is_empty_stack (stack *stack)
{
return (stack->head == NULL);
}
stack *create_stack ()
{
stack *new_stack = (stack *) malloc (s... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* print.c :+: :+: :+: ... |
C | int main()
{
int m,n,i,j; //??m????n????????i?j
float s; //????b??s
float a[10000]; //????????a[n]????int????????????a[i+1]/a[i]????float??????a[n]?float?
float b[10000]; //???????????b[n]
float c[10000];
a[0]=1,a[1]=1; //?????1
cin>>m;
for(j=1;j<=m;j++) //??m??????
{ s=0;
cin>>n; //?????????n
... |
C | #ifndef _STACK_H_
#define _STACK_H_
#include <stdbool.h>
#include "type.h"
typedef struct _stack_entity {
int capacity;
int size;
int top;
element_t *arr;
} stack_entity_t;
typedef stack_entity_t *_stack_t;
_stack_t create_stack(int capacity);
void dispose_stack(_stack_t stack);
void make_stack_emp... |
C | #include <stdio.h>
#include <locale.h>
int main(){
int qFlex, qPrem, qGold; //"q" pra indicar quantidade
float total, desconto = 0;
setlocale(LC_ALL,"Portuguese");
printf("TABELA DE PREOS UNITRIOS E DESCONTOS\n\n");
printf(" -------- --------- ----------\n");
printf("| TIPO | PREO | DESCONTO |\n")... |
C | /* Rafal Krokowski, Image Processing 1, 29.11.16r.
Read() and show() functions has been implemented from
function 'odczyt.c' which is dr.inz.Muszynski intellectual property.
TESTS:
App was tested for files in the PGM format. After chosing image
processing function from main menu and running 'Save and s... |
C | /* Inclusion de cabeceras o bibliotecas. */
#include <stdio.h> // printf, scanf, setbuf
#include <string.h> // Manejo de strings
/* Definicion de macros y constantes. */
#define MAX_CHAR 15
#define MAXI 2 // 15
/* Main function. */
int main() {
int i;
char nombre[MAXI][MAX_CHAR];
int edad[MAXI];
float es... |
C | /* CS261- HW1 - Program4.c*/
/* Name: Erik Nordlund
* Date: April 6, 2018
* Solution description:
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
struct student{
char initials[2];
int score;
};
void sort(struct student* students, int n){
/*Sort n students based on their initials*/
... |
C | #pragma once
#include "VectorEngineDatastructureHeader.h"
TEST(VectorEngineTypeMatrixIsZeroMatrix, IZM_true_1x1)
{
Matrix *matrix = new Matrix(1, 1);
matrix->setEntry(0, 0, 0);
EXPECT_NO_THROW(TypeMatrix::isZeroMatrix(*matrix));
EXPECT_TRUE(TypeMatrix::isZeroMatrix(*matrix));
}
TEST(VectorEngineTypeMatrixIsZeroM... |
C | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
typedef struct stackarray{
char *_element, _topIndex;
unsigned int _size, _capacity;
} StackArray;
void stackArray_init(StackArray *stack, unsigned stackSize);
bool stackArray_isEmpty(StackArray *stack);
void stackArray_push(Stack... |
C | //binary/octal/decimal/hexadecimal system transform
#include <stdio.h>
#include <math.h>
float decimal(char *sBoh, int radix);
void boh(float dec, int radix, char *sBoh);
int main()
{
float fDec;
char sBoh[41];
printf("\nEnter a value to convert: ");
scanf("%f", &fDec);
boh(fDec, 2, sB... |
C | #include <stdio.h>
#include <string.h>
int main( void )
{
char string[100];
puts( "문자열을 입력한 후 Enter키를 치세요 !" );
puts( "아무 문자도 입력하지 않으면 프로그램은 종료됩니다 !" );
do
{
gets( string );
if( strlen(string) == 0 ) break;
strupr( string );
puts( string );
} while( 1 );
}
|
C | //Program question at: http://www.codechef.com/JUNE12/problems/CAKEDOOM
#include <stdio.h>
#include <string.h>
char s[101];
int main()
{
int t; scanf("%d\n",&t);
while(t--)
{
int a=0,k,len; scanf("%d\n",&k);
gets(s);
len = strlen(s);
if(len == 1 && s[0] != '?') { printf("%s\n",s); continue; }
if(k==2 && s[... |
C | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <time.h>
#define TIMES 10
int main (void){
int i =0;
int *array[TIMES];
for(i=0; i<TIMES; i++){
array[i] = (int *)my_nextfit_malloc(sizeof(int));
printf("Malloc'd: %p\n",array[i]);
}
for(i=0; i<TIMES;i++){
printf("freeing: %p\n",array[i]);... |
C | #include <stdio.h>
#include <stdlib.h>
#include "hash.h"
int main()
{
//this is the head node that contains the information such as the number of nodes that are currently present in the cache
//this is necessary because we require the cache to be of limited size
node_t head = (node_t)malloc(sizeof(struct node));
... |
C | #pragma once
// Data structure of the stress tensor
/*
Stress Tensor:
| |
| simga_x, tau_xy, tau_zx |
| |
| tau_xy, sigma_y, tau_yz |
| |
| tau_zx, tau_yz, sigma_z |
| |
*/
#define IDENTITY StressTensor(1.0f,1.0f,1.0f,0,0,0)
#define PI 3.14159265358979323
st... |
C | #include<stdio.h>
#define memorysize 200
char memory[memorysize];
int i=1;
char *p;
int top=memorysize-1;
int searchingindex=memorysize-1;
char *p2=memory;
int space;
int j;
int setvalue(int size){
while(!(memory[i]==NULL)){
i++;
}
j=i;
while(memory[j]==NULL){
j++;
}
space=j-i;
if(space>size){
ret... |
C | #include <stdio.h>
int main(void)
{
int i,j,k;
int a[4][3];
int b[3][4];
int c[4][4];
printf("4행 3열 a와 3행 4열 b의 곱을 c로 구합니다.\n");
puts("a의 각 요소 값을 입력하세요:");
for(i=0;i<4;i++){
for(j=0;j<3;j++){
printf("a[%d][%d] : ", i,j);
scanf("%d", &a[i][j])... |
C | #include <stdio.h>
#include <time.h>
int main()
{
time_t timer;
char buffer[26];
struct tm* tm_info;
time(&timer);
tm_info = gmtime(&timer);
printf("difftime: %f\n", difftime(timer, 1473349260));
strftime(buffer, 26, "%Y%m%dT%H%M%SZ", tm_info);
puts(buffer);
return 0;
}
|
C | #include<stdio.h>
int main(){
int a,i,n,c=0,r=0,s=0,sum=0;
char b;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d %c",&a,&b);
sum=sum+a;
if(b=='C'){
c=c+a;
}
if(b=='R'){
r=r+a;
}
if(b=='S'){
s=s+a;
}
}
printf("Total: %d cobaias\n",sum);
printf("Total de coelhos: %d\n... |
C | /*
* Copyright (c) 2016 RnDity Sp. z o.o.
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @brief Driver for Reset & Clock Control of STM32F10x family processor.
*
* Based on reference manual:
* STM32F101xx, STM32F102xx, STM32F103xx, STM32F105xx and STM32F107xx
* advanced ARM ® -based 32-bit MCUs
*
* Ch... |
C | #include "csapp.h"
//
// Wait for a child and print messages of event ordering
//
// This version uses a global variable (died) to coordinate
// the reaping of child processes.
//
int died = 0;
void handler(int sig)
{
pid_t pid;
while ((pid = waitpid(-1, NULL, 0)) > 0) {
fprintf(stderr,"%d: reap child ... |
C | /*************************************************************************
> File Name: neicunguanli.c
> Author:
> Mail:
> Created Time: 2018年05月22日 星期二 17时56分24秒
************************************************************************/
#include<stdio.h>
#include<stdlib.h>
#define PROCESS_NAME_LEN 32 //进程名长... |
C | /*
文件名:SharedMemory.c
描述:共享内存的函数集合
*/
#include "types.h"
#include "defs.h"
#include "param.h"
#include "memlayout.h"
#include "mmu.h"
#include "x86.h"
#include "proc.h"
#include "spinlock.h"
struct SharedMemoryEntry GlobalSharedMemoryList[SHARED_MEMORY_GLOBAL];
struct spinlock SharedMemoryLock;
/*
描述:获取全局共享内存使用情况
... |
C | /**
* Logging.
* Just wrappers around easylogging++ in case I decide to change later
*
* @author Thom Troy
*
* Copyright (C) 2015 Thom Troy
*/
#ifndef __VSID_COMMON_LOGGER_H__
#define __VSID_COMMON_LOGGER_H__
#define ELPP_NO_DEFAULT_LOG_FILE
#include "easylogging++.h"
#define INIT_LOGGING INITIALIZE_EASYLOG... |
C | /**********************************************************
Algortym: Wyszukiwanie drogi A-Star
Licencja: http://www.gnu.org/licenses/lgpl.txt
Autor: Kamil Pawlowski <kamilpe@gmail.com>
**********************************************************/
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "... |
C | // Gabriel Lopes Silva gabriel18.lopes@gmail.com trabalho de Decodificacao lab 2
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
char chave[] = "G89yk1";
void Criptografar();
void back();
int main(){
char select;
for(;;){
printf("\n 1-Criptografar\n 2-Descriptografar\n 3-Sair\n ");
scanf("... |
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 | /*
** EPITECH PROJECT, 2019
** test.c
** File description:
** Thomas Olry's test.c made the 11/08/2019
*/
#include "../include/pong.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
pong_t *velocity_vector(float xA, float yA, float zA, float x, float y, float z)
{
pong_t *pong = mall... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.