language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdlib.h> #include <unistd.h> #include <stdio.h> #include <fcntl.h> #include <cpu.h> #define RAM_SIZE 0x10000 // 32K #define ENTRY_POINT 0x1000 /* * Arguments: * moxie_sim [binary1] [addr1] <binary2> <loc2> ... binary: Binary file to load loc: Address at which to load the file */ ...
C
///////////////////////////////////////////////////////////////////////// //// EM4102.c //// //// //// //// This file contains drivers for a 4102 RF transponder //// //// ...
C
#define _CRT_SECURE_NO_WARNINGS //Ŀ //KiKiĸСдתһַжǷΪдĸǣתСдĸ֮תΪдĸ // : //룬ÿһһĸ // : //ÿ룬ռһУĸĶӦʽ //ʾ1 // //a //A //Z // //A //a //z //һ #include<stdio.h> int main() { int ch = 0; while (~scanf(" %c", &ch)) { if (ch >= 'a'&&ch <= 'z') { printf("%c\n", ch - 32);//Сдתд } else if (ch >= 'A'&&ch <= 'Z') { p...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> void merge(int* arr, int lower_ind, int mid_ind, int upper_ind) { int i = lower_ind, j = mid_ind + 1, k = 0; int* temp = (int*)malloc((upper_ind - lower_ind + 1) * sizeof(int)); while (i <= mid_ind && j <= upper_ind) { if (arr[i] < arr[j]) ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <unistd.h> #include <sys/socket.h> #include <arpa/inet.h> #include <netinet/in.h> #include <sys/types.h> #include <sys/time.h> #define BUFFERSIZE 1024 #define PORT 6000 int main(int argc, char *argv[]) { int sockfd; struct ...
C
#include <stdio.h> #include <stdlib.h> /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int argc, char *argv[]) { int *ptr; int i; ptr = (int*)calloc(5,sizeof(int*)); if(ptr!=NULL) { *ptr=1; *(ptr+1)=2; ptr[2]=4; ptr[3]=8; ptr[4]=16; ptr=(...
C
// // Created by cuong on 27/03/2021. // #include <stdlib.h> #include <stdio.h> #include <netinet/in.h> #include <sys/socket.h> #include <string.h> #include <unistd.h> //#include <sys/types.h> //#include <fcntl.h> //#include <sys/sendfile.h> #include "file.h" #include "mime.h" #define BUFFER_SIZE 65536 #define SA str...
C
#include <p32xxxx.h> #include <helper.h> #include <inttypes.h> // Delays in us, up to about 90s void delayus(uint32_t useconds){ // Ticks in CP0 ticks uint32_t totalCount = (((uint64_t)FCLK/(uint64_t)2) * (uint64_t)useconds) / 1000000; uint32_t startTime = _CP0_GET_COUNT(); // Loop until current time - start ti...
C
#include<iostream.h> #include<stdio.h> #include<conio.h> using namespace std; class time{ int hours; int mins; public: void getTime(int h,int m){ hours=h; mins=m; } void putTime(void){ cout<<hours<<" hours and"<<mins<<" mins"; } void sum(time,time); //Arg...
C
/************************************************************************* > File Name: main.c > Author:zhaoyihong > Mail:zhaoyihong_at_126_dot_com > Created Time: 2015年03月09日 星期一 21时13分53秒 ************************************************************************/ #include <stdio.h> #include <ctype.h> #include...
C
#include <stdio.h> #include <stdlib.h> #define SIZE 5 void printArray(int arr[], int size); void printArray2(int *p, int size); void doubleArray(int arr[], int size); int * createArray(int size); void circleProperties(float radius, float * perimeter, float * area); //int * returnPointer(); int main(void) { float ...
C
#include<stdio.h> int main() { // printf function is used for printing the output value. printf("Hello World!"); return 0; }
C
#include <stdio.h> #include <string.h> #include <stdbool.h> #include <stdlib.h> char password[] = "password"; bool testPassword(char* attempt) { return strcmp(attempt, password) == 0; } int main(int argc, char** argv) { if (argc != 2) { puts("Give the password as a command line argument"); ex...
C
/* 26. program for patterns of half alphabets A B C D E F G H I J K L M N O */ #include<stdio.h> #include<conio.h> void main() { int i, j, n; clrscr(); printf("Enter number : "); scanf("%d", &n); int c = 'A'; for (i = 0; i < n; i++) { for (j = 0; j <= i; j++) { ...
C
#include<stdio.h> unsigned long long int NCR(unsigned long n,unsigned long r) { if(n==r||r==0) { return 1; } return NCR(n-1,r-1)+NCR(n-1,r); } int main(void) { int t; scanf("%d",&t); while(t--) { unsigned long n,r; scanf("%lu %lu",&n,&r); printf("%lu",NCR(n,r)%1000000000+7); } }
C
//even odd with binary #include<stdio.h> int main(){ unsigned int num; printf("Enter binary or any num:"); scanf("%d",&num); if(num&1) printf("odd %d",num&1); else printf("even %d",num&1); return 10; } /* Enter binary:111111110 even 0APPLEs-MacBook-Air:C newmac$ ./a.out Enter binary:^[[A^C APPLEs-MacBook-...
C
#include "vector_math.h" #include <math.h> Vector2d intersect_lines(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) { //Ax + By = C int A1 = y2 - y1; int B1 = x1 - x2; int C1 = (A1 * x1) + (B1 * y1); int A2 = y4 - y3; int B2 = x3 - x4; int C2 = (A2 * x3) + (B2 * y3); Vector2d vect = { 0, 0 ...
C
#ifndef __LL_H__ #define __LL_H__ #ifndef NIL #define NIL (void *)0 #endif #include "speck.h" #include <stdbool.h> #include <stdio.h> #include <stdlib.h> extern float seeks; typedef struct HatterSpeak { char oldspeak[100]; char hatterspeak[100]; } HatterSpeak; // If flag is set , ListNodes that are queried are ...
C
/** * @file L0901_结构体变量的初始化和引用.c * @author HailayLin (hailay@qq.com) * @brief * @version 0.1 * @date 2020-12-08 * * @copyright Copyright (c) 2020 Hailay.site & Xihe.ai * 题号:L0901 题目:结构体变量的初始化和引用 得分:0 作业提交截止时间:2021/1/4 0:00:00 题目内容: 把一个学生的信息放在一个结构体变量中,然后输出这个学生的信息。 使用297页书上的信息(第3版271页)。...
C
#include <stdio.h> #include <stdlib.h> #include <stdbool.h> /** * Implement Stack using Linked List. */ struct StackNode { int val; struct StackNode *next; }; struct Stack { struct StackNode *top; }; void push(struct Stack *stack, int new_val) { if (stack == NULL) return; ...
C
/** * \file bfile.c * * \Implémentation des écritures et lectures bufférisées */ #include "include/format_in_out.h" #include "include/bfile.h" #include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include <sys/types.h> #include <fcntl.h> #include <unistd.h> /** * \struct bfile * \Structure pour les écrit...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "all.h" char *readFileVarLength(FILE *fp) { printf("reading a file\n"); char *line = NULL; size_t linebufflen = 0; int linelen; int bufflen = 512; int currentPosition = 0; char *buff = safe_malloc(bufflen); while ((li...
C
#include <stdio.h> #include<string.h> void sortchar(char *p ,int n); int main() { char a[1000];int t; gets(a); t=strlen(a); sortchar(a,t ); puts(a); return 0; } void sortchar(char *p,int n) { int i,j,k,m; for(i=0;i<(n-1);i++) { k=i; for(j=i+1;j<n;j++) { if(*(p+k)>*(p+j)) k=j; } ...
C
/* Write a C program to extract each byte from a given number and store them inseparate character variables and print the content of those variables */ #include<stdio.h> int main() { int num = 0x11223344; char a=(num&0xFF); char b=((num>>8)&0xFF); char c=((num>>16)&0xFF); char d=((num>>24)&...
C
#include <stdio.h> void swap(int a, int b); void swap_addr(int * a, int * b); void changeArray(int * ptr); int main_pointer(void) { // 포인터 // [철수] : 101호 // 메모리 공간의 주소 // [영희] : 201호 // [민수] : 301호 // 각 문앞에 '암호' 가 걸려있음 int 철수 = 1; int 영희 = 2; int 민수 = 3; printf("철수네 주소 : %d, 암호 : %d\n", &철수, 철수);...
C
#ifndef _MESSAGE_H #define _MESSAGE_H #include <sys/types.h> #include <sys/socket.h> #include <stdbool.h> /*Definitions needed by clients and servers*/ #define TRUE 1 #define MAX_PATH 255 /*Maximum length of file name*/ #define BUF_SIZE (size_t)8192 /* How much data to transfer at once*/ ...
C
// COMP1521 18s2 mysh ... command history // Implements an abstract data object #include <stdio.h> #include <stdlib.h> #include <string.h> #include "history.h" #include <unistd.h> #include <sys/types.h> #include <pwd.h> #include <assert.h> // This is defined in string.h // BUT ONLY if you use -std=gnu99 //extern char...
C
#include <stdio.h> #include <unistd.h> //Used for UART #include <fcntl.h> //Used for UART #include <termios.h> //Used for UART #include <string.h> #include "crc16.h" #include "uart.h" #define SERVER_CODE 0x01 #define CODE 0x23 #define INTERNAL_TEMP_CODE 0xC1 #define POTENT_TEMP_CODE 0xC2 int o...
C
/* ̰ 10 迭 ϰ 10 Է ޴´. , Է ڰ Ȧ̸ 迭 տ ä, ¦̸ ڿ ä ϱ . ڰ [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] Էߴٸ, 迭 [1, 3, 5, 7, 9, 10, 8, 6, 4, 2] Ǿ Ѵ. */ //19.02.19 /* #include <stdio.h> int main(void) { int arr1[10]; int arr2[10]; int i, tmp, j, k = 0, l = 9; for (i = 0; i < 10; i++) { printf(" Է : "); scanf_s("%d", &arr1[...
C
#ifndef BINARY_TREES_H #define BINARY_TREES_H #include <stdlib.h> #include <stddef.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <unistd.h> #include <math.h> #include <limits.h> /** * struct binary_tree_s - Binary tree node * * @n: Integer stored in the node * @parent: Pointer to the pare...
C
#include "ft_printf.h" static void ft_putnbr(unsigned int n) { if (n > 9) { ft_putnbr(n / 10); ft_putchar_fd(n % 10 + '0', 1); } if (n <= 9) ft_putchar_fd(n + '0', 1); } static int ft_minus_u_print(t_p_list par, unsigned int arg) { int len; len = 0; if (par.precision < 0 && par.precision < ft_unsigned_i...
C
#include <string.h> #include <stdio.h> #include <stdlib.h> #include "contextAD.h" double nextRandom() { dbad_currentSeed += dbad_seed ; if (dbad_currentSeed>1.0) dbad_currentSeed-=1.0 ; return dbad_currentSeed ; } void context_tgt_init(double epsilon, double seed) { dbad_mode = 1 ; dbad_ddeps = epsilon ; ...
C
#include <stdio.h> int main(){ int menu[5]; int i ; int burger_min = 2001; int drink_min = 2001; for(i = 0 ; i < 3 ; i ++){ scanf("%d", &menu[i]); if((menu[i] > 99 && menu[i] < 2001) && burger_min > menu[i]) burger_min = menu[i]; } for(;i < 5 ; i++){ scanf("%d", &menu[i]); if((menu[i] > 99 && me...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* print_u_hex.c :+: :+: :+: ...
C
#include "holberton.h" /** * rev_string -function that reverse a string. * @s: char array string type * */ void rev_string(char *s) { int frase, cont, aux; char h; for (frase = 0; s[frase] != '\0'; frase++) ; aux = frase; for (frase--, cont = 0; cont < aux / 2; frase--, cont++) { h = s[cont]; s[cont]...
C
//Specify compiler to use GLSL version 1.2 //Enable working with textures of any dimensions //Declare texture texture0, which is linked when you use fbo.bind(), or any other texture.bind(). //#version 430 compatibility #version 120 #extension GL_ARB_texture_rectangle : enable #extension GL_EXT_gpu_shader4 : enable un...
C
/* * Copyright 2020 New Relic Corporation. All rights reserved. * SPDX-License-Identifier: Apache-2.0 */ #include "util_slab.h" #include <unistd.h> #include "util_logging.h" #include "util_memory.h" #include "util_slab_private.h" static nr_slab_page_t* nr_slab_page_create(size_t page_size, ...
C
#include "cmd.h" #include "builtin.h" #include <stdio.h> #include <unistd.h> #include <string.h> #include <errno.h> #include <stdlib.h> //richard tran & alexandra zhang /** * wrappers for the exit and chdir function */ int call_exit(char * status){ if(status == NULL) exit(0); exit(atoi(status)); return 0; }//...
C
/* * C Reusables * <http://github.com/mity/c-reusables> * * Copyright (c) 2017 Martin Mitas * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without li...
C
#pragma once #include <stdbool.h> #include <stddef.h> #include <stdint.h> // initialize i2c interface // TODO: configuration bool i2c_master_init(void); // write `len` bytes from `buf` to i2c device with slave address `device` starting at `reg` bool i2c_master_write(const uint8_t device, const uint8_t reg, const voi...
C
#include "rand.h" unsigned int x = 1; //unsigned int tmp; /* Return a random integer between 0 and XV6_RAND_MAX inclusive. NOTE: If xv6_rand is called before any calls to xv6_srand have been made, the same sequence shall be generated as when xv6_srand is first called with a seed value of 1. */ int xv6_...
C
#include "can.h" // traite le message de recherche de donnee bool traiter_requete_recherche_valeur(int nd_init, int x, int y){ if(point_dans_zone(x, y) == true){ // si s'est moi qui devrait avoir la donnee int msgUseless[LEN_MAX_MSG]={0}; msgUseless[0]= nd_init; donnee * tmp_don; if((tmp_don =get_donne...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "my_string.h" #define OK 0 #define INPUT_ERROR 1 #define OUTPUT_ERROR 1 int split_line(const char *line, char (*words_array)[MAX_WORD_LEN], int *const word_count) { char separators[] = ",;:-.!? \n\0"; *word_count = 0; char *istr = strt...
C
# include <stdint.h> # include <stdio.h> # include <stdlib.h> # include <unistd.h> # include <sys/types.h> # include <sys/stat.h> # include <fcntl.h> # include <stdbool.h> # include <getopt.h> # include <errno.h> # include "queue.h" # include "stack.h" # include "huffman.h" # define MAGICNUM 0xdeadd00d # define BUFFSZ ...
C
#include <stdio.h> #include <unistd.h> #include <string.h> #include <errno.h> #include <netinet/in.h> #include "../core/core.h" #include "misc_event.h" #include "misc_connection.h" static int misc_fd; static fd_set fd_sets; int misc_loop = 1; int set_select_sets() { FD_ZERO(&fd_sets); FD_SET(misc_fd, &fd_...
C
// 043 希尔排序 #include <stdio.h> // #define CLS_AND_GETCH // 需要清屏+按键退出就取消此行的注释 #include "../000-inc/inc.h" #define MAX 255 // 希尔排序中的一趟排序,d 为当前增量 // 采用插入排序 void ShellPass(int R[], int d, int n) { int i, j; for (i = d + 1; i <= n; i++) // 将 R[d+1..n] 分别插入各组当前的有序区 if (R[i] < R[i - d]) { ...
C
#include <stdio.h> #include <string.h> #include <malloc.h> #define THINGS struct list THINGS{ int numOfThing; THINGS* next; }; void popStack(THINGS*top){ THINGS* delElem; delElem = top -> next; top -> next = top -> next -> next; printf("%d ", delElem -> numOfThing); free(delElem); } ...
C
/* * KeypadEpaper_Thread.c * * Created on: Apr 28, 2019 * Author: Khalid AlAwadhi */ #include "KeypadEpaper_Thread.h" //Standard includes #include <stdio.h> #include <stdlib.h> #include <string.h> #include <mqueue.h> #include <unistd.h> #include <errno.h> //My includes #include "Global_Defines.h" #include...
C
#include <stdio.h> int main(){ int i=1, sum=0; while (i<=100){ sum=sum+i; i++; } printf("sum=%d\n", sum); return 0; }
C
#include "mmap_utils.h" void* createEmptyFilemmap(char* filename, size_t file_size) { void* mmap_ptr; int fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, (mode_t)0600); if (fd == -1) { printf("COULDN'T OPEN FILE!\n"); return NULL; } uint8_t* zero_buf; zero_buf = calloc(4096, sizeof(uint8_t)); int write_re...
C
/***************************************************** * * file d:\cips\delas.c * * Functions: This file contains * main * display_image_portion * read_string * read_image * my_read ...
C
#include <stdio.h> void ft_putstr_non_printable(char *str); int main(void) { char str1[] = "Coucou\ntu vas bien ?"; printf("s1 before converting : %s\n", str1); ft_putstr_non_printable(str1); return 0; }
C
// Filename: interpolation.h // Date created: 09 May 2013 // Last Modified: 03 Jun 2013 (16:02:08) // // Brief: Headerfile for all the methods for the exercise // Input: // Output: // // License: copyleft // Original Author: // Author: Yang Min Wang (ymwang@chem.au.dk) #ifndef LIB_H typedef struct { int n; double *...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> #include <signal.h> void handler(int signum, siginfo_t *info, void *extra) { void *ptr_val = info->si_value.sival_ptr; int int_val = info->si_value.sival_int; printf("Sum=...
C
#include <stdio.h> #include <string.h> #include <zephyr.h> #include <lte_lc.h> #include <net/mqtt.h> #include <net/socket.h> // Simplistic test app // Initialize and connect modem + disable eDRX and PSM // Send a udp message on the form "MsgId <counter>" in a set interval // Use netcat (nc -uvkl <port number>) as ser...
C
/* ** EPITECH PROJECT, 2019 ** PSU_my_ls_2019 ** File description: ** No file there, just an epitech header example */ #include<sys/stat.h> #include<sys/types.h> #include<time.h> #include<stdio.h> #include<unistd.h> #include"lib/my/my.h" #include<stdlib.h> #include<sys/sysmacros.h> int flag_l(struct stat buf, int *fl...
C
/* * 建立TCP server 并发服务器 * 接受客户端发来的字符串并打印 * BY zhang90 * 2011-8-4 */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <pthread.h> #include <netdb.h> #include <poll.h> #define MAXLI...
C
// Part A int elevena (int** PIC1, int numRows, int numCols, int Value1) { int i, j; counter = 0; for (i = 0; i < numRows; i++) { for (j = 0; j < numCols; j++) { if (PIC1[i][j] == Value1) { counter++; } } } ...
C
#include <stdio.h> #include <mpi.h> int main(int argc, char * argv[]) { int myrank, nprocs; MPI_Init(&argc, &argv); MPI_Comm_size(MPI_COMM_WORLD,&nprocs); MPI_Comm_rank(MPI_COMM_WORLD, &myrank); printf("rank %d of %d:Hello,world!\n",myrank, nprocs); MPI_Finalize(); return 0; }
C
// Change the shape of the joystick signal to give better control for small signals // Between 0 and 80 the slope is 1/2. // Between 80 and 115 the slope is 1. // Between 115 and 128 the slope is 2. int jsShape(int Jstick){ int out = 0; int absoluteJstick = 0; absoluteJstick =abs(Jstick); //Work with positive num...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/un.h> #include <errno.h> #define SOCKNAME "./mysock" #define N 100 #define N_CLIENTS 4 int aggiorna(fd_set *set, int old_fd_num){ int i; int max= old_fd_num; for(i...
C
/* This is the function for which it is desired to find more efficient code. It must have either one or two arguments, both int, and must return a 32-bit int quantity. It is declared in aha.h. */ #include "aha.h" int userfun(int x) { // if (x > 0) return 1; // x > 0 predicate. // else return 0; ...
C
#include <stdio.h> #include <string.h> int dp[1234][1234]; inline max(int a, int b) { return a > b ? a : b; } int main() { char A[1234], B[1234]; scanf("%s %s", A, B); int n = strlen(A); int m = strlen(B); for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (A[i - 1] == B...
C
#include<stdio.h> void main() { int a,b,c; char even,odd; printf("Enter the two numbers:"); scanf("%d%d",&a,&b); c=a+b; { printf("%d",c); } if(c%2==0) { printf("Number is even",even); } else { printf("Number is odd",odd); } }
C
/* * Areeb Jamal * A1A - 049 (First Year) COBT * 2014-15 */ /* * Week 2 * Home Work * * Program 3(a) : Make a program to swap 2 numbers using a third variable. * */ #include <stdio.h> #include <conio.h> void main(){ float a, b, temp; //Defining 3 variables. a, b and a 3rd variable for temporarily storing...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sys/ipc.h> #include <sys/shm.h> #include "chatshm.h" int main() { int shmid; CHAT_INFO *chatInfo = NULL; void *shmaddr = (void*) 0; shmid = shmget((key_t)SHARED_MEMORY_KEY, sizeof(CHAT_INFO), 0666|IPC_C...
C
#include <stdio.h> #include <unistd.h> #include <stdlib.h> int doccomand(char* command) { int pid; switch(pid=fork()) { case -1: return -1; case 0: execl("/bin/sh","sh","-c",command,NULL); exit(127); default: wait(NULL); } return 0; } int main() { int pid; /*...
C
#include<stdio.h> #include<netdb.h> #include<netinet/in.h> #include<stdlib.h> #include<string.h> #include<unistd.h> #include<sys/socket.h> #include<sys/types.h> #define MAX 80 #define PORT 8080 #define SA struct sockaddr //Function designed for chat between client and server void func(int sockfd) { char buff[MAX];...
C
#include<stdlib.h> #include<stdio.h> #include "../inc/des.h" void Des(bit64* out, bit64 *in, bit64* key, int total_bytes, int Algo_t ,int mode) { int packet_n = total_bytes/8 + !!(total_bytes % 8); bit64 fill_bytes = 0x0; if(total_bytes%8) for(int i = 0; i < 8-total_bytes%8; i++){ fill_...
C
#include "state.h" #include "alarm.h" #include "utils.h" #include "bstuffing.h" #include <unistd.h> #include <stdio.h> #define FAILED -1 #define RE_SEND_RR -2 #define RE_SEND_SET -3 static volatile int STOP_UA=FALSE; static volatile int STOP_SET=FALSE; static volatile int STOP_DISC=FALSE; static volatile int STOP...
C
#include <stdio.h> #include <time.h> #include<stdlib.h> // #include "q2.c" #define n 1000000 void merge_sort(int *arr, int left, int right); int main() { int arr[n]; // now we generate an array of random numbers and the pass it for further testing for(int i = 0 ; i< n; i++) arr[i] = n - i; ...
C
#include <stdio.h> int main() { long int n; //vấn đề là kiểu int không thao tác được với số đủ lớn nên cần khai báo long int scanf("%ld", &n); //định dạng nhập và xuất kiểu long int là "%ld" if(n>=3) printf("%ld", n*(n-1)*(n-2)/6); }
C
//#include <stdio.h> // //int dp[1001]; //int arr[1001]; //int Max(int a, int b) //{ // if (a < b) // return b; // else // return a; //} //int main() //{ // int N; // int cnt=0; // int max = 0; // scanf("%d", &N); // for (int i=1; i <= N; i++) // { // scanf("%d", &arr[i]); // for (int j = 0; j <= i; j++) // { // ...
C
// Last Update:2018-09-04 15:05:07 /** * @file dbg.c * @brief * @author liyq * @version 0.1.00 * @date 2018-09-03 */ #include <stdio.h> #include <stdarg.h> #include <string.h> #include <time.h> #include <errno.h> #include <sys/time.h> #include <unistd.h> #include "dbg.h" #include "socket_logging.h" #include "lo...
C
#include<stdio.h> #include<string.h> int existe(char* s, char c){ int i=0; while(i<strlen(s)) { if(s[i]==c) return(1); i++; } return 0; } void deleteCaracOfOtherString(char* s1, char* s2) { int i = 0; while (i<strlen(s1)){ if(existe(s2, s1[i])){ strcpy(s1+i,s1+i+1); } else { i++; } } } int ...
C
/* https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface */ #include "io.h" #include "mbox.h" #include "util.h" int mbox_call(unsigned int* mbox, unsigned char chan){ unsigned int r = (((unsigned int)((unsigned long)mbox)&~0xF) | (chan&0xF)); while(get32(MBOX_STATUS) & MBOX_FULL) __asm__ vol...
C
/****************************************************************************** 8915 OUTPUT LIMIT REACHED *******************************************************************************/ #include <stdio.h> int input = 0; //getinput and call print method. Loops until a negative is entered. vo...
C
#include"typedef.h" #include"tools.h" #include"matrix.h" #include"getput.h" #include"longtools.h" int main (int argc, char *argv[]) { matrix_TYP **M; int Manz, i, j, k, n, /* the numerator */ d, /* the denominator */ ggt; extern char **FILENAMES; c...
C
#include <stdlib.h> #include "list.h" int list_size(List *list); int add_node_end(List **list, char *content); int add_node_beg(List **list, char *content); char *string_copy(char *dest, const char *src); int list_size(List *list); /*creates a node and then inserts it in a list at a specific index*/ int insert_in_list...
C
#include <msp430x20x2.h> #include <signal.h> #include <stdint.h> #include <stdlib.h> #include "uart_rxtx.h" // #define DEBUG 0 // #define TIMERCLK TASSEL_1 #define TIMERCLK TASSEL_2 #define STOPBIT BIT7 static volatile uint8_t bitCount; // Bit count, used when transmitting byte static volatile uint16_t...
C
#include <stdio.h> int main (int argc, char** argv) { int x1, x2, x3; x1=sizeof(char); x2=sizeof(int); x3=sizeof(float); printf("%d %d %d",x1,x2,x3); }
C
//******** print.c ******** /* James Jessen Group #1 * 10918967 Seq. #4 * * CptS 360 * Lab #2 */ #include "print.h" int rpu(u32 x, u32 base) { static char *table = "0123456789ABCDEF"; char c; if (x){ c = table[x % base]; rpu(x / base, base); putchar(c); } } // S...
C
#include<stdio.h> int main() { FILE *song; if((song=fopen("myfile.txt","r")) != NULL ){ printf("open file\n"); } //fprint(song ,"Hellow world"); fclose(song); return 0; }
C
#include <stdio.h> int main(void) { float peso; printf("Digite o peso de uma pessoa:\n"); scanf("%f", &peso); printf("Se a pessoa engordar, seu novo peso será: %.2f\n", peso*1.15); printf("Se a pessoa emagrecer, seu novo peso será: %.2f\n", peso*0.8); return 0; }
C
/****************************************************************************** * Copyright (C) 2018 by Ashraf Abdalraheem * * Redistribution, modification or use of this software in source or binary * forms is permitted as long as the files maintain this copyright. Users are * permitted to modify this and use it ...
C
#include <mpi.h> #include <stdio.h> int main(int argc, char** argv){ MPI_Init(NULL, NULL); int trial_runs = 10; int data = 100; int i; double total_bcast_time = 0.0; for(i= 0; i< trial_runs; i++){ //Before calling bcast , you will call MPI_Barrier MPI_Barrier(MPI_COMM_WORLD); total_bcast_time -=MPI_Wtime();...
C
#include <stdio.h> #include <stdlib.h> int binsearch(int *jack, int lenjack, int cdjill){ int lower = 0; int upper = lenjack-1; int middle; while(lower <= upper){ middle = (lower+upper)/2; if(cdjill>jack[middle]){lower = middle+1;} else if(cdjill<jack[middle]){upper = middle-1;} else{return 1;} } return ...
C
#include <stdio.h> int main() { int num, antecessor, sucessor; printf("Informe um número: "); scanf("%d", &num); antecessor = num - 1; sucessor = num + 1; printf("\nO antecessor é: %d", antecessor); printf("\nO sucessor é: %d", sucessor); return (0); }
C
// Sample input 2, in CPP. #include <cassert> int NumberOfPeaks() { return 3; } int GetHeight(long long i) { switch ((int)i) { case 0: return 2; case 1: return 2; case 2: return 2; default: assert(0); } }
C
#include <stdio.h> int main(void) { int num = 1234; printf("size of num: %d \n\n", sizeof(num)); printf("size of 1234: %d \n", sizeof(1234)); printf("size of 1234.0: %d \n", sizeof(1234.0)); printf("size of 0.1234: %d \n\n", sizeof(0.1234)); printf("size of char: %d \n", sizeof(char)); printf("size of short: ...
C
/* * Enchant * Doppleganger spell to enchant a piece of armor for 80sp * Rumplemintz */ int main(string str) { object ob; string pre, post; if ((int)this_player()->query_guild_rank() < 12) { write("You are not high enough level to do that.\n"); return 1; } if ((int)this_player()->query_sp() < 8...
C
#include <cuda.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <omp.h> #include "common.h" /* report and bail if the exit code from a CUDA function ("result") is not succesful */ void checkCuCall(const char *funcname, CUresult result) { if (result != CUDA_SUCCESS) { printf("Call %s failed...
C
#include <stdio.h> int main() { int i; int counter = 0; for (i = 0; i < 6; i++) { double val; scanf("%lf", &val); if (val > 0) counter++; } printf("%d valores positivos\n", counter); return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* exit.c :+: :+: :+: ...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #define MAXROW 10 #define MAXLENGTH 10 /** 键盘输入10行英文字母,每行字母最大长度为10, 先在行内排序,即按照a-z的顺序排序 然后在行与行之间排序,按每一行的首字母排序 **/ int main() { char *input[MAXROW]; //Input text to be sorted from the keyboard printf("please input %d line text\n",MAXROW); int j=0,i=0; for...
C
#define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <math.h> #include <assert.h> #include "ass4.h" #define SIZE 8 const char FIRST_COL = 'a'; // FEN & Board characters const char WHITE_PAWN = 'P'; const char WHITE_ROOK = 'R'; const char...
C
/* *This program goes through every prime number until it gets to the 10001'th prime *Written By: Joshua Newell *8/5/13 */ #include <stdio.h> int primeCheck(int i); int main(){ int numberprimes=6; int i=14; while(numberprimes < 10001){ // printf("i = %d\n", i);//debug if (primeCheck(i) == 1){ // p...
C
#include <stdio.h> int main(){ int cases,casecnt,i; char inp[30]; long long p,q,temp; long double P,Q,frac,partfrac; scanf("%d",&cases); for(casecnt=1;casecnt<=cases;casecnt++){ scanf("%s",inp); sscanf(inp,"%I64d/%I64d",&p,&q); temp=1; for(i=0;i<11;i++){ if(q==temp) break; temp<<=1; ...
C
#include <stdio.h> #include <assert.h> #include <stdbool.h> #define size(x) (sizeof(x)/sizeof(*x)) #define max(a,b) ((a)>(b)?(a):(b)) #define abs(x) ((x)>0?(x):(-(x))) #define DOF 2 #define MAX_PRIM 500 typedef struct { double disp[DOF]; // displacement caused by the primitive double vel[DOF][2]; // start and end ...
C
#include <stdio.h> #include "../trunk/moteur.h" #include "../trunk/constantes.h" int main(int argc, char* argv[]) { initialiser_partie(); int depart, arrivee; do { commencer_tour(); do { hint_pions_jouables(); print_plateau(p_jeu); printf("Entrez la case de départ en notation officielle : "); scanf...