language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
/* 车轮子练习 */ #include <stdio.h> int main(){ int num = 0, num1 = 0; for(num = 0;num <= 7;num++){ for(num1 = 0;num1 <= (28 - 4 * num)/3;num1++){ if(28 == (4 * num + 3 * num1 + 2 * (10 - num - num1))){ printf("汽车有%d辆,三轮车有%d辆,自行车有%d辆\n", num, num1, 10 - num - num1); } } } return ...
C
bool recur(char **board, int row, int col, int x, int y, char* word) { bool res; if(*word == '\0') { return true; } if(x < 0 || x >= row || y < 0 || y >= col || *word != board[x][y]) { return false; } board[x][y] = '\0'; res = recur(board,row,col,x -1,y,word + 1) || ...
C
//cleint_main.c #define _CLIENT_H_ #include "suckittalk.h" void theEndOfTheCli(int sig) { if(sig == SIGINT) { my_str("\nEnd of ze Client\n"); exit(1); } } int main(int argc, char** argv) { int sockfd; int n; int port_num; char buffer[BUFFSIZE]; char* nname; struct sockaddr_in server_adderess; str...
C
/* Simple GFX (graphics) library based on SDL library Author: Fabrício Sérgio de Paula (fabricio.paula@gmail.com) Year: 2013 Use: Before using this library you must install the SDL_gfx and SDL_ttf libraries. After that, make sure all gfx library files are at the YOUR-PROGRAM-DIR/gfx directory. Then, your program mu...
C
#include "SearchCase.h" #include <stdio.h> #include <stdlib.h> #include <time.h> #include "Search/Search.h" #include "SortAlgorithm/SortAlgorithm.h" #define SIZE 50 void SearchCase() { int a[SIZE] = {0}; int index = -1; int i; int key; srand((unsigned int)time(NULL)); for (i=0; i<SIZE; i++)...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_treatment.c :+: :+: :+: ...
C
/* * File: console.c * * * Writing on the console device. */ // Esse console é full screen e não precisa de muitos recursos gráficos. // Somete o super user poderá usá-lo. // Só existem quatro consoles virtuais. Um deles será usado para // registrar o servidor gráfico. // Para pseudo terminais veja: vt.c ...
C
/* File: array.c Developer: Delenn Sapp Date: October 22, 2016 Dynamically allocated array */ #include <stdlib.h> #include <stdio.h> #include "array.h" #include "../scanner/scanner.h" #define DEFAULT_SIZE 8 struct array { void **array; int size; int currentIndex; }; Array *newArray() { Array *a = ...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> //Pending global variables #define _GNU_SOURCE //Memory is in Integer format and Opcode is in String format //Total CPU registers=8 #define REG_NUM 8 int Register_array[REG_NUM]; //DEfining memory size #define MEM_SIZE 1024 int memory_arr...
C
#include "elecanisms.h" int16_t main(void) { init_elecanisms(); uint16_t OCRvalue; uint8_t *RPOR, *RPINR; T1CON = 0x0030; // set Timer1 period to 0.5s PR1 = 0x1869; TMR1 = 0; // set Timer1 count to 0 IFS0bits.T1IF = 0; // lower Timer1 interrupt flag T1CONbit...
C
#include<stdio.h> int main() { int a[5]={1,2,3,4,5}; int i,j,max,temp; for(i=4;i>=0;i--) { max=i; for(j=i-1;j>=0;j--) { if(a[j]<a[max]) max=j; } temp=a[i]; a[i]=a[max]; a[max]=temp; } for(i=0;i<5;i++) printf("%d\n",a[i]); return 0; }
C
#include <stdlib.h> #include <time.h> #include <stdio.h> #include <ctype.h> /** * main - Determine if the last digit of a random number is * greater than or less than 5, or is zero.. (* * Return: 0 on success */ int main(void) { char i = 'a'; char j = 'z'; while (i <= j) { putchar(i); i++; } i = 'a'; j = 'z'; while (...
C
/* * Node.h * * Created on: 22-Jun-2020 * Author: naren */ #ifndef SRC_NODE_H_ #define SRC_NODE_H_ #include<string> struct Node{ int data; Node *next; /** * @param data of current node * @param link of next node */ Node(int data, Node *next){ this->data = data; this->next = next; } /** *...
C
#include <stdio.h> #include <stdlib.h> #include "doublylinked_list.h" int main(void) { Cell *head = CreateCell(0, true); Cell *elem; InsertNext(head, CreateCell(2, false)); InsertNext(head, CreateCell(1, false)); InsertPrev(head, CreateCell(5, false)); Display(head); elem = SearchCell(head, 2); Inser...
C
#include <stdio.h> #define MAXN 1000005 int a[MAXN]; int k, n, d; main() { scanf("%d", &k); while (scanf("%d", &d), d >= 0) { a[n++] = d; } k > n ? printf("NULL\n") : printf("%d\n", a[n - k]); return 0; }
C
#include <stdio.h> #include <sgtty.h> #include <ctype.h> #include "boolean.h" #include "termcap.h" #define NIL 0 /* Null pointer */ #define DIRSIZE 16 /* Terminal Directory Size */ #define NUMCAP 30 /* Number of capabilities */ #define DATABYTES 4 /* Number of bytes before pointers */ #define ...
C
#pragma once /** ************************************************************************************* * Dossier 1 : Analyse de donnees clients * ====================================== * * Group table functions prototypes * * PP 2020-2021 - Laura Binacchi - Fedora 32 *********************************************...
C
#include "function_list.h" libab_result libab_function_list_init(libab_function_list* list) { return libab_ref_vec_init(&list->functions); } libab_result libab_function_list_insert(libab_function_list* list, libab_ref* function) { return libab_ref_vec_insert(&list->func...
C
#include <stdio.h> int x; #define CZYT(a, d) printf("Podaj wartosc "#a":"); scanf("%"#d"", &a); int main() { x=0; CZYT(x, d) printf("%d\n", x); return 0; }
C
// first OpenVG program // Anthony Starks (ajstarks@gmail.com) #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "VG/openvg.h" #include "VG/vgu.h" #include "fontinfo.h" #include "shapes.h" int main() { int width, height; char s[3]; init(&width, &height); // Graphics initialization Start(w...
C
#include <stdio.h> int main() { // int ch = 'A'; // int count = 3; // // while (count) // { // ch += count; // count -= 1; // putchar(ch); // } // // putchar('\n'); char* std1; char i; printf("Input a line of english sentence:"); while (( i = getchar())...
C
#include <stdio.h> int main() { int i=0,n=6,Pos=0,Zero=0,Negg=0; short Start[]={0x7602, 0x8D48, 0x2120, 0, 0xE605, 4}; for(i;i<n;i++) { if(Start[i]==0) { Zero++;} else if(Start[i]<0) {Negg++;} else if(Start[i]>0) {Pos++;} } printf("Pos=%d Zero=%d Negg=%d\n",Pos,Zero,Negg); return 0;...
C
/* 예제 HelloWorld.c를 참고하여, 각자의 이름, 주소, 전화번호를 출력하는 간단한 프로그램을 작성해보자. 작성하면서 코드에 주석도 사용하도록 하자. 출력 결과의 예는 다음과 같다. 출력 예) 이창현 경기도 수원시 영통구 매탄동 010-4477-XXXX */ #include <stdio.h> int main(void) { printf("최현준\n"); printf("경기도 성남시 분당구 판교동\n"); printf("010-9298-XXXX"); return 0; }
C
/* * @file Date.h * @details Contains all alarm function prototypes * and the Date structure definition * Uses header guards so extern definitions * aren't used in Date.c module * @author Liam JA MacDonald * @date 2-Oct-2019 (Created) * @date 9-Oct-2019 (Last Modifie...
C
/*! * \file genericLLTest.c * \brief Source file to test generic LinkList * * Revision History: * Date User Comments * 4-Apr-19 Mukund A Create Original */ #include <stdio.h> #include <stdbool.h> #include "genericLL.h" void iterateInt(void *); int findKey(void *, void *); int comparatorFn(void ...
C
/* ### AVENTURA 2 ### Squad: LRAOS Miembros: Camino, Lluís López, Rubén Reyes, Andrea */ #define _POSIX_C_SOURCE 200112L #define COMMAND_LINE_SIZE 1024 #define ARGS_SIZE 64 #define PROMPT '$' #define TRUE 1 #define FALSE 0 #include <stdio.h> #include <stdlib.h> #include <unistd.h>...
C
/* ڵ 000000111000 000100111100 001001010001 001100101101 010001111101 010100000000 110000000011 -100000000000 */ #include <stdio.h> #include <string.h> #include "stdlib.h" typedef struct { //ɾ unsigned short opcode:4; unsigned short operand:8; }inc; inc memory[256]; // ޸ short r1,r2,r3,r4; // inc mbr; char pc1[...
C
// Nathaniel Lyra // COP 3502C, Spring 2019 // na107394 // Create a "lonely party array", where arrays are broken into fragments // that get allocated and deallocateded on an as needed basis. #include "header.h" #include <stdio.h> #include <stdlib.h> LonelyPartyArray *createLonelyPartyArray(int num_fragments, int fr...
C
#include "holberton.h" #include <stdio.h> /** * puts_half - print second half * @str : char * Return : nothing(mean true). */ void puts_half(char *str) { int i, z; z = 0; while (str[z] != '\0') { z++; } if (z % 2 == 0) { for (i = z / 2; str[i] != '\0' ; i++) { if (i < z) _putchar(str[i]); } } else { for (i = (z - ...
C
/*! * \file * \brief AdSwio Click example * * # Description * This click provides a fully integrated single chip solution for input and output operation. * The AD-SWIO Click contains four 13-bit DACs, one per chanal, and 16-bit Σ-∆ ADC. * These options give a lot of flexibility in choosing functionality for ...
C
#include "bh.h" struct HeapStruct { int Capacity; // maximum heap size int Size; // current heap size int *Elements; // an array of element }; BinHeap initializeBH( int MaxElements) { BinHeap H; H = malloc(sizeof(struct HeapStruct)); assert(H); // Allocate the array plus one extra for sentinel ...
C
#include "tm1650.h" #include "delay.h" #include "stdbool.h" void dtmelay(unsigned char x) { unsigned char i; for(;x>0;x--) for(i=110;i>0;i--); } void TM16_SDA_IN(void ) //设置SDA为输入模式 { GPIO_InitTypeDef GPIO_INIT; //设置SDA为输入模式 GPIO_INIT.GPIO_Mode = GPIO_Mode_IN; //设置成上拉输入 GPIO_INIT.GPIO_PuPd = GPIO_PuPd_U...
C
#include <stdio.h> #include <stdlib.h> #define LENGTH 32 int count_num(int value) { int count = 0; while(value>0) { value /= 10; count ++; } return count; } int main(int argc, char *argv[]) { char *str = argv[0]; int a,b,c,x,z; int max; int i,j,k; int res; int num=5; if (ar...
C
#ifndef BITMAPFONT_H #define BITMAPFONT_H #include <stdbool.h> #include <SDL.h> /* * The bitmapfont contains information for rendering a char* on an SDL_Renderer. * A bitmapfont is initialized using an image, where each glyph is separated by * a 'separation color'. The separation color is the first pixel read in ...
C
/* * File: proj1.c * Author: Diogo Dinis (99066) * Description: IAED 1st Project - 2021 */ #include <stdio.h> #include <stdlib.h> #include <string.h> /* --General defines-- */ /* Defines the max. size of a task description */ #define TASK_DESCR_SIZE 50 /* Defines the max. number of tasks */ #define MAX_TASKS 10...
C
#include "structs.h" #include "c.h" int dirID = 0; int fileID = 0; void list(Node* Ierarchy) { //recursive function that creates the hierachy DIR *directory, *tempDirectory; char newname[49]; struct dirent *dir; if ((directory = opendir(Ierarchy->name)) == NULL) { //tries to open the node's na...
C
#include "eServicios.h" #include "input.h" #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h> int servicio_searchIndexById(eServicio* unServicio, int size, int id) { int rtn = -1; int i; for (i=0; i<size; i++) { if (unServicio[i].id == id) { rtn = i; } } re...
C
/* ȭ ͸ Է¹޾ Ͽ ϴ ۾ */ #include <stdio.h> #pragma warning(disable:4996) int main() { char name[7]; int grade; char major[7]; //step1. ü FILE* fp; fp = fopen("c:\\Sample\\studnet.txt","wt"); for (int i = 0; i < 3; i++) { printf("̸ г а Է : "); scanf("%s %d %s", name, &grade, major); getchar(); fprint...
C
// Contains auxiliary functions like template-matching, and other calculation functions #include <stdlib.h> #include <gtk/gtk.h> #include <math.h> // Defining keyboard grouping // The number definitions vary depending how difficult the keys are to reach from one another // NEEDS CHANGE --- TOP PRIORITY #define TOP1 1...
C
#include <stdio.h> #include <string.h> char s[1000][200]; int main(){ while(1){ int n; scanf("%d", &n); if ( !n ) break; getchar(); memset(s, 0, sizeof(s)); for (int i=0; i<n; i++) { scanf("%s[^\n]", s[i]); } int cur=0; for (int i=0; i<n; i++){ for (int j=cur; j<102; j++){ if ( s[i][j] == '...
C
/* File Name : bpt.c * Author : Kim, Myeong Jae * Due Date : 2017-11-5 * * This is a implementation of disk-based b+tree */ #include "bpt.h" #include <string.h> #include <sys/stat.h> #include <sys/types.h> #include "bpt_header_object.h" #include "bpt_page_object.h" #include "bpt_free_page_manager.h" #include...
C
#include <sys/types.h> #include <sys/stat.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <stdio.h> #include <pwd.h> #define MAX 512 #define AUTH_FILE "/etc/triface.own" #define COMM_FILE "/etc/triface.com" extern char **environ; char *GetFileName(char *obj) { char *path; char *file; if ...
C
#include<stdio.h> void swap(intx,inty) { int t; t=a; a=b; b=t; } int main() { int a=100,b=200; printf("\n before swapping a = %d b = %d",a,b); swap(a,b) printf("\n after swapping a = %d b = %d",a,b); return 0; }
C
#include <sys/socket.h> #include <arpa/inet.h> #include <unistd.h> #include <string.h> #include <stdio.h> #include <errno.h> #include <time.h> #include <stdbool.h> #define DAYTIME_SERVER_PORT 13 #define MAX_CLIENT 1000 #define MAX_LEN 80 int main(int argc, char **argv) { int servFd, ret; int clientFd; struct so...
C
/* * Init.c * * Created: 04-11-2020 12:24:15 * Author: Kenneth */ #include <stdio.h> #include <avr/io.h> void Init(void) { /* Matrix Keyboard */ // Column sat til hj DDRK |= (1<<PK0); DDRK |= (1<<PK1); DDRK |= (1<<PK2); DDRK |= (1<<PK3); // Row sat til input PORTK |= (1<<PK4); PORTK |= (1<<PK5); POR...
C
/** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ void traverse(struct TreeNode *root, int *min) { if (root) { if (min[0] == -1) { min[0] = root->val; } else { if (root->val < min[0]) { min...
C
#include<stdio.h> #include<stdlib.h> #include "2.h" node* f9(node* p, int value) { node* initp = p; node* newp = (node*)malloc(sizeof(node)); newp->data = value; while (p->next != NULL&&value > p->next->data) { p = p->next; } if(p->next==NULL) { newp->next = p->next; p->next = newp; } else { newp->ne...
C
/* * time.h * Times the difference and sends the data out via UDP * * Created on: July 2, 2016 * Author: elvin.chua */ #ifndef STATS_H_ #define STATS_H_ #include <sys/time.h> #include <stdint.h> #include <stdio.h> #include <string.h> #include <sys/socket.h> #include <arpa/inet.h> typedef struct{ uint32...
C
#include <stdio.h> void printSquare(int size) { for ( int rows = 0, counter = 1; rows < size; rows++ ) { for ( int cols = 0; cols < size -1; cols++ ) { printf("%d ", counter); counter +=1; } printf("%d\n", counter); counter += 1; } } void printPiramid(in...
C
#pragma once typedef struct cs_sl_node cs_sl_node_t; typedef struct cs_slist cs_slist_t; struct cs_sl_node { void* data; cs_sl_node_t* next; }; struct cs_slist { cs_sl_node_t* head; }; cs_sl_node_t* cs_sl_node_new(void* data); void cs_sl_node_free(cs_sl_node_t* node); cs_slist_t* cs_slist_new(); void cs_slist_f...
C
#include <signal.h> static __sighandler_t set_mask(int sig, int how, __sighandler_t ret) { sigset_t set; // Create an empty signal set. if (sigemptyset(&set) < 0) return SIG_ERR; // Add the specified signal. if (sigaddset(&set, sig) < 0) return SIG_ERR; // Add the signal set to the current signal mask. ...
C
/* Author: Niek van Leeuwen Date: 07-11-2019 */ #include "client.h" #include <sensordata.h> int send_packet(int, struct sockaddr * ,socklen_t, int interval); int main(int argc, char *argv[]) { int sockfd, ret, portno, interval; char* server_ip; struct sockaddr_in serveraddress; //default values define...
C
int main() { int a; printf("enter a number: "); scanf("%i, &a"); if( a <= 50, a++ ) printf("odd"); else printf("even"); return 0; }
C
/** * @mainpage * # Загальне завдання * 1. **Зробити** tree * * @author Gladkov K. * @date 14-feb-2020 * @version 1.0 */ /** * @file main.c * @brief Файл з main, який також викликае функцii * * @author Gladkov K. * @date 14-feb-2020 * @version 1.0 */ #include "lib.h" int main() { printf("Program was ma...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <fcntl.h> #include <sys/mman.h> #include <linux/videodev2.h> #define VIDEO_WIDTH 640 #define VIDEO_HEIGHT 480 #define VIDEO_FORMAT V4L2_PIX_FMT_H264 #define BUFFER_COUNT 4 struct buffer { void* start; unsigned int length; }; ...
C
#include<stdio.h> int main() { int a,b,n,m,i,j,mini,sum,sets=1,avg; while(scanf("%d",&n)) { if(n==0) break; m=0; sum=0; int num[n]; for(i=0;i<n;i++) { scanf("%d",&num[i]); sum=sum+num[i]; } avg=sum/n; for(j=0;j<n;j++) ...
C
#include "Include.h" #define SET_595CS {GPIO_SetBits(GPIOB, GPIO_Pin_5);} #define CLR_595CS {GPIO_ResetBits(GPIOB, GPIO_Pin_5);} const unsigned char DisplayData[] = { 0xFA,0xC0,0x76,0xF4,0xCC,0xBC,0xBE,0xD0,0xFE,0xFC,0 }; void Led8IOInit(void) { GPIO_InitTypeDef GPIO_InitStructure; ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* get_file_rights.c :+: :+: :+: ...
C
/*------------------------------------------------*/ /* kod.c */ /* Toto je libovolny komentar * v souboru kod.c */ #include <stdio.h> //standardni knihovna int main(void) { printf("Hello World\n"); return 0; } /*-----------------------------------------...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "list.h" #include "hash.h" #include "bitmap.h" #define MAXCMD_LEN 100 #define MAXARGV_LEN 20 //comparison function of list bool compare_list(const struct list_elem *a, const struct list_elem *b, void *aux) { struct list_item *A; A = list_entry(a, s...
C
#include <stdio.h> #include <string.h> int main(void){ char answer[50]; //string 같은 경우에 &를 쓰지는 않는다. 왜냐하면 처음요소의 주소 자체이기 때문이다. scanf("%s" , answer); printf("hello, %s", answer); return 0; }
C
#include "my_tpl_lhash.H" #include <iostream> struct Data : public LhashBucket<int> { int data_member; Data(int _key, int _data) : LhashBucket<int>(_key), data_member(_data) { // empty } }; unsigned long hash_fct(const int & key) { return key; } int main() { LhashTable<int> table(hash_fct);...
C
#include <stdio.h> #include <stdlib.h> int main() { long unsigned int n,s=1,j=0,t,i; printf("enter no "); scanf(" %d", &n); for(i=1; ; i++){ t=s; s +=j; j=t; if(n==s){printf("yes");break;}else if(s>n){printf("no");break;}else{continue;}} return 0; }
C
/********************************************************************************************************** *ļCmd_process.c *ʱ: 2012-10-18 *: ںTCPúͲѯָ * * ˾ **********************************************************************************************************/ #include "cmd_process.h" /**************...
C
#include<stdio.h> #include<stdlib.h> int add(int a, int b, int c){ printf("Value a: %d \n", a); printf("Value b: %d \n", b); printf("Value c: %d \n", c); return a + b + c; } int main(){ int a = 1; int b = 2; int c = 3; int sum = add(a, b, c); printf("Sum = %d\n", sum); return 0; }
C
#include<stdio.h> int conditional(int x,int y,int z) { return ((x&y)|((~x)&z)); } int main() { int x,y,z; scanf("%d%d%d",&x,&y,&z); int a=conditional(x,y,z); printf("%d",a); }
C
/* Author: Levana Scirai Task1 for C File h of myMath */ float add(float x , float y); //returns x + y float sub(float x , float y);// returns x - y double mul(double x , int y); //returns y*x double div(double x, int y);//returns x/y double Exp(int x); // Expondential _ Fuction double Pow(double x , int y...
C
#include<stdio.h> #include<math.h> long flag[]={0,2,4,9,16,25,64,289,729,1681,2401,3481,4096,5041,7921,10201,15625,17161,27889,28561,29929,65536,83521,85849,146689,262144,279841,458329,491401,531441,552049,579121,597529,683929,703921,707281,734449,829921,1190281}; long binary(long a[],long m,long l,long u){ long m...
C
#define _CRT_SECURE_NO_WARNINGS 1 #define _CRT_NONSTDC_NO_DEPRECATE 1 #include "stdio.h" #include "stdlib.h" #include "string.h" #include "ctype.h" #include "limits.h" #include "math.h" #include "stdbool.h" void caclulate(int *nums, int numsSize, int index, int S, int sum, int *cnt) { if (index == numsSize) ...
C
#include "/players/jaraxle/define.h" inherit "/players/jaraxle/room.c"; reset(arg) { if(arg) return; set_light(1); short_desc = "Third Earth"; long_desc = " This mideastern edge of the forest is quite tame and calm. The\n"+ "trees make a tall, close line along the edge of the forest barring\n"+ ...
C
// Array exercise Q3 #include <stdio.h> int main() { int mata[5]; printf("\nPlease enter 5 integers separated by space:\n"); for(int i=0; i<5 ; i++) scanf("%d",&mata[i]); printf("Content of array are:\n"); for(int i=0; i<5 ; i++) printf("%d\n",mata[i]); return 0; }
C
#include<stdio.h> int main() { int i, n, score[1000]; printf("enter the value of n : "); scanf("%d", &n); for(i=0; i<n; i++) scanf("%d", &score[i]); int max = score[0]; int min = score[0]; int max_count =0, min_count=0; for(i=0; i<n; i++){ if(score[i]>max){ max ...
C
#include <stdlib.h> /* Returns a pointer to the first occurrence of character in the C string str. The terminating null-character is considered part of the C string. Therefore, it can also be located to retrieve a pointer to the end of a string. @param str the string to be searched @param len the number of characters ...
C
/************************************************************************** * * auxi.h * * Header file for auxi.c * * (C) 1999 Dan Foygel (dfoygel@cs.cmu.edu) * Carnegie Mellon University * * Based heavily on code written by Dimitris Margaritis (dmarg@cs.cmu.edu) * *******************************...
C
#include "inputs.h" float getFloat(char* message) { float aux; printf("%s",message); scanf("%f",&aux); return aux; } int getInt(char* message) { int aux; printf("%s",message); scanf("%d",&aux); return aux; } char getChar(char* message) { char aux; printf("%s",message); ...
C
/* ============================================================================ Name : factorial.c Author : Myrella Alejandra Version : Copyright : Your copyright notice Description : Hello OpenMP World in C ============================================================================ */ #inclu...
C
#include <stdio.h> int main (void) { extern char **environ; char **p; for (p = environ; *p; p++) printf("%s\n", *p); return (0); }
C
#include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <sys/mman.h> #include <unistd.h> #include <pthread.h> #include <string.h> #include "warehousesim.h" // stations struct station stations[4]; package *pileHead = NULL; // pile of pending packages // tracking packages completed int packagesCompleted = 0;...
C
/** 有21根火柴,两人依次取,每次每人只可取走1〜4根,不能多取,也不能不取,谁取到最后一根火柴谁输。 请编写一个人机对弈程序,要求人先取,计算机后取;计算机为“常胜将军”。 */ #include <stdio.h> int main() { int computer, people, spare = 21; printf(" -----------------------------------------\n"); printf(" -------- 你不能战胜我,不信试试 --------\n"); printf(" ---------------------------------...
C
//计算均差 #define _CRT_SECURE_NO_WARNINGS 1 #include <stdio.h> #include <math.h> double calculateSD(double data[]); int main() { int i; double data[10]; printf("输入10个元素: "); for (i = 0; i < 10; ++i) scanf("%lf", &data[i]); printf("\n标准偏差 = %.6lf\n", calculateSD(data)); return 0; } do...
C
/************************ * 模块参数的测试例子 * Author: zht * Date: 2015-04-16 ************************/ #include <linux/module.h> static int abc = 5; module_param(abc, int, 0644); static char *name = "shrek"; module_param(name, charp, 0444); static int test = 0; module_param(test, bool, 0644); static int sizes[] = {10...
C
#include <stdio.h> int main(void) { int x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16; int row1_sum, row2_sum, row3_sum, row4_sum; int column1_sum, column2_sum, column3_sum, column4_sum; int diagonal_leftright_sum, diagonal_rightleft_sum; printf("Enter the numbers from 1 t...
C
/* ** get_table.c for get_table.c in /home/rousse_i/rendu/CPE/Sudoki-Bi/src ** ** Made by mathis rousselot ** Login <rousse_i@epitech.net> ** ** Started on Sat Feb 27 10:42:06 2016 mathis rousselot ** Last update Sat Feb 27 14:34:14 2016 mathis rousselot */ typedef struct s_curs { int curs; int ...
C
#include <stdio.h> int main() { int j,i,A[5],temp; for(i=0;i<5;i++) { scanf("%d",&A[i]); } //int steps=0; for(i=0;i<4;i++) { //steps++; int swap=0; for(j=0;j<4-i;j++) { //steps++; if(A[j]>A[j+1]){ swap++; temp=A[j]; A[j]=A[j+1]; A[j+1]=temp; } } if(swap ==0) break; } for...
C
// Lab08 // one_per_line // Zixuan Guo (z5173593) #include <stdio.h> int main (void) { printf("Enter a string: "); char line[4096]; int i = 0; fgets(line, 4096, stdin); while (line[i] != '\n') { printf("%c\n", line[i]); i++; } return 0; }
C
/*дһfun,Ĺ:ʵַ(ʹÿ⺯strcat),p2ַָӵp1ַָ ,ֱַ: FirstString SecondString :FirstStringSecondString ע:Դ¡ Ķmainеκ,ںfunĻд䡣 :*/ #include<stdio.h> #include<stdlib.h> void fun(char p1[],char p2[]) { /***************Begin************/ int i=0,j=0; for(;p1[i];i++); for(;p2[j];j++) p1[i++]=p2[j]; p1[i]=0; ...
C
//motors int r_motor = 1 ; int l_motor = 2 ; //set default motor speed int r_vel = 900; int l_vel = 700; int constrain_velocity ( int vel ) { vel = vel > 1000 ? 1000 : ( vel < -1000 ? -1000 : vel) ; //if > 1000 constrain to to 1000, less then -1000 constrain to -1000 return vel; } int main() { int sensor_...
C
/**/ #include <stdio.h> int main(void) { int int1, int2, int3; printf("Please enter 3 numbers separated by spaces > "); scanf("%d%d%d", &int1, &int2, &int3); if ((int1 < int2 && int1 > int3) || (int1 > int2 && int1 < int3)) printf("%d is the median\n", int1); else if ((int2 < int3 && int...
C
#include <stdio.h> static int daytab[2][13] = { {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, }; /* judge if year is leap year */ int is_leap_year(int year) { return ((year % 4 == 0 && year % 100 != 0) || year % 400 ==0); } /* day_of_year : set day of ...
C
/* File: utilities.c * Author: Amr Gaber * Created: 11/4/2010 * Last Modified: 21/10/2010 * Purpose: Executes utility operations */ #include "utilities.h" extern int errno; /* void ERROR(char *message, unsigned int lineNum, char systemError) -- prints * error message then exits program with status -1 */ void ...
C
#include<stdio.h> int main(void) { unsigned int x; int count=0; scanf("%u",&x); while(x!=0) { if(x&1) count++; x=x>>1; } printf("%d\n",count); return 0; }
C
#pragma once #include "SDL/SDL.h" // for the SDL_Rect extension... #include "spoint.h" /** * a rectangle class that can be interfaced as a x,y,w,h rectangle as well as a * 2-corners rectangle (min, max): * * minx,miny * ^--W--+ * | | * H | * | maxx,maxy * +-----^ * * @note: using getW...
C
#ifndef _heap_sort_h #define _heap_sort_h #include <stdlib.h> #define ValType double #define IS_LESS(v1, v2) (v1 < v2) void siftDown(ValType *a, int start, int end); void heapsort(ValType *a, int count); // do a swap between two values #define SWAP(r, s) do{ValType t=r; r=s; s=t;} while(0) #endif
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* handle_char.c :+: :+: :+: ...
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
#include "stm32f103c8_rcc_driver.h" uint16_t ahb_prescaler[8] = { 2, 4, 8, 16, 32, 64, 128, 256 }; uint16_t apb1_prescaler[4] = { 2, 4, 8, 16 }; uint32_t rcc_get_pclk1_value() { uint8_t hpre, ppre, ahb, apb1; uint32_t sysclk; uint8_t clksrc = ((RCC->CFGR >> 2) & 0x3); // HSI if (clksrc == 0) { sysclk = 16; /...
C
/* * sauvegardeFichier.c * * Created on: 10 mai 2013 * Author: Pauldb */ #include <stdio.h> #include <stdlib.h> #include <errno.h> //traitement des erreurs pour fopen #include <string.h> extern int errno ; #include "structures.h" #include "defines.h" /*Permet d'enregistrer TOUT le fich...
C
/* * AUTORES: Ane Zubillaga, Ian Recke, Ivan Sorbet, Alejandro Meza *version del 30/11/2019 */ #include <stdio.h> #include <stdlib.h> #include "fragmentar.h" #include <sys/errno.h> #include <wchar.h> #include <math.h> #include <unistd.h> #include "arbolBin.h" #define clear() printf("\n") tipoArbolBin arbol1; type...
C
/*##################################### #c_grep #Trabajo Práctico Nº2 #Ejercicio Número 4 #Arias, Rodrigo DNI: 34.712.865 #Culen, Fernando DNI: 35.229.859 #García Alves, Pablo DNI: 34.394.775 #Juffar, Sebastian DNI: 34.497.148 #Nogueiras, Jorge DNI: 34.670.613 #1 REENTREGA #####################################*/ #inclu...
C
#include <stdio.h> #include <stdlib.h> #include "lib.h" void inicializarArray(sProducto* campo, int size) { int i; for(i=0; i<CANT; i++) { campo[i].estaCargado=0; //inicializo en 0, no esta cargado } } int carga(int size, char msj, sProducto* campo) { char auxPosicion[10];...