language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | #include <stdio.h>
int main(void){
int count=0;
int longest=0;
int longest_n=0;
int million=1000000;
int n=0;
million=14;
million=million-1;
for (longest=0;million!=1;million--){
printf("Evaluation of: %i\n",million);
n=million;
for (count=1;n!=1;count++){
if(n%2!=0) {
n=3*n+1;
}
else {
... |
C | #include "MenuSection.h"
#include <assert.h>
#include <stdbool.h>
#include "Window.h"
#include "Renderer.h"
#include "Font.h"
#include "UI.h"
#include "Mouse.h"
#include "MenuGroup.h"
#include "Menu.h"
#include "Application.h"
#include "World.h"
typedef enum
{
Default = 0,
Hover,
Clicked
} MenuSec... |
C | /* Copyright (C) 1993 Massachusetts Institute of Technology, Cambridge, MA
All rights reserved
*/
/* ray.c */
/* This code finds intersection points of B-spline and ray */
/* Based on Chun-Y Hu: ~chun/master/hidline/pclass/rayintersect.c */
/* arr_vec()
BsplineToBezier()
close_enough()
deriv_sign()
Fi... |
C | #include <stdio.h>
#include <ctype.h>
int getLine(char s[]);
double atof(char s[]);
#define MAXLINE 100
/*
get line from user
check for e or E
get sign value
get num value
adjust decimal occording to sign and num values
pass result to atoi()
return result
*/
int main(){
char line[MAXLINE];
double lineValue;
g... |
C | // Copyright 2021 - 312CA Brinzan Darius-Ionut
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "function.h"
#define MAX_STR 32
// functie pentru erori
size_t out_of_bounds(size_t ind, size_t size, size_t planet){
if (ind >= size){
if (planet)
printf("Planet out of bounds!\... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct node{
int value;
struct node * left;
struct node * right;
}node;
typedef node * nodePtr;
int readint(void);
void insert(int value, nodePtr * corrPtr);
int height(nodePtr corrPtr);
int max(int A, int B);
int main(void){
int n_element = readint();
nodePtr root... |
C | // Eduardo Vudala Senoski GRR20195689
#include "interval.h"
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
void must_alloc(void* ptr, const char* desc){
if(!ptr){
fprintf(stderr, "Couldn't allocate memory for %s.", desc);
exit(1);
}
}
int is_smaller(float a, flo... |
C | #include <stdio.h>
#include <stdint.h>
uint16_t main(char argc, char * argv[]){
int hi, mi, si, ho, mo, so, hd, md, sd;
int ret, secs_i, secs_o, delta;
ret = scanf("%d:%d:%d",&hi, &mi, &si);
ret = scanf("%d:%d:%d",&ho, &mo, &so);
if (ho < hi){
ho = ho + 24;
}
secs_i = hi*360... |
C | #include "mta_crypt.h"
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <openssl/err.h>
#define _GNU_SOURCE
#include <openssl/evp.h>
#define MTA_CRYPT_INPUT_KEY_VALIDATION(key, key_length) \
if (key == NULL){ \
return MTA_CRYPT_RET_NULL_PTR_REC... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_path.c :+: :+: :+: ... |
C | #define _POSIX_SOURCE
/*
* Soubor: proj2.c
* Datum: 2017/4/23
* Autor: Bc. Lukas Pelanek, xpelan03@stud.fit.vutbr.cz
* Projekt: Shell, projekt c. 2 pro predmet POS
* Popis: Jednoduchy shell, ktery podporuje nasledujici funkce: <, >, &
*/
#include <stdlib.h>
#include <ctype.h>
#include <unistd.h>
#include <fcntl... |
C | /////queue using link list insertion and deletion
#include<stdio.h>
#include<stdlib.h>
typedef struct st{
int i;
struct st *next;
}st;
void insert(st **);
void delete(st **);
void display(st *);
main()
{
st *hptr=0;
int op;
while(1)
{
printf("Enter option.\n 1)insert\t2)delete\t3)display\t4)exit\n");
scanf("%d",&op);... |
C | #include "graph.h"
AdjListNode *new_adj_list_node(int destination)
{
AdjListNode *new_node = malloc(sizeof(AdjListNode));
if (new_node == NULL)
{
log_error("new_adj_list_node()", MALLOC_ERR);
return NULL;
}
new_node->destination = destination;
new_node->next = NULL;
return n... |
C | #include <linux/module.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/kernel.h>
#include <linux/uaccess.h>
#include <linux/slab.h>
MODULE_LICENSE("GPL");
MODULE_AUTHOR("wzr");
MODULE_DESCRIPTION("my second linux driver bufio");
MODULE_VERSION("v1.0");
#define BUFIO_MAJOR 225
#define BUF_SIZE 64
/* ... |
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 | //------------------------------------------------------------------------------
//
// File Name: Random.c
// Author(s): Roland Shum
// Project: MyGame
// Course: CS230S19
//
// Copyright 2019 DigiPen (USA) Corporation.
//
//------------------------------------------------------------------------------
#include "st... |
C | #include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>
#include<math.h>
# define max_size 100000
struct node {
char key[20];
char value[200];
};
int hash (char[]);
void ViewList(struct node * []);
void FlashCard(struct node * []);
char * LowerCase(char[]);
void Search(struct node *[]);
/*----... |
C | #include "holberton.h"
/**
* aux1 - This program will print using _putchar function
* @s: array
* @a: array
* Description: prints Holberton using the function
* Return: s
*
*/
int aux1(char *s, int a)
{
if (*s == 0)
{
return (a);
}
if (*s != 0)
{
return (aux1(++s, ++a));
}
return (0);
}
/**
* aux2 - This pr... |
C | #include <pthread.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <ctype.h>
#include <semaphore.h>
int main (int argc, char *argv[]) {
// Cogemos los parámetros de entrada
if (argc != 4) printf("Por favor, indique el tipo de proceso y los dos semáforos... |
C | /*
* main.c
*
* Created: 22/08/2018 14:13:50
* Author: Nikolaus Huber
* Platform: Arduino Due - Atmel SAM3X8E
*
* Purpose: Blinks the LED0 on the Arduino Due
*
*/
#include <asf.h> /* include asf library*/
#include <delay.h>
int main (void)
{
/* System clock initialization */
sysclk_init();
/* Board pe... |
C | ////////////////////////////////////////////////////////////////////////////////
//
// Przyklad wykorzystania makr zamazujacych kod CLEAR_START i CLEAR_END
//
// Wersja : PELock v2.0
// Jezyk : C/C++
// Autor : Bartosz Wjcik (support@pelock.com)
// Strona domowa : https://www.pelock.com
//
//... |
C | #include<stdio.h>
//жһǷΪ
//ʾ 1:
//: 1->2
// : false
//ʾ 2 :
// : 1->2->2->1
// : true
typedef struct ListNode
{
int val;
struct ListNode* next;
}ListNode;
struct ListNode* reverseList(struct ListNode* head)
{
struct ListNode* prev, *cur, * next;
if (head == NULL || head->next == NULL)
{
return head;
}
prev = N... |
C | #include <stdio.h>
#ifdef _WIN32
#include <fcntl.h>
#include <io.h>
#include "iwyu_getopt.h"
#else
#include <getopt.h>
#endif
#include "dump.h"
#include "buffer.h"
#define BUFFER_SIZE 2048
buffer read_all_stdin() {
buffer out_data = make_buffer();
char buffer[BUFFER_SIZE];
size_t amount_re... |
C | /******************************************************************************
QuickUnion.c
Find: Check if p and q have the same root.
Union: To merge components containing p and q, set the id of p's root
to the id of q's root.
==============================================
algorithm initiali... |
C | // UVa 1586:Molar mass
// Author: YuanJyun Lu
#include<stdio.h>
#include<string.h>
#define maxn 100
int main(){
int T;
char s[maxn];
scanf("%d",&T);
while(T--){
scanf("%s",s);
int n = strlen(s), multiple = 1;
double sum = 0.0;
for (int i = n-1; i>=0; i--){
switch (s[i]){
case 'C':... |
C | /*
* Fork
*
* oxben <oxben@free.fr>
*/
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/wait.h>
#define COUNT 1000000
#define BUF_COUNT 1024
/**
* @brief In loop, write a buffer to a file, read it from starts and check data is ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: ... |
C | #include <stdio.h>
long long solve(){
long long n = 600851475143LL, p = 1;
while (n > 1 && ++p)
while (n % p == 0)
n /= p;
return p;
}
main(){
printf("%lld\n", solve());
} |
C | #include <string>
#include <vector>
void generateTree(std::string const &name, std::string const &dir = ".") {
TFile f((dir + "/" + name + ".root").c_str(), "RECREATE"); // Create file
TTree tree(name.c_str(), "Tree with basic leaf variables"); // Create tree
// Leaf variables
Float_t px, py, pz;
Doubl... |
C | #include "ARK1Utils.h"
#include <stdio.h>
#include <string.h>
uint64_t roundFunction(uint64_t input, uint64_t subkey)
{
uint64_t q, r, s = input ^ subkey, output=0;
q = AFFINE(s>>32); r=AFFINE(s);
MIX(q,r);
output |= r & 255;
output |= (q & 255) << 8;
q = AFFINE(s>>40); r=AFFINE(s>>8);
MIX(q,r);
output |= (r ... |
C | /*
* ccarray.h
*
* Created on: Dec 15, 2011
* Author: vova
*/
#ifndef __ccarray_h__
#define __ccarray_h__
#include <inttypes.h>
#include <stdlib.h>
#include <string.h>
#ifndef __symbian__
# include <malloc.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
size_t capacity;
size_t i... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "stm32f10x.h"
#include "usart.h"
#include "i2c.h"
extern char* itoa (int value, char* buffer, int base);
int main(void){
SystemInit();
usart1_init();
i2c_init();
char buf[4];
uint8_t data = 0xF0;
write_pcf8574(0x4e, data);
for(;;) {
d... |
C | #include<stdio.h>
void Euclid(int num1, int num2);//Ŭ ˰
void divisor_multiple(int num1, int num2);// Ǵ
void get_gcd(int nume1, int num2);// ִ 밡ٹ
void Expanded_Euclid(int num1, int num2);
int main()
{
int num1, num2, temp;
int menu;
while (1)
{
printf(" ԷϽÿ(Ͻ÷ -1): \n");
printf("----------------... |
C | #include<stdio.h>
#include<stdlib.h>
int main()
{
int n;
printf("Enter number of elements in the array");
scanf("%d",&n);
int *ptr;
ptr=(int*)malloc(sizeof(int)*n);
int i,j,temp;
for(i=0;i<n;i++)
scanf("%d",&ptr[i]);
for(i=0;i<n-1;i++)
{
for(j=0;j<n-i-1;... |
C | #include "main.h"
int main(int argc, char *argv[])
{
FILE *outFile;
char address[MAX_SIZE];
char name[MAX_SIZE] = "psinfo-report";
proc proc_info[10];
switch(argc){
case 2:
sprintf(address, "/proc/%s/status", argv[1]);
load_process(address, proc... |
C | #include <stdlib.h>
#include <stdio.h>
int main(){
float milhas, km;
printf("Digite a distancia em quilometros:");
scanf("%f", &km);
milhas=km/1.61;
printf("A distancia em milhas eh %.1f\n", milhas);
system("pause");
return(0);
}
|
C | #include<stdio.h>
#include<string.h>
int main(void)
{
char str[30];
int i,j,temp;
scanf("%s",str);
j=strlen(str)-1;
i=0;
while(j>i)
{
temp=str[i];
str[i]=str[j];
str[j]=temp;
i++;
j--;
}
printf("%s",str);
return 0;
}
|
C | #include <stdio.h>
int invertir(int numAInvertir){
int aux, invert = 0;
while (numAInvertir > 0){
aux = numAInvertir % 10;
invert = invert * 10 + aux;
numAInvertir /= 10;
}
return invert;
}
void main(){
int num, original, invertido;
printf("Ingrese el numero: \n");
... |
C | #include<stdio.h>
int array_size()
{
int n;
printf("Enter the size of the array\n");
scanf("%d",&n);
return n;
}
void array(int a[],int n)
{
int i;
printf("Enter the values in the array\n");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
}
void bubblesort(int a[],int n)
{
int temp,i,j;
for(i=0;i<n;i++)... |
C | //
// Created by 28943 on 2019/9/4.
//
#include "SeqList.h"
void SeqListInit(SeqList* sl,size_t capacity){//ʼ
assert(sl);
if(capacity == 0){
sl->_array = NULL;
sl->_size = 0;
sl->_capacity = 0;
}else{
sl->_capacity = capacity;
sl->_size = 0;
sl->_array = (Dat... |
C | #include<stdio.h>
int main(void)
{
int a, b, c, d;
//INPUT
printf("Enter four numbers\n");
scanf("%d%d%d%d", &a, &b, &c, &d);
//If a number is greater than the remaining four, then it must be the greatest one
printf("\n========================================\n");
if (a > b &&... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_vec_prog.c :+: :+: :+: ... |
C | #include <math.h>
#include "nwpl_mapproj_df.h"
#include "nwpl_map_earth.h"
# ifndef M_PI
# define M_PI 3.14159265358979323846
# endif
static const double pid2 = M_PI / 2.0;
static const double pid4 = M_PI / 4.0;
static const double deg2rad = M_PI / 180.0;
static const double rad2deg = 180.0 / M_PI;
# define ITER 3
i... |
C | /* example code for cc65, for NES
* 3 sprite objects
* using neslib
* Doug Fraker 2017
*/
#include "neslib.h"
#include "lesson24.h"
#include "Sprites.c"
const unsigned char TEXT[]={
"Sprites"};
const unsigned char PALETTE_BG[]={
0x0f, 0x00, 0x10, 0x30, // black, gray, lt gray, white
0,0,0,0,
0,0,0,0,
0,0... |
C | /*
* clock.c
*
* Created: 10/01/2020 09:34:10 PM
* Author: Mohamed Farag
*/
# define F_CPU 1000000UL
#include <avr/io.h>
//#include <avr/interrupt.h>
#include <util/delay.h>
#include "clock.h"
#include "state.h"
static unsigned char Hours = 0;
static unsigned char Miniutes = 0;
extern voi... |
C |
#include <stdio.h>
int main()
{
int x;
int i=0,j=0;
int flag = 0, flagline = 0;
scanf("%d", &x);
x--;
while (--x>=0) {
if (flag==0) {
//f1管x,y轴方向的运动
i++;
flag = 2;
flagline = 0;
}
if (flag == 1) {
j++;
flag = 2;
flagline = 1;
}
if (flag == 2) {
if (flagline == 0) {
//fl... |
C | /*
============================================================================
Name : Flyod_Warshall.c
Author : Naman Mandlik (3948)
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
==========================================================================... |
C | //*****************************************************************************
//
// This is the code that gets called when the processor receives a NMI. This
// simply enters an infinite loop, preserving the system state for examination
// by a debugger.
//
//*********************************************************... |
C | /**
* List the current windows
*/
#include "common.h"
#include <inttypes.h>
typedef struct _WINDOW_INFORMATIONS {
HWND hwnd;
LPTSTR szClass;
LPTSTR szTitle;
BOOL bVisible;
DWORD dwProcessId;
DWORD dwThreadId;
HMODULE hModule;
HINSTANCE hInstance;
} WINDOW_INFORMATIONS;
typedef struct... |
C | #include <stdio.h>
#include <stdlib.h>
/**
* _strdup - function to malloc and free
* @str: int
* Return: allways char
*/
char *_strdup(char *str)
{
char *ptr;
int c, i;
if (str == NULL)
return (NULL);
for (c = 0; str[c] != '\0'; c++)
{
}
ptr = malloc(c + 1 * sizeof(char));
if (ptr == NULL)
return (N... |
C | #include <stdio.h>
#include <stdlib.h>
int validate(char *name)
{
int i;
for (i=0;name[i] != '\0';i++)
{
if(!(name[i]>=65&&name[i]<=90)&& !(name[i]>=97&&name[i]<=122))
return 0;
}
return 1;
};
int main()
{
char *name="ai";
//fgets(name,sizeof(name),stdin);
... |
C | /* ************************************************************************** */
/* LE - / */
/* / */
/* create_lines.c .:: .:/ . .:: ... |
C | #include <stddef.h>
const char *odd_or_even(const int *v, size_t sz)
{
int sum = 0;
for (int i = 0; i < sz; i++) sum += v[i];
return sum % 2 == 0 ? "even" : "odd";
}
|
C | #include<stdio.h>
#include<ctype.h>
int main(){
char ch;
//int i;
ch = toupper(ch);
//i = ch;
scanf("c",&ch);
//for (i = ch; ch<='Z'; ch++)
//printf("character: %d\n",i);
if ('a'<=ch && ch<= 'z')
ch = ch-'a'+'A';
//scanf("%c",&ch);
printf("%c",ch);
return 0... |
C | // Version 1.4
// Created by Oliver Tan
// 19 May 2011
// Pits your AI against each other
// Must compile with Game.c and ai.c
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <assert.h>
#include "Game.h"
#include "mechanicalTurk.h"
// Game aspects
#define UNI_CHAR_NAME ('A' - UNI_A)
#define WINNING... |
C | /*******************************************************************/
/* EP1 de MAC0422 - Sistemas Operacionais */
/* */
/* Simulador de uma corrida - ep2.c */
/* ... |
C | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include "gtm/gtm_c.h"
#include "gtm/gtm_client.h"
#include "gtm/libpq-fe.h"
typedef enum command_t
{
CMD_INVALID = 0,
CMD_UNREGISTER
} command_t;
char *progname;
command_t command;
char *nodename = NULL;
int gtmport = -1;
char *gtmhost... |
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, 2020
** PSU_minishell2_2019
** File description:
** redirection
*/
#include <minishell.h>
#include <my_printf.h>
#include <my_tools.h>
char *get_redir_file(char **cmd, char *r)
{
for (size_t i = 0; cmd[i] != NULL; i++)
if (my_strcmp(cmd[i], r) == 0) return cmd[i + 1];
return NUL... |
C | #define _XOPEN_SOURCE 500
#ifdef _WIN32
#define PATH_SEPARATOR "\\"
#else
#define PATH_SEPARATOR "/"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <ftw.h>
#include <string.h>
#include <time.h>
enum Operator {BEFORE = -1, THEN = 0, A... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <unistd.h>
void* thread_summation(void *arg);
int sum = 0;
int main(int argc, char *argv[])
{
pthread_t t_id, t_id2;
int range[] = {1,5};
int range2[] = {6,10};
pthread_create(&t_id,NULL,thread_summation,(void *)... |
C | #ifndef expression_h
#define expression_h
#include <string>
#include <iostream>
#include "mapa.c"
#include "valores.c"
#include "Espacio.c"
#include "Robot.c"
#include "MapaRobots.c"
#define ERRORTIPO -2
#define TIPOBOOL 0
#define TIPOINT 1
#define TIPOCHAR 2
#define TIPOID 3
using namespace std;
//Clase expresion... |
C | /**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to y... |
C | /*************************************************************************
> File Name: name.c
> Author:
> Mail:
> Created Time: 2017年04月15日 星期六 15时47分34秒
************************************************************************/
#include<stdio.h>
void BSort(char a[][10],int size);
int strcmp(char str1[],char s... |
C | #include <stdio.h>
int main()
{
int i , k =100;
int sum=0,sum1= 0 ,sum2=0;
for (i=1;i<101;i++)
{
sum = sum + i;
}
for (int j = 0; j < 50 ; j++){
sum1 = (k-j) + j;
sum2 += sum1;
}
sum2 = sum2 + 50;
printf("1부터 100까지의 합 : %d\n",sum);
pr... |
C | #include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <limits.h>
#include <string.h>
#include "floydwarshall.h"
#define SQUARE(n) (n * n)
#define ARRAY_SET(arr, width, row, col, value) (arr[row * width + col] = value)
#define ARRAY_GET(arr, width, row, col) (arr[row * width + col])
#define VALUE (0)
#def... |
C | #include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <math.h>
int getCoinCount(int cents){
if (cents >= 25){
return cents / 25 + getCoinCount(cents % 25);
} else if (cents >= 10){
return cents / 10 + getCoinCount(cents % 10);
} else ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_split.c :+: :+: :+: ... |
C | /** @file
* A callback system for the cellvm, functions and times
* can be pushed into the callback stack and ran every X clock ticks.
*/
#include <stdio.h>
#include "cellvmcb.h"
#include "config.h"
/**
* Get the next free callback slot avalible in the callback_stack.
* @param stack Stack to get slot from.
* @... |
C |
#include "lists.h"
/**
* insert_node - malloc and insert node into sorted singly linked list
* @head: pointer to head of linked list
* @number: data for new node
* Return: address of new node, or NULL if failed
*/
listint_t *insert_node(listint_t **head, int number)
{
listint_t *tmp = NULL;
listint_t *new =... |
C | #include "common.h"
int partition(int arr[], int size, int sep) {
requires(size > 0);
freeze(ARR, arr);
// specification is still incomplete (e.g. ARR=[0,0,1], arr=[0,1, 1])
ensures(
forall(t, range(0, ret), arr[t] < sep)
&& forall(t, range(ret, size), arr[t] >= sep)
&& forall(t... |
C | #include "msgdist_utils.h"
//------------------------------------------------------------------ sinal de encerramento do cliente
void serverOffline() {
char pipeName[20];
snprintf(pipeName, UTIL_BUFFER_SIZE, CLIENT_PIPE, getpid());
printf("MSGDIST: (CLIENT) Server is offline. Exiting now...\n");
unli... |
C | #include "fdf.h"
t_vec3 *vec3(double x, double y, double z)
{
t_vec3 *ret;
ret = malloc(sizeof(*ret));
ret->x = x;
ret->y = y;
ret->z = z;
return (ret);
}
double vec3_length(const t_vec3 *v)
{
return (sqrt(v->x * v->x + v->y * v->y + v->z * v->z));
}
double vec3_dot(const t_vec3 *a, const t_vec3 *b)
{
retur... |
C | // sjf with arrival time - non preemptive
#include<stdio.h>
// function declarations
void bubbleSort(int* burstTime, int* ArrivalTime, int* processNo, int n);
void sjfsort(int* burstTime, int* ArrivalTime, int* processNo, int n);
void swap(int* num1, int* num2);
void computeStartTime(int* startTime, int* burs... |
C | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main(void)
{
int num1;
printf("num1를 입력하세요\n");
scanf("%d", &num1);
if ((num1 >> 31) == 0)
printf("%d는(은) 양수입니다. 이 수의 절댓값은 %d이고, 절댓값을 4로 나눈 몫은 %d이고, 나머지는 %d입니다.", num1, num1,num1 / 4, num1 % 4);
else
printf("%d는(은) 음수입니다. 이 수의 절댓값은 %d이고, 절댓값을 4로 나눈 몫은 %d... |
C | /* Problems 3.60 - 3.70 */
/* 3.60 */
// A. A[i][j][k] = Xd + L(i*S*T + j*T + k) // in this problem L = 4;
// B. S = 9, T = 11, R = 5; // (S*T = 99) (T = 11) (S*T*R) = 1980/4;
/* 3.61 */
// As my IDE doesn't support C99.. so I'm no sure whether or not my answer is right.
// There are 4 value that must bu used : Aro... |
C | void print(struct student *phead)//
{
struct student *p ;
int t=0;
system("cls");
if(count==0)
{
gotoxy(15,3);
printf("Բ𣬵ǰûѧ!\n");
}
else
{
gotoxy(15,3);
printf("=================================================\n");
gotoxy(15,4);
printf("|");
gotoxy(63,4);
printf("|");
for(p=phead->next;p... |
C | /* Program to illustrate the difference of prefix and postfix decrementing.
Author: Kollen Gruizenga */
#include <stdio.h>
int main(){
printf("I will be using two variables, A and B, both integers to demonstrate pre and post decrementing.\n\n");
int A=1; int B=0;
printf("A value is %d, B value is %d.\n",A,B... |
C | // General setup File
//Tempature Functions headers
float celToFrah(float);
float frahToCel(float);
float getTemp(); // changed from into to float
int getStatus();
int prevTemp = 0; // keeps track of the previous temp inorder to regulate display output
int overHeat = 0; // over heat toggle state variable
int sens... |
C | /*
* serial.c
*
* Created on: Jan 14, 2019
* Author: Collin Maker
*
*
*/
#include "msp.h"
#include "globals.h"
#include "serial.h"
//================================================================================
//Initializes UART for serial communications
//===============================... |
C | #include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<fcntl.h>
int main()
{
int fd1,fd2;
char buf[1024];
char buf2[1024];
memset(buf2,'\0',sizeof(buf2));
memset(buf,'\0',sizeof(buf));
fd1 = open("simple.txt",O_RDONLY);
fd2 = open("simple.txt",O_RDONLY);
read(fd1,buf,4);
printf("%s\n",buf);
read(fd... |
C | #include<stdio.h>
#include<conio.h>
void main()
{
int num,i=40,r=70;
printf("print odd number in a given range i to r:");
for (num=i;num<=r;num++)
{
if(num%2==1)
printf("%d",num);
}
getch();
}
|
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <fcntl.h>
#include <string.h>
#define READ 0
#define WRITE 1
#define TAMANIO 100
int main (){
int bandera = 0; //bandera para finalizar el programa
int p[2]; //pipe
pipe(p);
pid_t pid; //creo el proceso
pid = fork(... |
C | #include <time.h>
#include "camera_cmd.h"
void callback(int percentage, char* filename){
//((part_idx*100)/max_row)
printf("\b\b\b\b\b%4d%%",percentage);
fflush(stdout);
}
int main(int argc, char **argv)
{
if (argc != 3 && argc != 4)
{
fprintf(stderr,
"Usage: %s <ip_port> <mote_id> [<img_type>]\... |
C | /**************************************************************************************
Author: Stav Ofer
Creation date: 2013-08-08
Last modified date: 2013-08-16
Description: Memory management functions, in method of contiguous allocation.
Overhead: metadata of each block, general met... |
C | #include <stdio.h>
/**
* program that prints all the arguments without using ac
* @av: argument vector
* Return: 1 upon success
**/
int main(int ac, char **av)
{
int x;
if (ac > 0)
{
for (x = 0; x < ac; x++)
printf("%s\n", av[x]);
}
return (1);
}
|
C | #include "unp.h"
//若成功返回未连接套接字描述符,出错则不返回
int Udp_client(const char *host, const char *serv, SA **saptr, socklen_t *lenp)
{
int sockfd, n;
struct addrinfo hints, *res, *ressave;
bzero(&hints, sizeof(struct addrinfo));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_DGRAM;
//用于转化hostname,service参数
... |
C | /**
* 在数的对二的补码表示中,我们编写的itoa函数不能处理最大的负数,即n = -2 ^ (字长 - 1)的情况,请解释其原因.
* 修改该函数,使它在任何机器上运行时都能打印出正确的值.
*/
#include <stdio.h>
#include <limits.h>
#define abs(x) ((x) < 0 ? -(x) : (x))
void itoa(int n, char s[]);
void itoa2(int n, char s[]);
void reverse(char s[], int n);
int main(){
char s[100];
itoa(12345, s);
printf... |
C | #pragma once
#include<stdbool.h>
typedef int datatype;
typedef struct Stack {
datatype *val;
int size;
int capacity;
}Stack;
//ʼջ
//void init(Stack* s);
//ջ
void extend(Stack* s);
//ջ
void pushStack(Stack* s, datatype val);
//ջ
void popStack(Stack* s);
//ջԪ
datatype return_top(Stack* s);
//ջЧ
int return_num(Stack* ... |
C | #include "graph.h"
#define GRAPH_PAGE 10000
#define LINE_PAGE 10000
#define GRAPH_NUM_POOL 5
#define TOLERANCE 1e-9
int cmp_double(const void * a, const void * b) {
if (*(double*)a > *(double*)b)
return 1;
else if (*(double*)a < *(double*)b)
return -1;
else
return 0;
}
int cmp_vert(const void * a, const vo... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAXV 1000
#define MAXE 500000
int input[MAXE][3];
void WQY_bedge_fast_sort(int st,int end)
{
int low, high;
int pivotK0, pivotK1, pivotK2;
low=st;
high=end;
if(st>=end)
return;
pivotK0=input[low][0];
pivotK1=input[low][1];
pivotK2=input[l... |
C | #include <stdio.h>
void insert_n_display()
{
int numbers[10], i;
for (i = 0; i < 10; i++)
{
printf("Enter a number:\n");
scanf("%d", &numbers[i]);
}
printf("The numbers are:\n");
for (i = 0; i < 10; i++)
{
printf("numbers[%d] has value %d\n", i, numbers[i]);
}
}
... |
C | //
// Created by chengwenjie on 2019/8/29.
//
#include <stdio.h>
#include "jam.h"
#include "lock.h"
Object *exceptionOccured() { return NULL; }
void signalException(char *excep_name, char *message) {}
unsigned char *findCatchBlockInMethod(MethodBlock *mb, Class *exception, unsigned char *pc_pntr) {
ExceptionTabl... |
C | #include "sorting.h"
/* Helper function for mergeSort */
int merge(Data *arr, int low, int mid, int high) {
int l1, l2, i, complexity = 0;
Data *tmp = malloc(sizeof(Data) * (high+1));
for(l1 = low, l2 = mid + 1, i = low; l1 <= mid && l2 <= high; i++) {
if(arr[l1].value <= arr[l2].value)
... |
C | #include <stdio.h>
#include "dk_tool.h"
int enterNumberIn10(void)
{
int a;
printf("Enter a number in 10-system: "); // 10-
do
{
int theTmp = scanf("%d",&a);
if(theTmp == 1) //
{
break;
}
printf("Please,try again: ");
ff... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_none.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<unistd.h>
int main(int argc,char **argv)
{
char path[128];
char *p=NULL;
int ret;
char *retp = getcwd(path,sizeof(path));
if(NULL==retp)
{
perror("getcwd");
return -1;
}
printf("path=%s\n",path);
p = getcwd(NULL,0);
printf("p=%s\n",p);
return 0;
}
|
C |
#include <stdio.h>
#include <stdlib.h>
int main()
{
if (puts("hello word!\n") < 0 )
{
printf("puts error!\n");
exit(0);
}
return 0;
}
|
C | struct bool check(struct vll* a, struct vll* b) {
int n = a.size();
if(b.size() != n)
return false;
int ii = 0;
for(ii = 0; ii < n; ++ii)
{
if(a[ii] > b[ii])
return false;
}
return true;
}
int main()
{
int T;
cin = T;
while(T--)
{... |
C | #include <stdio.h>
int main (int argc,char *argv[]){
int i=0;
if (argc ==1){
printf("You only have one argument. You suck.\n");
} else if (argc >1 && argc<4){
printf("Here's your arguments: \n");
for(int i=0;i<argc;i++){
printf("%s ",argv[i]);
}
printf("\n");
} else {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.