language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | //Jorlen Osuna. C.I.: 24196692
//using namespace std;
//#include <algorithm>
QSinfo qs_partition(DynArray<long> & a, const long l, const long r,
Sel_Pivot sel_pivot)
{
int pivot = get<0>(sel_pivot(a,l,r));
int i = l;
int j = r-1;
size_t comp = 0;
size_t swp = 0;
long piv = a[pivot];
swap(a(pivot... |
C | #include "resizelist.h"
/*int main() {
list *test = makeNodeDoubList();
nodeDoub *t = createNodeDoubList();
printf("%d\n", t->data);
addNodeDoub(test, t);
addNodeDoub(test, t);
addNodeDoub(test, t);
addNodeDoub(test, t);
addNodeDoub(test, t);
addNodeDoub(test, t);
addNodeDoub(test, t);
addNodeDou... |
C | #include <stdio.h>
#include <stdlib.h>
#include "../../String/SString.h"
#define N 100
//the tools to help you watch the process of KMP
void KMPprint(SString s ,SString t , int si , int ti){
printSString(s);
int i;
for( i = 0 ; i < si - ti ; i ++ )printf(" ");
printSString(t);
}
int* getNext(SString ... |
C | /** @file
* Control digit's segments animation.
*
* Animations informations tells what segments should be drawn, and the position
* of each segments.
*
* An "animation" is identified by a numeric id. Each animation is made of 9
* steps, and some animations are marked as either "solo" or "double". Double
* anima... |
C | /* utilhash.c
** libstrophe XMPP client library -- utilhash table implementation
**
** Copyright (C) 2005 OGG, LCC. All rights reserved.
**
** This software is provided AS-IS with no warranty, either express
** or implied.
**
** This software is distributed under license and may not be copied,
** modified or distr... |
C | #include "rvscallback.h"
volatile void* g_hasNewConn=NULL;
//lost connection
void LostConnectionCallback(void* connectId, const char* ip, int port)
{
printf("lost conn, id: %p, ip: %s, port: %d\n", connectId, ip, port);
}
//have a new connection
void NewConnectionCallback(void* connectId, const char* ip, int port... |
C | #include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
/**
Hacer una calculadora. Para ello el programa iniciará y contará con un menú de opciones:
1. Ingresar 1er operando (A=x)
2. Ingresar 2do operando (B=y)
3. Calcular todas las operaciones
a) Calcular la suma (A+B)
b) Calcular la resta (A-B)
c) Calcular la divi... |
C | #include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#define SERVER_UDP_PORT 5003 /* Server port */
#define MAXLEN 64 /* maximum data length */
int main(int argc, char **argv)
{
i... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strtrim.c :+: :+: :+: ... |
C | #include<string.h>
#include<stdio.h>
int main(void){
char t[4];
t[3] = '\0';
memset(t, '*', 3);
printf("%s\n", t);
return 0;
}
|
C | #include <stdio.h>
int main() {
char data[33];
FILE* p = popen("cat /dev/ttyACM0", "r");
if (!p) {
puts("could not open process");
return 1;
}
fgets(data, 33, p);
printf("%s\n", data);
puts("done");
if (pclose(p) == -1) {
puts("could not close process");
... |
C | /*
* a.c
*
* Created on: Aug 14, 2020
* Author: Muhammad Watad && Shadi Abu Shqara
*/
#include <stdlib.h>
#include "a.h"
#include "error.h"
A* A_create(int n, int nnz) {
A* a = (A*)malloc(sizeof(A));
exit_if_no_memory(a);
a->n = n;
a->colind = (int*)malloc(nnz * sizeof(int));
... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct Node //定义节点结构
{
int left;
int right;
} node;
typedef struct Line//定义队列节点
{
int date;
struct Line * next;
} line;
void add_line(line *head,int item)//队列插入方法
{
line *temp=head;
while(temp->next != NULL){
temp=temp-... |
C | struct TreeNode* sortedArrayToBSTDfs(int* nums, int numsSize, int startIndex, int endIndex)
{
int mid;
struct TreeNode* root = NULL;
mid = startIndex + (endIndex - startIndex) / 2;
if (mid < 0 || mid > endIndex || mid == numsSize) {
return NULL;
}
root = (struct TreeNode*)calloc(1, size... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_command_info.c :+: :+: :+: ... |
C | /*
** EPITECH PROJECT, 2020
** nm
** File description:
** get_type_32
*/
#include "../../inc/my_nm.h"
// Get flags extended again
static char get_flags_ter(Elf32_Sym *symbol, Elf32_Shdr *sections)
{
if ((sections[symbol->st_shndx].sh_type == SHT_FINI_ARRAY ||
sections[symbol->st_shndx].sh_type == SHT_INIT... |
C | /*
* STM_DRIVER.C
*
* Created on: Nov 2, 2015
*
* This Driver provides functions to configure and initialize the System Timer Module or STM
* It allows to handle the interrupt flags and permits access the registers to change their
* values.
*
* Each function is declared fully descriptive to ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <sys/wait.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#define BUF_SIZE 30
void error(char * message);
void read_childproc(int sig);
char webpage[] = "HTTP/1.1 200 OK\r \n"
"Content-Type:text/html; cha... |
C | /* Written by Pouya Kheradpour (pouyak@gmail.com)
* Copyright (c) 2005-2015 Massachusetts Institute of Technology
* Released under the MIT license
* https://pouya.kheradpour.com/software/LICENSE.mit */
/* version 20160416 */
#ifndef PK_BL_H
#define PK_BL_H
/* indexing for consm->mat. note similarity to ICidx */
#d... |
C | //Alejandro Hurtado Data 1A
//Ejercicio 12
#include<stdio.h>
/*
int main(int argc, char *argv[]){
int i=0;
if(argc==1){
printf("You only have an argument. You suck.\n");
}else if(argc>1 && argc <4){
printf("Here is your arguments: \n");
for(i=0;i<argc;i++){
printf... |
C | /*
* 点亮LED灯
* 开发板D1, D2, D6
* sfr(Special Function Register特殊功能寄存器的缩写),sbit(特殊功能寄存器位):
* 与定义一般的int、char型变量不同,这两个字定义的并不是变量,
* 而作为特殊功能寄存器的引用(地址或指针?),或许可以叫做别名
*/
#include <reg52.h> // 此文件中定义了单片机的一些特殊功能寄存器
sbit LED_1 = P2^0; // 将MCU P2.0端口定义为LED_1
sbit LED_2 = P2^1; // 将MCU P2.1端口定义为LED_2
sbit LED_6 = P2^5; // 将MCU P2.... |
C | /* cat.c
* Simple program that read file name from user input then print its data to console
* This program will use file read and write by default for all operation
*/
#include "syscall.h"
// Size of buffer
#define MAX_FILE_LENGTH 64
#define BUFFER_SIZE 100
// Constants for file operations
#define OPEN_READ_WRITE... |
C | #include<stdio.h>
#include<stdlib.h>
#define LENTH_MAX 100000
int compare_int(const void *a,const void *b){
return *(int*)a - *(int*)b;
}
int main(void){
int N,A[LENTH_MAX],i,Card_type=0;
scanf("%d",&N);
for(i = 0;i < N;i++){
scanf("%d",&A[i]);
}
qsort(A,N,sizeof(int),compare_int);... |
C | /*
File: my_allocator.c
Author: <Julian Tiu>
Department of Computer Science
Texas A&M University
Date : <date>
Modified:
This file contains the implementation of the module "MY_ALLOCATOR".
*/
/*--------------------------------------------------------------------------... |
C | #include <stdio.h>
#include <string.h>
int main() {
char* sentence = "This is my example sentence";
int hash_table[256] = {0};
// Iterate over the letters of the sentence
for (int i=0; i<strlen(sentence); i++) {
// Use the identity hash function to find
// and increment counter in hash... |
C | #include<stdio.h>
int revrse(int a[],int n)
{
if(n==0 || n==1)
return 1;
if(a[n-1]<=a[n-2])
return 0;
return revrse(a,n-1);
}
int main()
{
int n,a[20];
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
if(revrse(a,n))
printf("Strictly ascending\n");
else
printf("not Strictly ascending\n")... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* primary.c :+: :+: :+: ... |
C |
#include "py_defines.h"
#include <stdio.h>
#include "dconv.h"
#if defined(_MSC_VER)
#define inline __inline
//#else
//#include <stdint.h>
#endif
#define IS_NAN(x) Py_IS_NAN(x)
#define IS_INF(x) Py_IS_INFINITY(x)
static const char g_hexChars[] = "0123456789abcdef";
typedef struct _encoder
{
char *start, *end, *s;... |
C | #include "matrix.h"
#include "log.h"
#include <API.h>
#include <stdlib.h>
#include <string.h>
/**
* @brief Asserts a condition is true
*
* If the assertion is non-zero (i.e. true), then it returns.
* If the assertion is zero (i.e. false), then it display the string and
* aborts the program.
* This is meant to ac... |
C | /* prog9_2, @}Cާ@(~ܽd) */
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int i,score[4]; /* ŧiܼiPư}Cscore */
score[0]=78;
score[1]=55;
/* score[2]=92; NNscore[2]] */
score[3]=80;
for(i=0;i<=4;i++) /* NNޭȶWX}Cscoreie\d */
printf("score[%d]=%d\n",i,score[i]);
... |
C | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/msg.h>
#include "message.h"
int main (int argc, char **argv)
{
// Check the arguments
if (argc > 2) {
fprintf(stderr, "usage: send [text]\n");
exit(1);
}
const char *text;
if (argc == 2) {
text = argv... |
C | //John Kircher 10/19/2020
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_attr.h"
#include "driver/mcpwm.h"
#include "soc/mcpwm_reg.h"
#include "soc/mcpwm_struct.h"
#define SERVO_MIN_PULSEWIDTH 0 //Minimum pulse width in microsecond
#define SERVO_MAX_PULSEWIDTH 1000 //Max... |
C | // 包含了习题5.1-2和5.1-3
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int crandom(int a, int b);
static unsigned int seed;
int main(void)
{
int begin, end;
printf("Please input a range:\nbegin:\n");
scanf("%d", &begin);
printf("end:\n");
scanf("%d", &end);
srand(time(0));
printf("... |
C | #pragma once
#include "Point.h"
struct IntSize
{
IntSize(size_t width, size_t height, size_t depth)
: width(width)
, height(height)
, depth(depth)
{
}
IntSize(Point p)
: width((size_t)p.x)
, height((size_t)p.y)
, depth((size_t)p.z)
{
}
size_... |
C | /**
* @file hijos.h
* @author Gabriela Limonta 10-10385
* @author John Delgado 10-10196
*
* @section Grupo 09
*
* Contiene la implementacion de las funciones
* que son comunes a todos los hijos.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <sysexits.h>
#include "hijos.h"
/**
* Estrutura que guarda ... |
C | /* rb_tree.c - implements a red-black binary search tree
*/
#include <stdio.h>
#include <string.h>
#include "item.h"
#define MYSTRUCT item_node
#define MYVISIT wid_show_item_node
#define RED 2
#define BLACK 3
extern void MYVISIT();
void wid_inorder_traverse2(x, myvisit)
struct MYSTRUCT *x;
void (*myvisit)();
{... |
C | #include<stdio.h>
#include<string.h>
void spnum()
{
char s1[20];
int n,l,i;
printf("\nEnter the string:");
scanf("%s",s1);
l=strlen(s1);
//printf("\nlength=%d",l);
printf("\nEnter 1 Or -1 to get singular form\nEnter 2 to get plural form\n\n\t\t\t\t op= ");
scanf("%d",&n);
if(n==1 || n==-1)
{
... |
C | int f(int m, int n)
{
int q;
if(n>m)
{
n=m;
}
if(m==1||n==1||m==0)return(1);
q=f(m-n,n)+f(m,n-1);
return(q);
}
int main(){
int i,j,k,n,m,t;
scanf("%d",&t);
while(t--)
{
scanf("%d%d",&m,&n);
k=f(m,n);
printf("%d\n",k);
... |
C | #include <stdio.h>
int main(void){
int numA = 0;
int numB = 0;
printf("Enter first positive integer: ");
scanf("%d", &numA);
printf("Enter second positive integer: ");
scanf("%d", &numB);
while(numA != numB){
if(numA > numB){
numA -= numB;
printf("A=%d, B=%d", numA, numB);
printf("\n");
}
e... |
C | #include<stdio.h>
int main(int argc, char const *argv[])
{
/* code */
int A , B, ADD , SUBTRACT , MULTIPLY;
float DIVIDE;
printf("enter two integers\n");
scanf("%d%d" , &A , &B);
ADD=A+B;
SUBTRACT=A-B;
MULTIPLY=A*B;
DIVIDE=A/(float)B;
printf("SUM = %d\n" , ADD);
printf("DI... |
C | #include "pending.h"
#include "mgos.h"
#include <stdio.h>
struct timestamped_vote *votes = NULL;
int num_pending_votes = 0;
int vote_array_size = 200;
inline void init_unsent_votes()
{
votes = malloc(sizeof(*votes) * vote_array_size);
}
inline void grow_vote_array()
{
int new_size = vote_array_size * 2;
votes =... |
C | #include <stdio.h>
#include "common.h"
#include "compiler.h"
#include "debug.h"
#include "value.h"
#include "vm.h"
VM vm;
/**
* Reset the virtual machien stack
*
* This sets the stack pointer `stack_top`
* to be pointed at the begging of the stack
* array, indicating that the stack is empty.
*/
static void vm_s... |
C | /******************************************************************************
* @file main.c
* @author titav
* @version v0.0.0.1
* @date 09.11.2022
* @brief CRC32 project test
******************************************************************************/
#include <string.h>
#include "main.h"
#in... |
C | /*
Wheathash takes (optimally) 32-bit inputs and produces a 64-bit hash as its result.
It is a slightly-edited version of Waterhash, which is an edited version of wyhash.
It is meant to use very similar code to Waterhash, which produces a 32-bit hash.
Original Author: Wang Yi <godspeed_china@yeah.net>
... |
C | #include "simpletools.h"
static void checkDriveGoto(int left, int right)
{
// Get the initial position and orientation
double x0, y0, theta0;
simulator_getPose(&x0, &y0, &theta0);
// Now turn
drive_goto(left, right);
// Get the final position and orientation
double x1, y1, theta1;
simulator_getPose(&... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(void){
int cnt=0;
char ch1,ch2;
printf("Please enter the char(enter # to quit):");
while((ch1=getchar())!='#'){
if(ch1=='e'){
if((ch2=getchar())=='i')
++cnt;
}
}
printf("'ei' appears %d times",cnt);
return 0;
}
|
C | /*一个数加上100后是一个完全平方数,再加上168后也是一个完全平方数*/
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
long int i, j, k;
for(i = 0; i < 10000; i++)
{
j = sqrt(i + 100);
k = sqrt(i + 268);
if(((j * j) == (i + 100)) && ((k * k) == (i + 268)))
{
printf("\n%ld\n", i);
}
}
return 0;
}
|
C | #include "libft.h"
char *ft_strchr(const char *s, int c)
{
size_t length;
size_t count;
count = 0;
length = ft_strlen(s);
while (count < length + 1)
{
if (*s == (unsigned char) c)
return ((char *)(s));
count++;
s++;
}
return (0);
}
|
C | #include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
int main(){
int padre=getpid();
for(int i=0;i<3;i++){
int pid=fork();
if(pid==0){
if(i==0){
for(int k=0;k<2;k++){
int pid=fork();
if(pid!=0){
break;
}
}
}
if(i==1){
... |
C | #include<stdio.h>
#include<stdlib.h>
#define BATCH 30
int main(int argc, char *argv[]) {
FILE *in, *out;
if(argc < 3) {
if(argc == 1) {
in = stdin;
out = stdout;
} else {
fprintf(stderr, "Either supply both arguments"\
"(input output), or none\n");
return -1;
}
} else {
in = fopen(argv[... |
C | #include <stdio.h>
#include "PCB.h"
#include "time.h"
//PCBTEST::::: Errors FOUND
// 1) When you call free(), it does free up memory, but you can still print PCB
// 1) IN Create() if you do not put in string for name, code execution fails)
// 1) IN PCB Create() if you don't put in a int for ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define SIZE 10
int main(void)
{
int prices[SIZE] = { 0 };
int i, minimum, maximum;
printf("------------------------------------\n");
printf("1 2 3 4 5 6 7 8 9 10\n");
printf("------------------------------------\n");
srand((unsigned)time(... |
C |
int partition_d(int arr[], int low, int high, int pi1, int pi2, int *lp)
{
int i1, j1;
for (i1=low; i1<high; i1++)
{
porownania++;
if (arr[i1] == pi1)
break;
}
for(j1 = high; j1 >= low; j1--)
{
porownania++;
if(arr[j1] == pi2)
... |
C | #include "binary_trees.h"
#include "9-binary_tree_height.c"
/**
* binary_tree_balance - Measures the balance factor of a binary tree.
* @tree: is a pointer to the root node
* Return: 0 if there are no tree or type int.
*/
int binary_tree_balance(const binary_tree_t *tree)
{
int left = 0, right = 0;
if (!tree)... |
C | #include <stdio.h>
#include <string.h>
void printSubStr(char* str, int low, int high)
{
for(int i=low;i<=high/2;i++)
{
if(str[i]>str[i+1])
{
printf("-1");
return;
}
}
for(int i=low;i<=high;i++)
printf("%c", str[i]);
}
... |
C | #include "../inc/libmx.h"
char *mx_strjoin(const char *s1, const char *s2) {;
if (s1 == NULL && s2 != NULL) {
char *c_s2 = mx_strdup(s2);
return c_s2;
}
if (s1 != NULL && s2 == NULL) {
char *c_s1 = mx_strdup(s1);
return c_s1;
}
if (s1 != NULL && s2 != NULL) {
char *c_s1 = mx_strnew(mx_strlen(s1) + mx_... |
C | #include <stdio.h>
#include <sys/time.h>
#include <unistd.h>
double intervalo_tiempo_ms(struct timeval toc, struct timeval tic);
int main() {
struct timeval tic, toc;
double x, dif, suma = 0;
gettimeofday(&tic, NULL);
for (int i=0; i < 10000000; i++)
suma += 1.0/(2*i + 1) - 1.0/(2*i + 2);
get... |
C | #include<stdio.h>
#include<stdlib.h>
int main()
{
int n;
printf("enter the no.");
scanf("%d",&n);
switch(n%7)
{
case 0:
printf("sunday");
break;
case 1:
printf("monday");
break;
case 2:
printf("thusday");
break;
case 3:
printf("wednesday");
case 4:
printf("thusday");
case 5:
printf("friday");
break;
default:
printf("sa... |
C | #include "common.h"
static menu_s s_menu[2];
static menu_s s_menuFileassoc[2];
static bool s_curMenu, s_curMenuFileassoc;
menu_s* menuGetCurrent(void) {
return &s_menu[s_curMenu];
}
menu_s* menuFileassocGetCurrent(void) {
return &s_menuFileassoc[s_curMenuFileassoc];
}
menuEntry_s* menuCreateEntry(MenuEntryT... |
C | #include "../headers/utils.h"
void printVector(int *vector, int length){
for(int i = 0; i < length; i++){
printf("%d ", vector[i]);
}
printf("\n");
}
void generateVector(int *vector, int length, int mode){
switch(mode){
case RANDOM:
for (int i = 0; i < length; i++){
vector[i] = rand() % ... |
C | /****************************************************************
*****************************************************************
_/ _/ _/_/_/ _/ Numerical Simulation Laboratory
_/_/ _/ _/ _/ Physics Department
_/ _/_/ _/ _/ Universita' degli Studi di Milano
_/ _/ ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/file.h>
#include <signal.h>
#include <dirent.h>
#include <time.h>
#define tasks "./tasks"
#define results "./results"
int sumDir = 0, sumFile = 0, sumLine = 0;
i... |
C | /******************************************************
PR2 Praktikum 3.1
Autor: Domenic Heidemann, Maxim Eigenser
Funktion: Auslesen einer Datei, Inhalt als
Liste abspeichern, Inhalt erweitern
******************************************************/
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#inc... |
C | #include <libc.h>
#include "initrd.h"
#include "multiboot2.h"
#define SUPERBLOCK_MAGIC 0x42
#define MAX_FDS 1024
enum ftype {
FILE, DIR
};
struct superblock {
byte magic;
uint ninode;
} __attribute__((packed));
struct inode {
char name[128];
byte type;
ulong offset;
ulong length;
} __attribute__((packed));
... |
C | #include<stdio.h>
#include<string.h>
int main()
{
char p[10][10],t[10];
int a[10], b[10], start[10],finish[10], tat[10], wt[10], i,j,n,temp;
int tt_wt=0,tt_at=0;
printf("enter the number of processes:");
scanf("%d",&n);
for(int i=0, i<n;i++)
{
... |
C | /*
Program for Infix, Postfix, Prefix Conversion using Stack.
*/
#include<stdio.h>
#include<string.h>
int top=-1;
char stack[20][20],stack1[20];
void posttoin(char stack[20][20],char exp[20],int top)
{
int i,len;
char op1[20],op2[20],str[20],s1[20],test[20];
for(i=0;exp[i]!='\0';i++)
{
if(ex... |
C | #include <stdio.h>
#include "Schedule_UI.h"
#include "Studio_UI.h"
#include "Play_UI.h"
#include "Sale_UI.h"
#include "Seat_UI.h"
void Main_Menu(void) {
char choice;
do {
printf("\n==================================================================\n");
printf("**************** Theater Ticket Managemen... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "nearest_neighbour.h"
#include "TSP_parser.h"
#include "globals.h"
#include "brute_force.h"
/**
* \file nearest_neighbour.c
* \brief SOURCE - Implements the nearest neighbour algorithm to solve a tsp problem
* \author BERN... |
C | #include "timing.h"
#include "task_wait_recursive.h"
#include <omp.h>
#include <stdio.h>
static void recursive_wait_task(const size_t depth) {
if (depth < N_RECURSIVE_TASK_WAITS) {
#pragma omp task default(none) firstprivate(depth)
{
recursive_wait_task(depth + 1);
}
#pragma omp taskwa... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_is_first_cmd.c :+: :+: :+: ... |
C | #include <stdio.h>
int
main(void)
{
FILE *yikes;
double waterA[50];
int num_months =0, temp = 0, i= 0;
yikes = fopen("numbers.txt","r");
for (i = 0; i < 30; i++)
{
fscanf(yikes,"%lf",&temp);
printf("%.2lf",temp);
waterA[i] = temp;
num_months++;
}
for (i = 0; i< num_months; i++)
{
printf("%... |
C | #include <stdlib.h>
#include <stdio.h>
int main() {
float nota;
printf("Esta aplicacin recoge un nmero real entre 0 y 10 y devuelve la descripcin de la calificacin.\n");
printf("Introducir nmero real entre 0 y 10 (nota)");
scanf("%f", ¬a);
printf("Para una nota de %f, el resultado es ", nota);
if(not... |
C | #include<stdio.h>
#define alert2() (printf("/a/a\n"))
#define puts_alert2(str) (alert2(),puts(str))
int main(void){
int n;
setvbuf(stdout,NULL,_IONBF,0);
printf("整数入力");
scanf("%d",&n);
if(n)
puts_alert2("not_zero\n");
else
puts_alert2("exactly_zero\n");
return 0;
}
|
C | //producer consumer sa bounded bufferom
//Disciplina: SW
monitor producer_consumer{
T[N] buffer;
int head=0;
int tail=0;
int size=0;
cond full,empty;
void produce(T item){
if(size == N){
empty.wait();//nema mesta
}
size++;
buffer[tail] = item;
tail = (tail + 1)%N;
if(full.queue()){//ako neko ... |
C | #include <stdio.h>
#include <math.h>
void mov(int n, int a, int b, int c){
if(n==0) return;
mov(n-1, a, c, b);
printf("%d %d\n", a, b);
mov(n-1, c, b, a);
}
int main(void){
int N;
scanf("%d", &N);
printf("%d\n", (int)pow(2, N)-1);
mov(N, 1, 3, 2);
}
|
C | #include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int A[]={12,23,34,45,56,67,78,89,90};
int *p;
p=A;
printf("a)%-20d\n",*p+2); //12+2
printf("b)%-20d\n",*(p+2)); // 34 => A[2]
printf("c)%-20d\n",&p+1); //adresse de p +1 # !different de A[1] <= fausse
prin... |
C | #include<stdio.h>
#define M 50
void ShellSort (int a[],int n)
{
int i,j,temp;
int h=1;
while(h<n/3)
h=(h*3)+1;
while (h>=1)
{
for(i=h;i<n;i++)
{
for(j=i;j>=h;j-=h)
{
if(a[j]<a[j-h])
{
temp = a[j];
a[j]=a[j-h];
a[j-h]=temp;
}
}
}
h=h/3;
}
}... |
C | #include<stdio.h>
int adj[5000][5000],vis[5000],ans[5000];
int n,u,v,w[5000][5000],p,z,k,degree[5000];
int dog[5000];
int stack[5000];
void swap(int *a,int *b)
{
int temp = *a;
*a =*b;
*b = temp;
}
void insertion(int i)
{
while(ans[i]<ans[i-1])
{swap(&ans[i],&ans[i-1]);i--;}
}
int ma... |
C | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
int i=4;
double d=4.0;
char str1[]="HackerRank ";
char str2[100], copy_str[100];
char *pstr1, *pstr2, *pcopy_str;
pstr1=str1;
pstr2=str2;
pcopy_str=copy_str;
//printf("enter the first and second number :: ");
scanf("%d",&i);
scanf("%lf",&d... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <time.h>
#include <math.h>
#include "graph.h"
#include "free.h"
#include "medList.h"
#include "defines.h"
#include "fileManager.h"
#include "companyReader.h"
int openAndReadCityFile(char *path, graph * map) {
FILE * file = fopen(p... |
C | #include <stdio.h>
void timeChange(int k) {
int h, m, s;
h = k/3600;
k -= h*3600;
m = k/60;
s = k%60;
printf("[%dð:%d:%d]", h, m, s);
}
int main() {
int n;
scanf("%d", &n);
timeChange(n);
return 0;
}
|
C | /*
modified TT-input external to use bcm2835 library instead of deprecated wiringpi
renamed everything from terminaltedium to cm
renamed again to cm_digital
usage in PD, for example:
-------------------------
cm_digital_output 34
pin legend (CM MK1.5):
----------------------
gpio 34 = CLK1 output
gpio 35 = CLK2 outp... |
C | #define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include "rtrie.h"
#include "tabletrie.h"
void error(char *msg);
void error(char *msg)
{
printf("%s\n", msg);
exit(EXIT_FAILURE);
}
int main(void)
{
FILE * fp;
char * line = NULL;
size_t len = 0;
ssize_t read;
struct rtrie__view view;
s... |
C | #include "roman_calculator.h"
#include "validations.h"
#include "conversions.h"
#include <stdlib.h>
static bool function_paramenters_are_valid(const char* numeral1, const char* numeral2, char result[16])
{
if(is_valid_roman_numeral(numeral1) && is_valid_roman_numeral(numeral2) && (NULL != result))
{
r... |
C | /*
* DESCRIPTION: Tests standard input to see whether it's capable of seeking
*/
#include <unistd.h>
int main (void)
{
/* check whether stdin is able to seek or not? */
if (lseek(STDIN_FILENO, 0, SEEK_CUR) == -1)
printf("cannot seek\n");
else
printf("seek OK\n");
exit(0);
}
/**********************... |
C | /*
* 1116.c
*
* Created on: Dec 27, 2017
* Author: ashwini.p
*/
#include <stdio.h>
int main(int argc, char **argv) {
double x, y;
int N;
int i;
scanf("%d", &N);
for (i=0; i < N; i++){
scanf("%lf %lf", &x, &y);
if (y==0) printf("divisao impossivel\n");
else printf("%0.1f\n", x/y);
}
}
|
C | /*************************************************************************
> File Name: ls1.c
> Created Time: 2016年12月19日 星期一 12时49分06秒
************************************************************************/
#include<stdio.h>
#include<sys/types.h>
#include<dirent.h>
void do_ls(char*);
int main(int agrc,char **a... |
C | #include <stdio.h>
#include <string.h>
int main()
{
const struct{
char letter,morse[6];
int len;
}morse[30]={
{'A',".-",2},{'B',"-...",4},{'C',"-.-.",4},{'D',"-..",3},{'E',".",1},
{'F',"..-.",4},{'G',"--.",3},{'H',"....",4},{'I',"..",2},{'J',".---",4},
{'K',"-.-",3},{'L',".-..",4},{'M',"--",2},{'N',"-.",2},... |
C | /*
* Copyright 2013, Tan Chee Eng (@tan-ce)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law o... |
C | /*Concatenate two singly linked lists*/
#include <stdio.h>
#include <stdlib.h>
typedef struct Node {
int data;
struct Node *next;
} Node;
void list1(Node *head) {
Node *cur = head;
printf("\nList is : ");
while (cur != NULL) {
printf("%d ", cur->data);
cur = cur->next;
}
... |
C | #include <stdio.h>
/*
int main ()
{
int c;
char value = ((c = getchar()) != EOF);
while (value)
{
printf("%d\n", c);
value = ((c = getchar()) != EOF);
}
printf("\n%d\n", c != EOF);
}
*/
/*
I was having tons of trouble with this very problem.
And also prints "10" if I press Carr... |
C | #include "sort_string.h"
#include "sort_string.h"
int swap(char *input[],int i, int j)
{
char *temp = input[i];
input[i] = input[j];
input[j] = temp;
}
int bubsort(char *input[],int len)
{
int i;
int j;
for(i=0; i<len-1; i++)
for(j=0;j<len-i-1;j++)
if(strcmp(input[j],input[j+1])>0)
swap(input,j,j+1);
}... |
C | #include<stdio.h>
#include<math.h>
int main()
{
int t,i,j,b[15],k;
scanf("%d ",&t);
int a[15];
for(i=0;i<t;i++)
{
scanf("%d ",&a[i]);
}
j=0;
for(j=0;j<t;j++)
{
for(i=1;i<=a[j];i++){
if(a[j]%i==0){
k=0;
b[k]=i;
k++;
}
}
}
... |
C | /*
UDPCLIENT.C
===========
*/
int main(int argc, char *argv[]) {
/* dichiarazione variabili */
/* creazione della socket e relativa bind al SO */
/* trasmissione dati */
rc = sendto(sd, argv[i], strlen(argv[i])+1, 0,
(struct sockaddr *) &remoteServAddr,
sizeof(remoteServAddr));
if(rc<0) {
printf("impossibile trasmetter... |
C | #include <mysql/mysql.h>
#include <Myhead.h>
int queryMaxCode(int uId)
{
MYSQL *conn;
MYSQL_RES *res;
MYSQL_ROW row;
char* server="localhost";
char* user="root";
char* password="123";
char* database="project1";//要访问的数据库名称
char queryadd[50]="select max(code) from file where uId=";
cha... |
C | #include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <assert.h>
//Landon Higinbotham
struct Block {
int occ; // whether block is occupied
int size; // size of block (including header)
struct Block *prev; // pointer to previous block
struct Block *next; // pointer to next block
};
static struct... |
C | //
// Created by Daniel Williams on 2019-06-24.
//
#include <time.h>
clock_t start = clock(), diff;
ProcessIntenseFunction();
diff = clock() - start;
int msec = diff * 1000 / CLOCKS_PER_SEC;
printf("Time taken %d seconds %d milliseconds", msec/1000, msec%1000);
#include <stdio.h>
void ReadFile(){
FILE *cfPtr;... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* fractol.c :+: :+: :+: ... |
C | /* Suppose three numbers x, y, z are passed to a function. Implement this function to
assign the values of y to x, z to y and x to z and return these three changed values
to main. Use pointer. */
#include<stdio.h>
void swap(int*, int*, int*);
int main()
{
// Declare variables
int x,y,z;
printf("Ente... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.