language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <unistd.h> #include <TAU.h> int f1(void) { TAU_PROFILE_TIMER(t,"f1()", "", TAU_USER); TAU_PROFILE_START(t); sleep(1); TAU_PROFILE_STOP(t); return 0; } int input(void) { TAU_PROFILE_TIMER(t,"input", "", TAU_USER); TAU_PROFILE_START(t); sleep(1); TAU_PROFILE_STOP(t); } i...
C
#include <lib.h> #include <syscall.h> static uint64_t state_128plus[2]; static uint64_t xorshift128plus(void) { uint64_t s1 = state_128plus[0]; uint64_t s0 = state_128plus[1]; state_128plus[0] = s0; s1 ^= s1 << 23; // a s1 ^= s1 >> 17; // b s0 ^= s0 >> 26; // c return (state_128plus[1] ...
C
#include <math.h> #include <stdio.h> #include <omp.h> #include <stdlib.h> #include <unistd.h> #include <time.h> #define size 100 int arr[size]; void merge(int arr[], int l, int m, int r) { int i, j, k; int n1 = m - l + 1; int n2 = r - m; int L[n1], R[n2]; for (i = 0; i < n1; i++) ...
C
#include <stdio.h> #include <string.h> #include "account_srv.h" #include "printChoices.h" #include "inputMethod.h" #include "color.h" #include "account_UI.h" #include "templates.h" void noUserLogin(); void uesrLogin(); void login() { setBackgroundColor(0); setFontColor(7); // Test if it's the first time while...
C
#include <stdio.h> extern char* add_a(char *); int main (void) { char str[10]="chush"; printf("%s\n", add_a(str)); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <math.h> #include "cblas.h" #define BLOC_SIZE 100 /* * CBLAS_ORDER Order : ordre par ligne ou colonne * CBLAS_TRANSPOSE TransA (char) : N/n pour normal - T/t - C/c pour la transposée * CBLAS_TRANSPOSE TransB (char) : N/n pour norlal - T/t - C/c pour la transposée * ...
C
#include "reciever.h" void recievePostResponse(int socket,FILE* response){ char* httpResponse = malloc(MAX_HEADER_); int totalBufferSize = recv(socket, httpResponse, MAX_HEADER_, 0); if(totalBufferSize < 0){ perror("error receiving packages"); free(httpResponse); return; } ...
C
#include "str_dealing.h" /*ַȼ*/ uint16_t strLen(pu8 str) { int i = 0; while (*str != 0) { ++i; ++str; } return i; } /*ַݺͳȱȽ*/ _Bool str_compare(uint8_t * str1,uint8_t * str2) { uint16_t str1_len = strLen(str1); uint16_t str2_len = strLen(str2); uint16_t num; if(str1_len == str2_len) { ...
C
#ifndef _PTI_H_ #define _PTI_H_ #include "include.h" #define FLY_FREQUENCY 50 // Ƶ #define PTI_MIN 500 // Сռձ #define PTI_MAX 1000 // ռձ #define PTI_CENTER (PTI_MIN+PTI_MAX)/2 // мռձ #define POWER_MIN 585 // Сֵ #define POWER_MAX 725 // ֵ #define POWER_ATTITUDE 710 // һʱĸ߶ ...
C
#include "shell.h" /** * _free_line - free's struct data->line from memory * @data: data->line pointer to free's * Return: Nothing */ void _free_line(Data_t *data) { /*If line exits can free's from memory*/ if (data->line) free(data->line); } /** * _free_cleanline - free's struct data->cleanline from memory ...
C
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /* * File: Word Sort.c * Author: USER * * Created on November 27, 2019, 6:24 PM */ #include "WordSort Header.h" int main(int...
C
#include <stdio.h> #include <stdlib.h> void sort(int []); int noofrect; int checkinside(int x,int y); int checkrect(int x1,int y1,int x2,int y2); int arr[100][4]; int main() { FILE *input; register int i,j; int lx,ly,ux,uy; int xmin,xmax,ymin,ymax; int area,maxarea=0; input=fopen("data.txt","r...
C
#include "chat.h" #include "global.h" #include "debug.h" #include "gui.h" int sock_chat; bool chat_ready=false; char message[MAX_LEN_CHAT+2]; u8 chat_refresh; /** Demana al servidor si hi han missatges */ void chat_request_update(void) { char buffer[MAX_LEN_CHAT+2]; if(chat_ready==1) { ...
C
#ifndef MOUSE_H #define MOUSE_H #include "drawing.h" #define INT_MOUSE 0x33 #define MOUSE_RESET 0x00 #define MOUSE_GETPRESS 0x05 #define MOUSE_GETRELEASE 0x06 #define MOUSE_SETSHAPE 0x09 #define MOUSE_GETMOTION 0x0B #define LEFT_BUTTON 0x00 #define RIGHT_BUTTON ...
C
#include <stdio.h> #include <stdlib.h> #include "functii_sudoku.h" int main() { int **matrix,i,j,nr_joc; char dump_string[100]; // sir de caractere folosit pt a citi din fisier pana ajung //la sudoku pe care trebuie sa il rezolv FILE *ModelSudoku=fopen("Modele Sudoku.txt...
C
#include <stdio.h> #include <string.h> main() { char a[5][10],t[10]; int i,j; for(i=0;i<5;i++) { printf("%dͬѧ:",i+1); gets(a[i]); } for(i=1;i<5;i++){ for(j=0;j<5-i;j++) if(strcmp(a[j],a[j+1])>0) { strcpy(t,a[j]); strcpy(a[j],a[j+1]); strcpy(a[j+1],t); } } for(i=0;i<5;i++) ...
C
//ʽ鶨 int MaxDegree = 10; typedef struct { int CoeffArray[MaxDegree + 1]; int HighPower; } *Polynomial; //ʽʼΪ0Ĺ void ZeroPolymial(Polynomial Poly) { int i; for(i=0;i<=MaxDegree;i++) { Poly->CoeffArray[i] = 0; } Poly->HighPower = 0; } //ʽӵĹ void AddPolynomial(const Polynomial Poly1,const Polynomial Poly2,Pol...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> int *data; int *aux; int N; void init_array(int n); void print_array(); void selection_sort(); void insertion_sort(); void bubble_sort(); void shell_sort(); void quick_sort(int l,int r); void merge_sort(int l,int r); int main(int argc,char** args){ if(argc <...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> typedef struct node{ char data; struct node *left,*right; }Node; Node* EXPR(); Node* FACTOR(); Node* makeNode(char data); void printInfix(Node* root); Node* root; char expr[256]; int pos; int main(){ scanf("%s",expr); pos = strlen(expr) - 1;...
C
#include<stdio.h> #include<malloc.h> struct node { int data; struct node* next; }; #define size sizeof(struct node) struct node* ins( struct node* head, int val) { struct node* newNode = (struct node* )malloc(size); newNode->data = val; newNode->next = NULL; if (head...
C
#include <stdio.h> #include <errno.h> #include <string.h> #include <sys/epoll.h> #include <fcntl.h> #include <unistd.h> #include <stdlib.h> #include <netinet/in.h> #include <sys/types.h> /* See NOTES */ #include <sys/socket.h> #include <arpa/inet.h> #include <assert.h> #include <pthread.h> #include "Server.h" ...
C
#include "parser/parse.h" Request * newRequest() { Request *request = (Request *) malloc(sizeof(Request)); request->header_count=0; request->content_length = -1; request->close = 0; request->headers = 0; return request; } /** * Given a char buffer returns the parsed request header...
C
/******************************************** Target MCU & clock speed: ATmega328P @ 8Mhz internal Name : BlinkLED.c Author : Insoo Kim (insoo@hotmail.com) Date : April 18, 2015 Description: Blink LED at PB0 every second. HEX size[Byte]: 166 out of 32K Ref: ********************************************/...
C
#include <stdio.h> int main() { int a,b; printf("Inserire i valori di a e b per trovare il valore di x nell'equazione ax + b = 0\n"); printf("a: "); scanf("%d",&a); printf("b: "); scanf("%d",&b); b = b*(-1); printf("x = %d/%d", b,a); retu...
C
#include<iostream> using namespace std; int checkTwo(int n); int bye1(int p); int bye2(int p); int main() { int p; cout<<"enter the number of players: "; cin>>p; bye1(p); bye2(p); return 0; } int bye1(int p) { int a; for(int i=0;i<p;i++) { a=p-i; a=a/2; a=a+i; if(a%2==0) { if(che...
C
//BOJ 1193 분수찾기 #include <stdio.h> int main() { int i = 1, j = 2, k = 1, tmp = 0, cnt = 1, n = 0, m = 0; scanf("%d", &i); while (i != 1) { tmp = k; k += j; ++j; ++cnt; if (i <= k) { break; } } if (i == 1) { printf("1/1"); return 0; } i -= tmp; if ((cnt % 2) == 1) { m = cnt - (i -...
C
main() { int matriz[10][10]; int i; int j; int x; int y; for (i=0 ; i<10 ; i++) for (j=0 ; j<10 ; j++) matriz[i][j] = 0; printf("\nEntre com x e y: \n"); scanf("%d%d",&x,&y); for(i=x-1 ; i<=x+1 ; i++) for (j=y-1 ; j<=y+1 ; j++) ...
C
#include <stdio.h> #include <fcntl.h> static int compdata[20000]; static int compindx=0; void main(int argc, char **argv) { int width, height, x, y, i; long next, last; if(argc < 3) return; width = atoi(argv[1]); height= atoi(argv[2]); setmode(1, O_BINARY); for(y=0; y<height; y++...
C
#include <math.h> #include "vector3.h" float vector3_dot(struct vector3 a, struct vector3 b) { return a.x * b.x + a.y * b.y + a.z * b.z; } float vector3_length(struct vector3 a) { return sqrt(a.x * a.x + a.y * a.y + a.z * a.z); } int vector3_cmp(struct vector3 a, struct vector3 b) { return a.x == b.x && a.y =...
C
#include "Graph.h" #define WHITE 0 #define GRAY 1 #define BLACK 2 typedef struct edge { int id; struct edge *next; int weight; } Edge; typedef struct vertex { int id; struct vertex *next; Edge *edges; int num_edges; int d; //discovery time int t; //end time int visited; } Vertex;...
C
typedef struct lista { float info; lista *prox; }Lista; typedef struct pilha { Lista *topo; }Pilha; Pilha *pilha_cria(void){ Pilha *p= (Pilha*) malloc(sizeof(Pilha)); p->topo=NULL; return p; } void pilha_push(Pilha *p, float v){ Lista *n = (Lista*) malloc (sizeof(Lista)); ...
C
#include "Chess.h" /* globals */ int minimax_depth = 1; //0 for white, 1 for black int userColor = 0; //0 for white, 1 for black int whosTurn = 0; //1 for two players, 2 for AI int gameMode = 1; //current board int board[BOARD_SIZE][BOARD_SIZE]; //pieces on the board summary int pieces[6][2]; //first Win...
C
#include "minishell.h" void print_input(unsigned char c) { if (is_ctrl_key(c)) { ft_putnbr(c); ft_putstr("\r\n"); } else { ft_putnbr(c); ft_putstr(" ("); ft_putchar(c); ft_putstr(")"); ft_putstr("\r\n"); } }
C
// Add necessary #include's. #include <stdio.h> #include <stdlib.h> #include <string.h> #include "records.h" // You may add helper functions. Actually there is a reason you should! int get_yob(FILE *f, const char *name, short *pyob) { fseek(f, 0, SEEK_SET); record *test = (record *)malloc(sizeof(record)); while...
C
void start_game() { //Initializes Game get_word(); word_len = strlen(word); memset(guessed_letters, 0, sizeof guessed_letters); attempts = 10; } void get_input() { //Gets guess from user and checks //To see if that letter is in the word int i; int letter_hit = 0; /...
C
// // Created by xixi2 on 2020/3/21. // #include <stdio.h> #include <pthread.h> #include <time.h> #include <stdlib.h> #include <unistd.h> #include <semaphore.h> #define BUFF_SIZE 3 // 缓冲区大小 //#define PRODUCE_THREAD_SIZE 5 #define PRODUCE_THREAD_SIZE 1 typedef struct node { int data; struct node *next...
C
class Solution { public: bool isScramble(string s1, string s2) { string tmp1=s1; string tmp2=s2; sort(tmp1.begin(),tmp1.end()); sort(tmp2.begin(),tmp2.end()); if(tmp1!=tmp2){ return false; } return isSubScramble(s1,s2); } bool isSubScr...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* treat_map.c :+: :+: :+: ...
C
#include <stdio.h> // printf() #include <stdlib.h> // calloc(), atoi() #include <math.h> // pow() #include "die.h" // die() #include "queue.h" // Queue, q_node #define BASE 10 #define NDIGITS 2 * BASE - 1 // How many buckets will we use? void radixsort(int* nums, int count); // Radixsort an array of ints (LSD v...
C
#include <stdio.h> void main() { int num = 156; int digit, sum = 0; while(num > 0) { digit = num % 10; // take rightmost digit // printf("%d",digit); sum += digit; num /= 10; // remove rightmost digit } printf("%d", sum); }
C
#include<stdio.h> #include<stdlib.h> #include<string.h> int main() { int n, m, i, j; int linha=0,coluna=0; int vet[10][10]; scanf("%d %d", &n, &m); for(i=1;i<=n;i++) { for(j=1;j<=m;j++) { scanf("%d%d", &vet[i][j], &vet[i][j]); if(vet[i][j] == 1) { if(j>coluna) { coluna = j; } ...
C
#include "draw.h" extern Display *display; extern Window window; extern GC gc; void drawBrightnessIcon() { // get window attributes for width and height XWindowAttributes win_attr; XGetWindowAttributes(display, window, &win_attr); // extract window width and height int width = win_attr.width; ...
C
#include<stdio.h> float phuongtrinh ( int x ) { if (x==0) return 1; else return ( 2*phuongtrinh(x-1)+3/4); } void main () { printf("%f", phuongtrinh(5)); }
C
#include<stdio.h> #include<conio.h> #include<graphics.h> main() { int a,b,i,j; clrscr(); printf("entert he number"); a=1; for(i=1;i<=5;i++) { printf("\n"); for(j=i;j<5;j++) { printf("%d ",j); } for(a=1;a<=i;a++) { printf("%d ",5); } } ...
C
#include <stdio.h> #include <stdlib.h> #include <malloc.h> typedef void const* (*PTRFUN)(void); typedef enum {false, true} bool; /* ============================================== RAZRED Unary_Function ============================================== */ typedef struct{ PTRFUN *vtable; int lower_bound; int ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include "lists.h" #define CHAR_PT_SIZE 256*sizeof(char) int get_next_event(Event * prev_ev, User * user_list, char * user_name); /* * Return a pointer to the struct calendar with name cal_name * or NULL if no calendar with this name exist...
C
#include <stdlib.h> #include "lists.h" /** * free_listint_safe - Free a list. * @h : first element of the list. * Return: Voidnumber of element in the list. */ size_t free_listint_safe(listint_t **h) { listint_t *l; size_t i = 0; l = *h; while (l) { if (l <= l->next) { free(l); *h = NULL; i++; ...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <string.h> #include "gestion_juego.h" #include "pantalla.h" #define gotoxy(x,y) printf("\x1b[%d;%dH",(y),(x)) void asteriscos(int n, int l, char c) { system("clear"); //Limpiamos la pantalla para evitar problemas co...
C
#include <as/private_.h> /* Public API */ void as_free(void* ptr) { if(!ptr) return; ulong* mem = &((ulong*) ptr)[-1]; as_anonmunmap(mem, *mem); } void* as_malloc(ulong size) { if(size == 0) return NULL; size = ALIGN(size + sizeof(ulong), as_getpagesize()); ulong* mem = (ulong*) as_anonmmap(size); *mem ...
C
#include <stdio.h> #include <dirent.h> #include <dirent.h> #include <sys/stat.h> /** * Main */ int main(int argc, char **argv) { // inituit char *dirname; // Parse command line if(argc == 1){ // set directory to looking to '.' dirname = '.' } else if (argc ==2 ){ dirname = argv[1]; } else { ...
C
#include<stdio.h> #include<conio.h> void main() { int n,reversedInteger=0,remainder,originalInteger; scanf("%d",&n); originalInteger=n; while(n!=0) { remainder=n%10; reverseInteger=reverseInteger*10+remainder; n=n/10; } if(originalInteger==reversedInteger) printf("palindrome"); else printf("not a palindrome"); getch();...
C
/* * Copyright (C) 2009-2023 Alex Smith * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DIS...
C
/* ============================================================================ Name : genWords.c ============================================================================ */ #include <stdio.h> #include <time.h> #include <stdlib.h> // ------------------------------------------------------------------ //...
C
/* 6. [10 marks] Write a C program to look at all files under the current directory, recursively, and look for a file named "squid". If it finds one, it outputs either the path name relative to the current directory, or how many subdirectories deep it is, whichever you find easiest. If no such file name is found, it ou...
C
struct high_pass_filter_options_int { int factor; }; struct high_pass_filter_options_afp { int factor; }; struct high_pass_filter_options_float { float factor; }; int64_t high_pass_filter_acc_int = 0; int64_t high_pass_filter_acc_afp = 0; float high_pass_filter_acc_float = 0; void high_pass_filter_int(struct ...
C
/* * Cell.h * * Created on: Jul 21, 2012 * Author: barry */ #ifndef CELL_H_ #define CELL_H_ #include "Segment.h" #include "SegmentUpdateInfo.h" typedef struct CellType { struct RegionType* region; struct ColumnType* column; int index; int id; /** * The predictionSteps is the fewest number of...
C
/*************************************************************************** Matrix multiplication seq program ****************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <time.h> double C[N][N]; double A[N][N], B[N][N]; double wall_clock(); main(argc,...
C
#include <stdio.h> #include <stdlib.h> int add (int x, int y) { int result; printf("Requisicao de adicao para %d e %d\n", x, y); result = x + y; return(result); } /* fim funcao add */ int sub (int x, int y) { int result; printf("Requisicao de subtracao para %d e %d\n", x, y); result = x - y; return(result);...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> void print_site_matrix_row(long *site_matrix_row, int width, char base) { int con_count_index; printf("%c: [", base); for (con_count_index = 0; con_count_index < width; con_count_index++){ printf(" %ld ", site_matrix_row[con_count_index]); } pr...
C
#include <avr/io.h> // The necessary header file required for avr atmega 16/32 #include <util/delay.h> // Header file required for Delay #include<compat/deprecated.h> // Used for the commands like sbi,cbi,bit_is_clear etc.. #include<stdlib.h> #ifndef multiutil_H #define multiutil_H #de...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> // 缱 typedef unsigned int UINT; // #define UINT unsigned int; // ó ص // BUT ó ϴ ܼ ġȯ // typedef ¥ ڷ // // 0, 1, 2 ̷ ǵ // ij Ÿ enum ACTION {MOVE, JUMP, ACTION}; // + 缱 // Ʒ 100, 101, 102 ڵ typedef enum COLOR {RED=100, GREEN, BLUE} COLOR; int...
C
// 2. Reverse null-terminated char* str void reverse(char* str){ if (str){ char * end = str; while(*end){ end++; } end--; char temp; while (str < end){ temp = *str; *str++ = *end; *end-- = temp; } } } int main(){ // char * str = "abc"; char* str = "abcd"; reverse(str); // cout << str...
C
// 201611523_1_2.c // 1. ׸1 α׷ Ͻÿ. /* 1: (Logic Error)-α׷ ̳߰ ޽ ߻ ʾ ٸ⿡ :(nF-32) ʾұ 꿡 error ߻Ͽ */ // 2. ùٸ µǵ α׷ ۼϽÿ // 2: #include<stdio.h> int main(void) { int nC, nF; printf("ȭµ Էϼ\n"); scanf("%d",&nF); nC = (nF-32)*5/9; printf("ȭ %d %dԴϴ\n", nF, nC); ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_print_other.c :+: :+: :+: ...
C
/********************************************************/ /****************** AUTHOR LUOYU ************************/ /********************************************************/ #include "uio.h" #include "bsdsys.h" #include "libkern.h" #include "kin.h" #include "bsdip.h" #include "ip_icmp.h" #include "socket.h" #includ...
C
#include "motor.h" #include "global.h" /* ***************************************************************************** * Motor_SetPWM() * Description : ***************************************************************************** */ void Motor_SetPWM(CTRL_DataType *control_data, MO...
C
#define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> #include <string.h> #include <limits.h> void prim(int vertex, int graph[][vertex]); void readData(); void createEdge(int vertex, int graph[vertex][vertex], int src, int dest, int weight); void initializeMatrix(int vertex, int graph[vertex][vertex]); int main...
C
/* * bankaccount.c * Authors: Emmannuel Baah * Yuk Yan */ #include "bankaccount.h" #include <string.h> #define errormessage(x) errormessage_(x, __FILE__, __LINE__) /* * Create an account given a name and balance. * insession is initialized to 0. */ Account * accountcreate( char * name ) { Account * account; ...
C
/* * MC68HC11 specific processing */ #include "do.h" #include "globals.h" #include "as.h" #include "util.h" #include "eval.h" #define PAGE1 0x00 #define PAGE2 0x18 #define PAGE3 0x1A #define PAGE4 0xCD /* addressing modes */ #define IMMED 0 #define INDX 1 #define INDY 2 #define LIMMED 3 ...
C
#include "capture.h" void de_init(){ enum v4l2_buf_type type; unsigned int i; camera.capturing=FALSE; //stopping the capture printf("Stop capturing\n\n"); type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (xioctl (camera.fd, VIDIOC_STREAMOFF, &type) == -1) errno_exit("VIDIOC_STRE...
C
#include <stdio.h> int main() { int i,j,ii,jj,n; int count=0, max_count=0, start_index=0, temp_start_index=0; int data[100] ; printf("Input Array n : "); scanf("%d",&n); printf("\n"); for(int i=0;i<n;i++) { scanf("%d",&data[i]); } printf("%d ",data[0]); printf("\n"); for(int i=0; i ...
C
/*第五章复习题 第四题*/ #include<stdio.h> int main(void) { int i = 1; float n; printf("Watch out! Here come a bunch of fractions!\n"); while(i < 30) { n = 1.0 / i; printf(" %f", n); i++; } printf("\nThat's all, folks!\n"); return 0; }
C
/* * Sooyeon E. Chough (A92093139) * Yue Jiang (A92095681) */ /** * ALL IMPLEMENTATIONS AND HELPER FUNCTIONS FOR DECODER WILL BE IN THIS FILE. */ #include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include "common.h" #include "decoder.h" /** * Takes a char c and int index as input. ...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> int main () { float a,b,l; printf("Digite um numero e a base, respectivamente: "); scanf("%f%f",&a,&b); l=(log(a))/(log(b)); printf("O log vale: %f\n",l); return 0; }
C
#ifndef OS_PROCESS_H #define OS_PROCESS_H #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_PROCESS 512 #define MAX_QUEUE 256 typedef struct Process { int process_id; // 프로세스 번호 int arrival_time; // 도착 시간 int burst_duration; // 수행 시간 int deadline_time; // 데드라인 (실시간) } Proce...
C
#include<stdio.h> #include<stdlib.h> #include<locale.h> int main(){ setlocale(LC_ALL, "Portuguese"); int a = 1; char b = 'x'; //Cdigo de exemplo com if if (a == 1){ printf ("\nOpo escolhida: 1"); }else if (a == 2){ printf ("\nOpo escolhida: 2"); }else if (a == 3){ printf ("\nOp...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main_ft_isdigit.c :+: :+: :+: ...
C
#include "hw_config.h" #include "pressure.h" /* Init SPI for operate MCP6S21 Opertional amplifier */ void PressureInit(void) { GPIO_InitTypeDef GPIO_InitStruct; SPI_InitTypeDef SPI_InitStruct; // enable clock for used IO pins RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE); /* configure pins used by SPI1 ...
C
#include <stdio.h> #include <stdlib.h> #define TRUE 1 #define FALSE 0 #define ll long long int #define ull unsigned long long int /* | | 3 2 1 | | --------4----------------0------- | | 5 ...
C
#include <stdio.h> void posortujWektor(float tablica[], int n); void wypiszWektor(float tablica[], int n); int main(int argc, char** argv) { // max 20 liczb int ileLiczb; printf("Ile liczb chcesz posortowac ?: "); scanf("%d",&ileLiczb); if(ileLiczb <= 0) { printf("Ilosc liczb do posortowania nie moze byc mnie...
C
/* Author : Chaitaly Kundu Date: 13-03-2021 *? /* Write a program to find the factorial value of any number entered through keyboard */ #include<stdio.h> int main() { int n,i,factorial=1; printf("Enter the number: "); scanf("%d",&n); for(i=1;i<=n;i++) { factorial = factorial*i; } ...
C
#include <stdio.h> int x, y, z; int gcd(int x, int y) { int i, q, r; if(x > y) { // printf("x is bigger\n"); for(i=(y-1);i>1;i--) { q = x % i; r = y % i; if (!q & !r) { printf("%d and %d are not coprimes with GCD %d\n", x, y, i); ...
C
#include <stdio.h> int main() { char str1[50], str2[50],a,b; printf("\nEnter first string: "); scanf("%s",str1); printf("\nEnter second string: "); scanf("%s",str2); for(a=0; str1[a]!='\0'; ++a); for(b=0; str2[b]!='\0'; ++b, ++a) { str1[a]=str2[b]; } str1[a]='\0'; printf("\nOutput: %s",str1); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <assert.h> #include <string.h> #include <ctype.h> #include "hashmap.h" #include "list.h" typedef struct{ char nombre[60]; char marca[25]; char tipo[20]; int stock; int precio; }Producto; typedef struct{ List * lista; char no...
C
#include "header.h" /** * malloc_error - prints error message and exits when malloc fails * @name: the name of our compiled program */ void malloc_error(char **name) { /* Error message from malloc man page, exit status from ENOMEM */ char *string = "ENOMEM Out of memory."; free((*name)); write(STDERR, string,...
C
#include<stdio.h> void main() { float num1, num2; char op,n; float result; printf("Enter the statement\n"); scanf("%f%c%f",&num1,&op,&num2); switch (op) { case '-': result = num1 - num2; printf("Result=%f", result); break; case'+': result = num1 + num2; printf("Result=%f", result); break; case'*':...
C
struct Student { int age; char name[30]; char schoolYear[20]; // Either "Freshman", "Sophomore", "Junior", "Senior", or "Graduate" int creditHours; }; void swap (int *a, int *b); int maximumElement(int *arr, int size); void reverseString(char *str); int evenOddDiff(int *arr, int size); int seniorSt...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "moto.h" #include "type.h" #include "color.h" #include "service.h" #include "work.h" #include "informs.h" #include "menu.h" #include "extras.h" #include "validations.h" void inform(eMoto motorcycles[], int sizeMotorcycles, eType typ...
C
#ifndef TRUE #define TRUE 1 #define FALSE 0 #endif #define X 400 #define Y 400 #define BG GetNamedColor("black") #define WORK GetNamedColor("white") #define S GetNamedColor("cyan") #define C GetNamedColor("green") #define POLY GetNamedColor("red") #include <stdbool.h> enum SIDE{UNCLEAR,IN,OUT,ON}; typedef str...
C
#include <stdio.h> #include <sqlite3.h> int main(int argc, char **argv) { sqlite3 *conn; sqlite3_stmt *res; int err = 0, cnt = 0; const char *err_msg; const char *tail; err = sqlite3_open("ship.sqlite3", &conn); if (err) { printf("Can not open database\n"); return 1; } err = sqlite3_exec(conn, "...
C
/* * timer0System.c * * Created: 2016-03-03 7:26:30 PM * Author: take-iwiw * Note: Timer0 is fixed for system timer (1 msec) */ #include <avr/io.h> #include <avr/interrupt.h> #include "../myCommon.h" #include "timer0System.h" /*** Internal Const Values ***/ /*** Internal Static Variables ***/...
C
#include <std.h> inherit ROOM; void create() { ::create(); set_property("indoors",1); set_travel(PAVED_ROAD); set_terrain(STONE_BUILDING); set_property("no teleport",1); set_property("light",3); set_short("%^BOLD%^Paladin's Hall%^RESET%^"); set_long( "You are standing within the paladin guil...
C
#include <stdio.h> #include <stdlib.h> void main() { int codigo; int VT = 65; char turno; float salario, desconto, descontado; float INSS = 0.15; printf("Codigo: "); scanf("%d", &codigo); printf("Turno (m/t): "); fflush(stdin); scanf("%c", &turno); printf("Salario: R$"); ...
C
#include <stdio.h> int main() { int n, soma=0, aux=1; printf("\n Informe um numero \n"); scanf("%d", & n); while (aux<n) { if (n % aux == 0) { soma = soma+aux; } aux=aux+1; } if (soma == n) { printf("\n O numero %d e um numero perfeito \n", n); } else { printf("\n O numero %d nao e um numero p...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_strsplit.c :+: :+: :+: ...
C
#include <setjmp.h> #include <avr/io.h> #include <avr/interrupt.h> #include <avr/signal.h> #include "tinythreads.h" #define NULL 0 #define DISABLE() cli() #define ENABLE() sei() #define STACKSIZE 80 #define NTHREADS 4 #define SETSTACK(buf,a) *((unsigned int *)(buf)+8) = ...
C
/* ----------------------------------------- How many bottles of water you use while taking a shower ----------------------------------------- Write a program which askes user for the duration of their shower and then spits out the number of bottles of water used. Assume that 1 minute of shower = 12 bottles of water....
C
#include "types.h" #include "stat.h" #include "user.h" char store[512]; void tail(int linesToPrint, int filedes, char* fname) { int numberOfLines; int lineStop; int i = 0; int n = 0; int skipCheck = 0; numberOfLines = 0; lineStop = 0; while((n = read(filedes, store, sizeof(store))) > 0) { ...
C
#include <stdlib.h> #include <string.h> #include <stdio.h> #include <errno.h> #include "shell.h" #include "node.h" #include "parser.h" // create new node and set type field struct node_s *new_node(enum node_type_e type) { struct node_s *node = malloc(sizeof(struct node_s)); if(!node) { return NULL...
C
#include<stdio.h> int add(int, int); int sub(int, int); long int mul(int, int); float div(int, int); int res1=-1; long int res2 = -1; float res3 = -1; int main() { int a=20,b=10,q; res1=add(a,b); printf("sum=%d",res1); res1=sub(a,b); printf("difference=%d",res1); res2=mul(a,b); printf("product=%ld",res2); res3=...