language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/** * @file test002.c * @author Scott Craig and Justin Tanner * @date Mon Oct 29 16:19:32 2007 * * @brief Test 002 - can the RTOS schedule PPP tasks in the correct order * */ #include "common.h" #include "OS/os.h" #include "uart/uart.h" #include "trace/trace.h" enum { A=1, B, C, D, E, F, G }...
C
#include<stdio.h> #define N 101 typedef struct stru { int data; int rest[N]; }ges; int main() { int n,i; ges num[N]; scanf("%d",&n); for(i=0;i<n;i++) scanf("%d",&num[i].data); for(i=0;i<n;i++) { int k=num[i].data,j=0,m=0; while(k!=1&&k) { if(k%2==0) { k=k/2; num[i].rest[j]=k; j++; f...
C
#include <stdio.h> #include <string.h> char *change(char *string); int main() { char string[] = "Hola-Mundo"; printf("%s\n", change(string)); return 0; } char *change(char *string) { int count; for (count = 0; count < strlen(string); ++count) { if (string[count] == '-') string[count] = '_'; } return ...
C
#include <stdlib.h> #include <stdio.h> #include <math.h> #include <time.h> void rellenarConjunto(char conj[7], char u[20]); void imprimirConjunto(char conj[], int c, char name[]); void ordenarConjunto(char conj[], int len); int main(){ srand(time(NULL)); char univ[20]; char conj1[7]; char conj2[7]; char conj3[7]...
C
// // Created by huyangh on 2020/6/2. //编写一个程序读取输入,读到#字符停止,然后报告读取的空格数、 //换行符数和所有其他字符的数量。 #include <stdio.h> #include <ctype.h> void practice1(){ char ch; int n_ch, n_space, n_enter; n_ch = n_space = n_enter = 0; puts("Please input some text, # to end:\n"); while ((ch = getchar()) != '#'){ n_...
C
#include<stdio.h> main() { int marks,mm; //use mm for maximum maxrks printf("enter maximum marks:"); scanf("%d",&mm); printf("\nEnter your marks obtained :"); scanf("%d", &marks); //update marks by conerting maximum maxrks in 100 ie-finding percent marks=marks*100/mm; if(marks>100) { printf("in...
C
#include<stdio.h> #include<string.h> int main() { int n,i,len; char s[100]; while(scanf("%d",&n)!=EOF) { getchar(); while(n--) gets(s); len = strlen(s); for(i = 0;i < len;i++) { s[0] = s[0] - 32; if(s[i] = ' ') s[i + 1]-=32; printf("%c1",s[i]); } printf("\n"); } return 0; }
C
#include "holberton.h" #include <ctype.h> /** * _islower - check if the parameter is lower * * @c: parameter to check * * Return: Always 0 (Success) */ int _islower(int c) { if (c >= 'a' && c <= 'z') return (1); else return (0); }
C
#include <stdio.h> #include <stdlib.h> #define SIZE 80 //The size of the array enum ExpType { OPT, OPERAND }; typedef struct _listnode { int item; enum ExpType type; struct _listnode *next; } ListNode; typedef struct _linkedlist { int size; ListNode *head; } LinkedList; void insertNode(...
C
#include <stdio.h> #include <string.h> #include <math.h> int ft_iterative_factorial(int nb); void ft_test_with_input(int nb) { int exp; int res; exp = tgamma(nb + 1); res = ft_iterative_factorial(nb); printf("------------\n"); printf("Given: %d\nExpected: %d\nResult: %d\n", nb, exp, res); if (exp == res) pr...
C
#include <stdio.h> #include <string.h> int main(void){ char s[120]; int count=0; scanf("%s",s); for (int i=0; i<strlen(s); i++){ if (count==0){ if (s[i]=='I' || s[i]=='i'){ count=1; } } else if (count==1){ if (s[i]=='C' || s...
C
/*************************************************************************** MRQFIT_GAUSS: This is the fgauss algorithm taken from Numercial Recipes. Here's what NR has to say about it: "y(x,a)is the sum of na/3 Gaussians (15.5.16). The amplitude, center, and width of the Gaussians are stored in consecutive locations...
C
#include "jogging.h" int saved_route_update(int user_id, int route_id, char route_file[]) { MYSQL *conn = NULL; char sql_str[511]; char *sql_serv = "localhost"; char *user = "root"; char *passwd = "mariadb"; char *db_name = "jogging"; memset( &sql_str[0] , 0x00 , sizeof(sql_...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define MIN(a,b) ( ((a)<(b))? (a):(b) ) #define MAX(a,b) ( ((a)>(b))? (a):(b) ) #define SIZE 101 typedef struct {int x, y;}Ponto; int total; int N, M; Ponto pp[SIZE]; Ponto pb[SIZE]; int R[SIZE]; int U[SIZE]; Ponto aux[3]; void OrdenaPontosPorx(Ponto *pol, ...
C
/* ** my_show_wordtab.c for my_show_wordtab in /home/clemsx/delivery/CPool_Day08/task03 ** ** Made by clement xia ** Login <clemsx@epitech.net> ** ** Started on Wed Oct 12 15:44:29 2016 clement xia ** Last update Wed Oct 12 17:01:30 2016 clement xia */ int my_show_wordtab(char **tab) { int i; int j; i = ...
C
#include "../include/chip8.h" #include <SDL2/SDL.h> #include <stdbool.h> #define SCREEN_WIDTH 640 #define SCREEN_HEIGHT 320 // Keymap unsigned char keys[4*4] = { '1','2','3','4', 'q','w','e','r', 'a','s','d','f', 'z','x','c','v' }; typedef struct { SDL_Window *window; SDL_Renderer *renderer; } GFX; GFX ...
C
#include <stdio.h> struct PopuState { char name[5]; int population; }; int main() { struct PopuState sample[10]; int i = 0; int j; //printf("Please input state abbreviations and the population:\n"); while (scanf("%s %d", sample[i].name,&sample[i].population) != EOF){ //scanf("...
C
// Pointer to a function #include <stdio.h> // Here call function is given two arguments, first is a pointer to a function and second is integer int call(int (*func)(int) , int arg); int inc(int var); int main() { int c; // Here while calling we are passing address of inc() function to function pointer c=call(inc...
C
volatile inline int goodtrap() { while(1); return 0; } volatile inline int badtrap() { while(1); return 0; } int main() { int a = 9; int b = 10; int c = 90; if(c != a*b) { return badtrap(); } a = 81; b = 1; c = 81; if(c != a*b) { return badtrap(); ...
C
#include<stdio.h> #include<stdlib.h> struct node { int info; struct node *link; }; int count=0; struct node *START=NULL; struct node *createnode(); void insertnode(); void deletenode(); void view(); void insertatfirst(); void deleteatlast(); int menu(); int getlength(); struct node *createn...
C
#include <stdio.h> #include <stdlib.h> #include <errno.h> #include <pthread.h> #include <string.h> #include <semaphore.h> sem_t sem; pthread_mutex_t mutex; int nr_processes; void barrier_point() { // Cate procese au vizitat deja bariera. static int visited = 0; // Blochez mutexul, ca sa pot sa ma joc cu ...
C
#include <stdio.h> #include "struct.h" extern Area area[]; extern Sex sex[]; extern Student student[]; extern Student* nowStudent[]; extern int nowStudentNum; extern int studentNum; /* Ц ׼ */ void preparing(){ welcome(); readC("C_Info.txt", area); readS("S_Info.txt", sex); readStu("Stu_Info.txt", student); ...
C
///@file mlcore.h #ifndef __IMLAB_MLCORE_H__ #define __IMLAB_MLCORE_H__ // Include C99 libraries #include <omp.h> #include <math.h> // Include IMLAB general headers #include "core.h" #include "prcore.h" /* Define Machine Learning Functions and Useful Structures */ // maximum number of the class in multi class classif...
C
#include <stdio.h> #include <stdlib.h> typedef struct arvgeral { int info; struct arvgeral *filho; struct arvgeral *irmao; }ArvGeral; ArvGeral* Ler(FILE *fp){ char c; int raiz; ArvGeral *no; fscanf(fp, "%c", &c); fscanf(fp, "%d", &raiz); if(raiz==-1){ no = NULL; ...
C
/******************************************** * * \author <b>Programmer:<\b> Valerie Gray * \author <b>Assisted By:<\b> * * \brief <b>Purpose:</b> This is header file * less then but not zero function function. * * As it is used by all the macros that * will be a part of Valerian Root this is *...
C
/* Ejercicio 26 Autor: Juana Sucasaire Fiestas Curso: Fundamentos de Informatica Escriba un programa que permita introducir por teclado, el importe de un depsito bancario que se desea realizar, y que muestre por pantalla, cuanto obtendra en caso de depositar por 3 meses (3% mensual) 6 meses (3...
C
#ifndef lint static char *sccsid = "@(#)word.c 1.3 1/22/92 16:12:04 [1/26/92] (c)IBM Corp. 1992"; #endif /* * This class is adapted from the book * Class Construction in C and C++, Object Oriented Fundamentals * by Roger Sessions, Copyright (c) 1992 Prentice Hall. * Reprinted with permission. */ #define word...
C
#include<stdio.h> int main() { int n; printf("enter the value"); scanf("%d",&n); if(n>0) { printf("the number is positive \n%d",n); } else if(n<0) { printf("the number is negative\n %d",n); } else printf("the number is zero \n %d",n); }
C
//ū 1924 => 94 #include<stdio.h> int main() { int input,temp; int a[4]; int i,j,result; printf("4ڸ ڸ ԷϽÿ \n"); scanf("%d", &input); if (input >= 1000 && input <= 9999) { a[0] = input / 1000; input %= 1000; a[1] = input / 100; input %= 100; a[2] = input / 10; a[3] = input % 10; for (i = 0; i < 4;...
C
#include <stdint.h> #include <string.h> #include "aes.h" void putc(unsigned char c) { while((*(volatile char *)0x20000080) == 0) {} *(volatile char*)0x20000000 = c; } unsigned char getc() { return *(volatile char*)0x20000000; } void get_message(uint8_t * dst) { int i; for (i = 0; i < 17; i++...
C
#define DELIM " \t\n\r\a" #define SIZE 10 char **parse(char *line){ int bufferSize = SIZE; char **commands = (char**)malloc(sizeof(char*) * bufferSize); char *command; int position = 0; if(!commands){ printf("ERROR_ALLOCATING_SPACE\n"); exit(1); } command = strtok(line,DELIM); while(command!=NULL){ comman...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> #include <unistd.h> #include <arpa/inet.h> #include "QueryProtocol.h" char *port_string = "1500"; char *ip = "127.0.0.1"; const char* client = "[Client]"; #define BUFFER_SIZE 1000 struct addr...
C
/* 1087: [기초-종합] 여기까지! 이제 그만~ - 문제: 1, 2, 3 ... 을 순서대로 계속 더해나갈 때, 그 합이 입력한 정수보다 작을 동안만 계속 더하는 프로그램을 작성해보자. 즉, 1부터 n까지 정수를 계속 더한다고 할 때, 어디까지 더해야 입력한 수보다 같거나 커지는지 알아보고자 하는 문제이다. 하지만, 이번에는 그 때의 합을 출력해야 한다. 예를 들어 57을 입력하면 1+2+3+...+8+9+10=55에 다시 11을 더해 66이 될 때, ...
C
#include <linux/module.h> #include <linux/kernel.h> #include <linux/proc_fs.h> int procfile_read(char *buffer ,char **buffer_location ,off_t offset,int buffer_length ,int *eof ,void *data) { int len = 0; static int count = 1; printk(KERN_INFO "inside /proc/test1 :procfile_read.\n"); // if(offset > 0){ // printk(K...
C
// // Created by Таня Куликова on 26.09.2021. // #ifndef COMPUTER_SYSTEM_ARCHITECTURE_HW1_CONTAINER_H #define COMPUTER_SYSTEM_ARCHITECTURE_HW1_CONTAINER_H #ifndef __container__ #define __container__ //------------------------------------------------------------------------------ // container.h - contains the special...
C
#include <stdio.h> #include <stdlib.h> #include <argp.h> #include <arpa/inet.h> #include <linux/types.h> #include <string.h> #include <sys/types.h> #include "appflid/comm/types.h" #include "appflid/usr/nl_ucmd.h" const char *argp_program_version = "APPFLID userspace app 0.1"; const char *argp_program_bug_address = "...
C
#include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "mqtt_client.h" #include "data_logger.h" #include "wifi.h" #define MQTT_BROCKER CONFIG_ESP_MQTT_BROKER #define MQTT_USER CONFIG_ESP_MQTT_USER #define MQTT_PASSWORD CONFIG_ESP_MQTT_PASSWORD #define MQTT_MAX_CONNECTION_ATTEMPTS 10 sta...
C
#include "holberton.h" #include <stdlib.h> /** * _calloc - _calloc. *@nmemb: unsigned int to check. *@size: unsigned int to check. * Return: a Or NULL. */ void *_calloc(unsigned int nmemb, unsigned int size) { char *a; unsigned int i = 0; unsigned int j = 0; j = nmemb * size; if (nmemb == 0) return (NULL); if (siz...
C
#include <stdio.h> #include <stdlib.h> #include <openssl/md5.h> #include <string.h> #include <time.h> char * getString(char* input) // number of str { char simbols[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; for(int i = strlen(input); i > -1; i-- ) { if(input[i] == simbols[strlen(simbol...
C
/* bst.c * Judson Cooper * MP5 * * Purpose: This file contains the functions for creation and management * of a binary search tree. * * Assumptions: The binary search tree will be built with a linked * implementation using pointers. They will be stored based on a key * with type bst_key_t. * ...
C
#include "symbol.h" #define TAILLE 100 //initialise symbol table symbol *symbolTable[TAILLE] ; int position = -1; int Tmp = 256; symbol *New_Symbol(char *name, bool isConstant, bool isInitialised, enum types type) { if (position != -1) //if symbolTable is not empty { for (int i = 0; i < position; i++) ...
C
/*---------------------------------------------------------------------------------------------------------*/ /* */ /* Copyright (c) Nuvoton Technology Corp. All rights reserved. ...
C
#include <sys/ptrace.h> #include <stdio.h> #include <stdlib.h> #include <sys/wait.h> int main(){ long res = 0; int pid = 13723; void * addr = 0xbffff988; //on s'attache au processus NULL et 0 sont ignores if ((res = ptrace(PTRACE_ATTACH, pid, 0, 0)) < 0) { perror("ptrace"); return 0; } wait4(...
C
/*Call mergesort(integer array,start position,end position); note - end position should be n-1!*/ void merge(int *arr,int s,int mid,int e); void mergesort(int *arr,int s,int e){ if(s==e) return; int mid=(s+e)/2; mergesort(arr,s,mid); mergesort(arr,mid+1,e); merge(arr,s,mid,e); } void merge(int *arr,int s,int ...
C
#include <I2C.h> #include <Wire.h> #include "I2Cdev.h" #include "MPU6050.h" #define MPU9250_NUM_READINGS_PER_AVG 3 MPU6050 imu; // mpu9250 object // global telemetry container declared in main file extern telemPacket_t telem; // initialize imu void mpu9250Init(){ Wire.begin(); imu.initialize(); // TODO: return ...
C
#include <stdio.h> int main(int argc, char *argv[]) { int i; printf("%c\n",argv[1][1]); printf("%c\n",**++argv); for(i = 0; i < argc; i++) printf("%s\t", argv[i]); printf("\n"); return 0; }
C
//sprintf overflows #include <stdio.h> #include <string.h> #include <stdlib.h> int main(int argc, char *argv[]) { char buf1[10]; char buf2[100]; char buf3[300]; char buf4[3]; if (argc < 5) { printf("More args!\n\n"); return -1; } ...
C
#include <stdio.h> #include <stdlib.h> void geheimnis() { printf("Kannst du etwas geheim halten? :)\n"); exit(0); } void prompt() { float garbage = 0.56; float mull = 5.50006; char buf[2001]; int b = 9; int a = b + 8; gets(buf); printf("You entered: %s\n", buf); } void pikachu() { printf("Pika!!!!\n"); e...
C
#include<stdlib.h> #include<stdio.h> #include<string.h> #include "answer10.h" typedef struct Review_t{ long file_offset; int Business_ID; } Review; typedef struct Bus_Location_t{ int Business_ID; char* address, *state, *city, *zip; struct Bus_Location * next; } Bus_Location; typedef struct Bus_Tr...
C
/* * Stepper motor module description * * This module contains the code to run up to 8 stepper motors simultaneously * with different types of motion control. All 8 channels are treated * individually. Each channel can * have a maximum and minimum step rate, and an acceleration value, so that * normal tra...
C
#include <stdio.h> int is_palindrome(int x); int main() { int a = 999; int b = 999; int flag = 0; int bit = 0; int palindrome = 0; while(a > 0) { a--; b = 999; while(flag == 0) { b--; flag = is_palindrome(a*b); } if(a*b > palindrome) palindrome = a*b; flag = 0; } printf("result = %d\n"...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> int main() { printf("Podaj swoj kod podczotwy\n"); char code[] = "44-100"; scanf("%s",code); puts(code); if (isdigit(code[2])) { printf("Zly format"); system("exit"); } char * pch; pch=str...
C
#include<stdio.h> #include<conio.h> #define NULL 0 struct node1 { char data; struct node1*link; struct node1*cors; }; struct node2 { struct node2*link; struct node2*cors; } void main() { struct node1 *s; char data; void insertion(struct node1**); void display(struct node1*); s=NULL; printf("Enter the nodes")...
C
#include "libFireBird.h" #include "FBLib_compression.h" // UncompressFirmware() is a function wrapper that decodes data blocks // encoded with AR002 algorithm until the uncompressed size field // is set to 0xfefe. This is normaly used for the Loader or the Firmware // inside of the ...
C
#include <stdlib.h> #include <unistd.h> #include <stdio.h> #include <limits.h> #include <string.h> #include <errno.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/ioctl.h> #include <net/ethernet.h> #include <linux/if_packet.h> #include <linux/if.h> #include "cmds.h" #include "socket.h" int main(void)...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <math.h> #include <GL/glut.h> #include "EstruturasDeDados.h" #include "winGL.h" #include "arvore.h" unsigned char* image = NULL; // image file int iHeight, iWidth, currentWidth = 0, currentHeight = 0, auxPoint...
C
/* * Chapter 9. * ǽ 2. ܺ ǽ(main.c) */ #include <stdio.h> extern void print_option(); extern const int OPTION1; extern const int OPTION2; extern void add_option(int); extern void remove_option(int); int select_menu(); int main() { int choice; while ((choice = select_menu()) != 5) { switch (choice) { case 1: a...
C
/*######################################################################## # MILESTONE : 4A # PROGRAM : 1 # PROJECT : MyFirstProject # GROUP : 5 # NAME 1 : Benjamin, Duong, V00839087 # NAME 2 : Owen, Anderberg, Student ID # DESC : This program tests the functionality of the Stepper motor and the PWM output # DA...
C
/* SPDX-License-Identifier: BSD-3-Clause */ #include <stdio.h> #include <stdlib.h> #include "tools/fapi/tss2_template.h" /* needed by tpm2_util and tpm2_option functions */ bool output_enabled = false; /* Context struct used to store passed command line parameters */ static struct cxt { char *path; char *imp...
C
#include <stdio.h> #include <stdlib.h> int main(){ FILE *pf; pf = fopen("archivo.csv","w"); if(pf!=NULL){ printf("\nEl archivo se creo correctamente"); printf("\nHolaaaaaaaa Mundoooooo") exit(3); } puts(...
C
#include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <string.h> #include <sys/types.h> #include <sys/wait.h> int main() { char *stringuri[1024]; char *stringuri1[1024]; char *stringuri2[1024]; char *stringuri3[1024]; char *string=NULL; size_t len; ssize_t n; while((n=get...
C
/** * @file utils.h * @author Patrick Flick <patrick.flick@gmail.com> * @brief Implements common utility/helper functions. * * Copyright (c) 2014 Georgia Institute of Technology. All Rights Reserved. */ /********************************************************************* * You can add new fu...
C
#include "unity.h" #include "rbt.h" void test_rbt_new(void) { t_rbt *rbt = rbt_new(g_type_int, g_type_str); TEST_ASSERT(rbt_size(rbt) == 0); TEST_ASSERT(rbt_height(rbt) == 0); rbt_delete(rbt); } void test_rbt_put_get(void) { t_rbt *rbt = rbt_new(g_type_int, g_type_str); rbt_put(rbt, int2ptr(10), "Hello"); rbt_...
C
#include <stdio.h> #include <stdlib.h> int main(int argc, char *argv[]) { FILE *fp; unsigned long length = 0; if(argc != 2){ printf("usage: %s <filename>\n", argv[0]); exit(1); } if((fp = fopen(argv[1], "r")) == NULL){ puts("ファイルが開ません。\n"); exit(1); } while(!feof(fp)){ fgetc(fp); if(ferror(fp)){ ...
C
#pragma once uint8_t Red(uint32_t color) { return (color >> 16) & 0xFF; } uint8_t Green(uint32_t color) { return (color >> 8) & 0xFF; } uint8_t Blue(uint32_t color) { return color & 0xFF; } uint32_t Color(byte r, byte g, byte b) { return ((uint32_t)r << 16) | ((uint32_t)g << 8) | b; } // Input a v...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #define VECTOR_LENGTH 5 float norm(float* vec, int len) { int i; float result = 0; for (i=0; i<len; i++) { result += (*vec)*(*vec); vec++; } return result; } int main(int argc, char** argv) { int i; float x[VECTOR_LENGTH]; float r...
C
#include <stdio.h> void add_four_floats(float[], float[]); int main() { float x[] = {-29.750, 244.333, 887.29, 48.1E22}; float y[] = {29.750, 199.333, -8.29, 22.1E23}; add_four_floats(x, y); printf("%f\n%f\n%f\n%f\n", x[0], x[1], x[2], x[3]); return 0; }
C
#include <stdio.h> void testing(void); void testing2(void); int main () { int i, number1, number2; double sum; typedef struct student_info { int ssn; char name[10]; double GPA; } student_info; testing(); FILE *input, *output; input = fopen("input.dat", "r"); output = fopen("output.dat", "w...
C
/* * YAFFS: Yet another FFS. A NAND-flash specific file system. * * Copyright (C) 2002-2018 Aleph One Ltd. * * Created by Timothy Manning <timothy@yaffs.net> * * 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 ...
C
/* ** foncs_divers.c for fonc_divers in /home/doghri_f/rendu/PSU_2014_zappy/Server/Sources/Divers ** ** Made by Fares Doghri ** Login <doghri_f@epitech.net> ** ** Started on Sun Jul 5 23:27:57 2015 Fares Doghri ** Last update Sun Jul 5 23:27:58 2015 Fares Doghri */ #include "server.h" char *my_strcat(char *des...
C
//Autores: Programa realizado por el Equipo2_CodePain //Version 1.2 //Este programa recibe dos numeros y nos dice cual es mayor, menor o si ambos son iguales. #include <stdio.h> int main () { //Entrada: Declaración de variables y lectura de dos numeros int a = 0, b = 0; scanf("%d %d",&a,&b); //P...
C
#include <stdio.h> #include "iosnd.h" int outputSound(sound *s, FILE *f){ if(f == NULL){ return 1; } for(int i=0; i<s->length; i++){ fprintf(f, "%f\n", s->samples[i]); } return 0; }
C
/* ** EPITECH PROJECT, 2022 ** CPE_matchstick_2017 ** File description: ** Created by tiflo, */ #include "my.h" void print_line(int a, int y, int space, my_map_t *map) { int x = 1; my_putchar('*'); while (space-- >= 0) my_putchar(' '); while (x++ <= y) my_putchar('|'); space = map->my_max_stick / 2 - a / 2 +...
C
/* Descrio: E uma funo que retorne a somatria de todos os nmeros mltiplos de 3 e 5, mas que no so mltiplos de 2, entre 1 e 1000. Autor: Maxwell Alves Teixeira Data:27/01/2015 */ #include <stdio.h> int multctnd(int i, int d, float t, float c){ float s; int p; for(i = 1; i <= 1000;i++){ if((i % 2) != 0){ ...
C
#include<stdio.h> int arr[10005]; int main() { int t,i; scanf("%d",&t); while(t--) { int n,temp; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&temp); arr[temp]+=1; } int min=arr[0]; int index=0; for(i=1;i<10005;i++) ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "synth.h" #define MT_IMPLEMENT #include "mt.h" /* fmt: convert floats on stdin to their final format */ /* types of dither: none, rectangular, triangular */ enum { DI_NONE, DI_RECT, DI_TRI }; static void conv(int bits, int sign, int dithertype, int ...
C
/** * Simple command line interface for use in embedded systems * Author: Izidor Makuc * Created: 3.09.2016 * * License: Public Domain (see UNLICENSE file or http://unlicense.org/) * Usage: See README file **/ #include <stdio.h> #include <stdint.h> #include <stdbool.h> #include <string.h> #include "trivi...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_SIZE 100 /* 栈:一种符合栈操作特点结构 栈操作特点:先进后出(FILO) 栈分为: 1.顺序栈(按照栈操作规则操作一个数组) 2.链表栈(按照栈操作规则操作一个链表) 栈中其实只有一个指针,指向栈顶的节点 */ //定义栈节点 typedef struct node { int data; struct node * next; }node; //定义栈 typedef struct stack { node * top; int size;...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> char * getHint(char * secret, char * guess){ int len = strlen(secret); int* mark = malloc(sizeof(int)*len); int* use = malloc(sizeof(int)*len); for(int i=0; i<len; i++){ if(secret[i]==guess[i]){ mark[i]=1; use[i]=1; } else { mark[...
C
#include <stdio.h> #include <stdlib.h> void BubbleSort(int arr[], int size){ int i, j, k, t; for (i = 0; i < size - 1; i++){ printf("\n%d\n", i); for (j = 0; j < size - 1; j++){ if (arr[j]>arr[j + 1]){ t = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = t; } printf("У"); for (k = 0; k < size; k...
C
#include<stdio.h> int main(void){ int a[5];//5件のデータを入力 int *p;//ポインタ型変数 int sum=0; int i; p=a; for(i=0;i<5;i++){ scanf("%d",p+i); sum+=*(p+i); //デバッグ用 //printf("%d\n",*(p+i)); } printf("%d",sum/i); } /* norim@LAPTOP-9SQTGP4H MINGW64 ~/Desktop/ノートフォルダ/試験対策/...
C
/* Runtime for C-engine (RTC). Implementation. (Semantic values, and ASTs) * - - -- --- ----- -------- ------------- --------------------- * (c) 2017 Andreas Kupries * * Requirements - Note, assertions, allocations and tracing via an external environment header. */ #include <environment.h> #include <sem_int.h> T...
C
#include <stdio.h> #include "circle_queue.h" void init_queue(circle_queue *queue) { if (!queue) { printf("Invalid parameter\n"); return; } queue->front = 0; queue->rear = 0; return; } void enqueue(circle_queue *queue, int elem) { if (!queue) { printf("Invalid p...
C
#include<stdio.h> #include<stdlib.h> typedef int datatype; typedef enum{Failure,Success}statuscode; typedef struct NodeTag { datatype data; struct NodeTag* next; }Node; int main() { Node* one; one->data=1; Node* two; two->data=4; one->next=two; Node* three; three->data=0; two...
C
/**@file octal.h @brief octal functions */ #ifndef octal_h #define octal_h /** Does not output any leading 0 like C wants for numeric literals (but not for string escapes). @param buf4 should be ab uffer of at least 4 bytes, will be null terminated @param octet the byte to convert into octal digits @return...
C
/* C_UPDI file.c Author: Jonty www.tyjean.com https://github.com/jarl93rsa (2020) Provide os-specific file functions open/close read/write etc for updi.c, using a common struct File. Porting C_UPDI to a new platform will require re-writing these functions */ #include <stdio.h> #include <stdbool.h> ...
C
#include <stdio.h> int main() { int marks[100][100]; int sum=0; float avg=0; int count1=0; int count2=0; int X; int stu=0; float sub=0; //Getting the number of subjects and students printf("Enter the number of students:"); scanf("%d",&stu); printf("Enter the number o...
C
#include <stdio.h> void main (int argc,char *argv[]) { int i1=-1; int i2=4294967295; int i3=-2147483648; printf("Value passed : d\n"); printf("the value of i1 is : %d\n",i1); printf("the value of i2 is : %d\n",i2); printf("the value of i3 is : %d\n\n",i3); printf("Value passed : x\n"...
C
//안녕 자비스 아까 너무 말을 많이해서 힘들다. 조금 간략하게 진행해 볼게. //#include할거야 표준입출력을 가능하게 해주는 헤더파일을 #include <stdio.h> //main함수 안에 내가 하고싶은 말을 구현해볼게 int main(void) { float m2_area; float pyung_area; //너가 구현해야할 논리의 핵심을 정리해 줄게. //input = float형 m2_area ->아파트 분양 면적(m2단위), //output = float형 pyung_area ->아파트 분양 면적(평형단위) printf("...
C
#include<stdio.h> int main(){ int a ,b,c; printf("Enter the 1st num\n"); scanf("%d" ,&a); printf("Enter the 2nd num\n"); scanf("%d" ,&b); printf("Enter the 3rd num\n"); scanf("%d" ,&c); if(a<b){ if(a<c){ printf("a=%d" ,a); } else{ printf...
C
#include<stdio.h> int main() { int bsize,psize,min,mdex; printf("\nEnter number of blocks and processes\n"); scanf("%d",&bsize); scanf("%d",&psize); int b[bsize],p[psize],alloc[bsize]; printf("\nEnter block sizes\n"); for(int i=0;i<bsize;i++) { scanf("%d",&b[i]); alloc[i] = -1; } printf("\nEnter process s...
C
#include <stdlib.h> #include <string.h> #include <stdio.h> typedef struct node { int id; struct node *left; struct node *right; } treenode; main (argc, argv, envp) int argc; char **argv, **envp; { treenode *a, *b, *c, *d, *z; z = malloc(sizeof(treenode)); z->id = 'z'; z->left = 0; z->right= 0; d = mallo...
C
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. #include <stdlib.h> #include "azure_c_shared_utility/gballoc.h" #include "multitree.h" #include <string.h> #include "azure_c_shared_utility/crt_abstractions.h" #includ...
C
/* The <limits.h> header defines some basic sizes, both of the language types * (e.g., the number of bits in an integer), and of the operating system (e.g. * the number of characters in a file name. */ #ifndef _LIMITS_H #define _LIMITS_H /* Definitions about chars (8 bits in MINIX, and signed). */ #define CHAR_BI...
C
#include<stdio.h> int main() { int n,i,j,num[100][2],a=0; scanf("%d",&n); for(i=0;i<n;i++) { for(j=0;j<2;j++) { scanf("%d",&num[i][j]); } } for(i=0;i<n;i++) { if(num[i][0]+2<=num[i][1]) { a++; } } printf("%d...
C
#include <errno.h> #include <arpa/inet.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <poll.h> #define SERVER "127.0.0.1" #define BUFLEN (512) #define PORT (8888) #define DATA_COUTN (1) int running = 1; void errorLogExit(const char* const s, const int s...
C
#include <msp430.h> /* * Created By: Travis Schriner * Date: 14 November 2013 * Description: This main.c file is to move a robot * utilizing a DC motor with an MSP430 microcontroller * */ #include "MovingRobot.h" int main(void) { WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer initializePins(); ...
C
#ifndef __ERROR_CODE_H #define __ERROR_CODE_H 1 /** * @brief 错误码定义 * */ enum error_code { ERRCODE_NONE = 0, /**< 成功,无错误 */ ERRCODE_UNKNOWN = -1, /**< 未知错误 */ ERRCODE_SYSTEM = -2, /**< 系统错误 */ ERRCODE_MEMORY = -3, /**< 内存不足 */ ...
C
/* LiquidCrystal Library - use a 16x2 LCD display. The LiquidCrystal library works with all LCD displays that are compatible with the Hitachi HD44780 driver. There are many of them out there, and you can usually tell them by the 16-pin interface. The circuit: * LCD RS pin to digital pin 7 * LCD Enable p...
C
#include <stdio.h> #include <rtai.h> #include <rtai_shm.h> #include <rtai_nam2num.h> #include <sys/msg.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <string.h> #include <sys/types.h> #include <time.h> int *mem; /* Struct f...