language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C |
#include "dataout.h"
uint8_t put_in_string(int16_t number, char letter, uint8_t place)//place is 4 digit spotplus 2 for something else, count from right
{
//
//'place' is the target place for the next character
//
//
char temps[5] = "\0\0\0\0\0";//temporary spot for the number to add to the big string
if (num... |
C |
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <emscripten.h>
// number of circles to create and animate
#define NUM_CIRCLES 200
struct Circle {
int x; // y coord
int y; // x coord
int r; // radius
int cr; // color red
int cg; // color green
int cb; // color blue
};
// ... |
C | #include <stdio.h>
int main(void)
{
int n, k; // n : ũ, k : ݺ
int arr[101] = { 0 };
int s, e, u;
int sum = 0;
scanf("%d %d", &n, &k);
for (int i = 1; i <= k; i++)
{
scanf("%d %d %d", &s, &e, &u);
arr[s] = arr[s] + u;
arr[e + 1] = arr[e + 1] - u;
}
for (int i = 1; i <= n; i++)
printf("%d ", arr[i])... |
C | /**
* @file bitwise_calculator.c
* @author 260756 (basitahmad4@gmail.com)
* @brief Functions to perform Bitwise AND, Bitwise OR, Bitwise XOR , Bitwise NOT, Left shift and Right Shift on decimal integers
* @version 0.1
* @date 2021-04-12
*
* @copyright Copyright (c) 2021
*
*/
#include "stdlib.h"
#include<stdi... |
C | #include<stdio.h>
#include<math.h>
int main(){
int x(int y){ return (1+pow(-1,y))/2;}
for(int i=0;i<12;i++){
printf("%i\n",x(i));
}
return 0;}
|
C | #include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while (t--){
int a[50];
int n,i,j,d=0;
scanf("%d",&n);
for (i=0;i<n;i++)
scanf("%d",&a[i]);
for (i=0;i<n;i++){
int x=0;
for (j=i;j>=0;j--)
if(a[i]<a[j]) x++;
... |
C | #include "common.h"
int main(int argc, char **argv)
{
double elapsedTime;
int pid;
int psize;
unsigned long long int n;
unsigned long long int low_value, high_value;
unsigned long long int size, proc0_size;
char *marked;
unsigned long long int i, index, first;
unsigned long long int... |
C | #include<stdio.h>
int main(){
int a,b,c,x,n,i;
printf("enter starting limit");
scanf("%d",&a);
printf("enter end limit");
scanf("%d",&b);
n=a;
printf("Prime numbers: ");
while(n<=b)
{
c=0;i=1;
while(i<=n)
{
x=n%i;
if(x==0)
c=c+1;
i++;
}
if(c<=2)... |
C | /*
* block and recursion algorithm for rotate a array.
*
* ./a.out <sequence> <step>
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
static void shift(char *, int, int, int);
static void swap(char *, char *, int);
int main(int argc, char *argv[])
{
if (argc != 3) {
fputs("./a.out <sequence> <step... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* lemin.c :+: :+: :+: ... |
C | /*
* patchmem(1)
* - Rewritten to use mmap(2) instead of read(2), lseek(2), write(2)
* - syncs PAGE_SIZE at a time
* - Disable your kernel's STRICT_DEVMEM setting.
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
#include <strings.h>
#include... |
C | #include<stdio.h>
#include<stdlib.h>
#include<ncurses.h>
#include<pthread.h>
#include<time.h>
#include"pbm.h"
#define MORTA 0
#define VIVA 1
#define SUPERLOT 3
#define SOLIDAO 2
#define FPS 3.0
#define CHAR 10
#define MAXTHREADS 5
#define MAX_COL 600
#define MAX_LIN 50
/**
* Estrutura de argumentos de uma thread
*... |
C | #include<stdio.h>
#include<conio.h>
int main()
{
int base,pow,i=1,sum=1;
printf("enter the base");
scanf("%d",&base);
printf("enter the pow");
scanf("%d",&pow);
while(i<=pow)
{
sum=sum*base;
}
printf("the power of a number is %d",base);
return 0;
}
|
C | #include <stdio.h>
int main(int argc, char** argv) {
int enteros[45];
double flotantes[5];
int* p = enteros + 4;
printf("Tamano del entero: %lu\n", sizeof(int));
printf("Tamano del array enteros: %lu\n", sizeof(enteros));
printf("Tamano del float: %lu\n", sizeof(double));
printf("Tamano d... |
C | #include<stdio.h>
//#include<conio.h>
#include<string.h>
struct employee{
int empid;
char name[20];
struct date{
int dd;
int mm;
int yyyy;
}doj;
}emp;
void main(){
emp.empid=101;
strcpy(emp.name,"shayli patil");
emp.doj.dd=18;
emp.doj.mm=9;
emp.doj.yyyy=2017;
printf("\nEmployee ... |
C | #include <stdio.h>
int main(int argc, char *argv[]) {
printf("Hello World\n\n");
for (int i=0; i<argc; i++)
printf("argv[%i] = %s\n",i,argv[i]);
}
|
C | #include<stdio.h>
#include<stdlib.h>
void rotate(char matrix[10][10]){
if(matrix!=NULL){
char rotMatrix[10][10];
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
rotMatrix[j][10-1-i]=matrix[i][j];
}
}
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
matrix[i][j]=rotMatrix[i][j];
}... |
C | // prob8-16.(難易度★★★)(並べ替え)
// 長さ10の整数の配列を作成し、各々の中に1から100までの乱数を代入し、その数を大きい順番に並べ替えて表示しなさい。なお、並べ替えの方法としては、以下の方法を用いなさい。
// ① 配列の中から、最大の数を探し出す。
// ② ①で見つけた数と、配列の最初の数を入れ替える。
// ③ 次に、配列の2番目から最後の中でもっとも大きな数を見つけ出す。
// ④ ③で見つけた数と、配列の2番目の数を入れ替える。
// ⑤ これを最後10番目まで繰り返す。
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int ... |
C | /*greedy method of choosing the largest square closer to N will not work
examle:
149=12^2+2^2+1^2=7^2+10^2;
*/
#include<stdio.h>
#include<math.h>
#define INF 15000;
int min_sqr[10002];
int square(int N)
{
double tmp;
int i,ans=INF;
if(min_sqr[N]!=15000)
{
return min_sqr[N];
}
tmp=sqrt(N);
... |
C | #include "../server.h"
/* windows socket program */
void
startServer(){
WORD wVersionRequested;
WSADATA wsaData;
int ret, nLeft, length;
SOCKET sListen, sServer;
struct sockaddr_in saServer, saClient;
char *ptr;
wVersionRequested = MAKEWORD(2,2);
ret = WSAStartup(wVersionRequ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strsub.c :+: :+: :+: ... |
C |
#include "rb.h"
#include <stdio.h>
void rb_shownode ( root, level, x, p, private )
Arr *root ;
int level ;
Rb_node *x ;
void (*p)() ;
void *private ;
{
printf ( "\nLevel %2d Rb_node %8x\n", level, (unsigned int)x ) ;
printf ( "\t%s\n", x->red ? "Red" : "Black" ) ;
printf ( "\tLeft: %8x\n", (unsigned... |
C | #include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <time.h>
int randomRange(int _min, int _max){
int result = 0;
int low_num = 0;
int hi_num = 0;
if(_min < _max){
low_num = _min;
hi_num = _max + 1;
}else{
low_num = _max + 1;
hi_num = _min;
}
... |
C | #include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <sys/time.h>
#include <time.h>
// Init counter, seconds, microseconds.
static int c = 0;
double ms = 0;
int seconds;
// A handler for info printing.
void handler(int code) {
fprintf(stderr, "... |
C | #include <stdlib.h>
#include "tournament.h"
#include "game.h"
#include "player.h"
struct tournament_t
{
int id;
int max_games_per_player;
const char* location;
bool finished;
int tournament_winner_id;
int num_different_players;
Map game_list;
};
/*make a copy of tournament_location and... |
C | #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<time.h>
void func(int tedad,int ragham){
int i,j,k=0,no=0,number,lower,upper,voroodi,m;
float kfloat,tedadfloat;
upper=pow(10,ragham)-1;
lower=pow(10,ragham-1);
int x[tedad];
srand(time(0));
for (m=1;m<=5;m++){
for (i=0;i<tedad;i++){
x[i]=(rand()... |
C | #include <unistd.h>
int ft_strlen(char *str)
{
int i;
i = 0;
while (str[i])
i++;
return (i);
}
void print_word(char *str)
{
while (*str != ' ' && *str)
write (1, str++, 1);
write (1, "\n", 1);
}
int main(int argc, char **argv)
{
int len;
if (argc == 2)
... |
C | #include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<string.h>
#define UID 0
#define GID 0
#define R "\e[31m"
#define G "\e[32m"
#define Y "\e[33m"
#define N "\e[39m"
#define LR "\e[91m"
#define LG "\e[92m"
// Maximum 8 hexadecimal digits for KEY
#define KEY 0x0
// NX bit on, Canary enabled
void penetr... |
C | #include <stdio.h>
#include <stdlib.h>
int fibbo(int n);
int main()
{
int n ;
scanf("%d",&n);
for(int i = 0 ; i <= n ; i++)
{
printf("%d \t" ,fibbo(i));
}
return 0;
}
int fibbo(int n)
{
if( n == 0)
{
return 0;
}
if( n == 1)
{
return 1;
}
... |
C | #include <stdio.h>
struct person {
char name[20];
char pID[20];
struct person* frnd;
};
int main(void)
{
struct person man1 = {"Mr. Lee", "820204-0000512"};
struct person man2 = {"Mr. Lee's Friend", "820000-0000101"};
man1.frnd = &man2;
printf("[Mr. Lee]\n");
printf("name : %s \n"... |
C | /* CS 370
Project #2
Gerardo Gomez-Martinez
September 16, 2014
Program acts as a Linux terminal shell. It prints a prompt containing the current working
directory and waits for user input. It accepts commands from the user and executes until
the user exits the shell. Also accepts the chnage director... |
C | #include<math.h>
#include<stdio.h>
#include<ctype.h>
#include<stdlib.h>
#include<string.h>
#define N 256
int main(){
char str[N];
int i;
printf("Digite a frase :");
fgets(str,N,stdin);
for(i=0; i<strlen(str); i++){
if(str[i]<78&&str[i]>65)
{
str[i]=(str[i]+13);
}
else
{
if((str[i]>78 && str[i]<90))
str[i]=(str[i]-1... |
C | /*
** EPITECH PROJECT, 2018
** my put number
** File description:
** display number give on parameter
*/
int my_put_hexa_adress(int nb);
void my_putchar(char c);
int my_putstr(char const *str);
int tour = 0;
int nb_special_hexa_adress(long nb)
{
tour = 1;
my_put_hexa_adress(nb / 16);
my_put_hexa_adress(nb ... |
C | #ifndef _LED_H_
#define _LED_H_
/**
\file led.h
\brief
\author tyranno
\warning
\date 2012/10/10
*/
/*Revision history ******************************************
*
* Author :
* Dept :
* Revision Date :
* Version :
*
*/
#ifdef __cpl... |
C | #define EXPORT_OPS
#include "interpreter.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdbool.h>
#include <inttypes.h>
int daily_run_bytecode(DailyOp* operations) {
#if defined(_MSC_VER) || defined(DAILY_USE_SWITCH)
#define OP_SWITCH while (true) switch (operation->operation)
#define ... |
C | #include<stdio.h>
#include<time.h>
int a[10][10];
int count=-1,n;
int reach[50],pos[50];
void read_matrix()
{
int i,j;
printf("Enter the adjacency matrix(enter 0/1)\n");
for(i=1;i<=n;i++)
for(j=1;j<=n;j++)
if(i!=j)
{
printf("%d,%d:",i,j);
scanf("%d",&a[i][j]);
}
}
void dfs(int v)
{
int u;
reach[++count]=... |
C | /*This time let us consider the situation in the movie "Live and Let Die" in which James Bond, the world's most famous spy, was captured by a group of drug dealers. He was sent to a small piece of land at the center of a lake filled with crocodiles.
There he performed the most daring action to escape -- he jumped onto... |
C | #include <stdio.h>
#include <omp.h>
#define SIZE 1000
int A [SIZE][SIZE];
int B [SIZE][SIZE];
int C [SIZE][SIZE];
int D [SIZE][SIZE];
int R [SIZE][SIZE];
void populate(int A[SIZE][SIZE])
{
for (int i = 0; i < SIZE; i++)
{
for (int j = 0; j < SIZE; j++)
{
A[i][j] = 1;
}
}
}
int main(){
popul... |
C | #include <stdio.h>
int main()
{
int arr[9] = { 1,2,3,4,5,6,7,8,9 };
for (int i = 8; i >= 0; i--)
{
printf("%2d",arr[i]);
}
} |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <unistd.h>
#include <netinet/in.h>
int main(int argc, char *argv[])
{
/**
* How a FTP client application works
* First a socket is created
* Then the client establishes a con... |
C | #include <stdio.h>
#include <contiki.h>
#include <dev/button-sensor.h>
#include <dev/leds.h>
PROCESS(timer_process, "timer process");
AUTOSTART_PROCESSES(&timer_process);
PROCESS_THREAD(timer_process,ev,data)
{
PROCESS_BEGIN();
SENSORS_ACTIVATE(button_sensor);
leds_off(LEDS_GREEN);
leds_on(LEDS_RED);
printf... |
C |
#include <stdio.h>
#include <assert.h>
#include "p2.h"
/*
* Test program for a circular doubly linked list.
*/
int main ( ) {
node * head = 0;
add_to_front('O', &head);
print_list(head);
add_to_front('S', &head);
print_list(head);
add_to_front('C', &head);
pr... |
C | /*
* io.c
*
* Created: 06.09.2019 10:13:09
* Author: Ole Sivert
*/
#include <avr/io.h>
#include "io.h"
#include "adc.h"
#include "../compact_math.h"
/* Returns the value of the given button */
uint8_t get_button(uint8_t button) {
uint8_t i = PINB;
return (i >> button) & 1;
}
/* Method to read the current sta... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* rotation.c :+: :+: :+: ... |
C | #ifndef __TVECTOR_ELEMENT_H__
#define __TVECTOR_ELEMENT_H__
/** \file TVectorElement.h
* \brief Definice typu Basic VectorElement a implementace API
* \author Petyovský
* \version 2021
* $Id: TVectorElement.h 1023 2021-02-08 09:42:15Z petyovsky $
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
... |
C | #include <stdlib.h>
#include <stdbool.h>
#include "cval.h"
#include "util.h"
cval *_make_map_(int len)
{
cval *cval = alloc(cval);
_set_type(cval, t_map);
_zero(&(cval->v_map));
_init_map(&(cval->v_map), len);
return cval;
}
void _init_map(map *m, int len)
{
m->len = m->factor = len;
if (l... |
C | /*
** SkyShaders.c
**
** Functions that shade rays that enter the sky.
**
** 18 Aug 1992 - Created - J. Terrell
*/
#include "headers/tracer.h"
/* skyshader_simple() ; simple single color background */
void skyshader_simple(struct Ray *ray)
{
ray->ci[0] = gl_env->BackDropColor[0];
ray->ci[1] = gl_... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <signal.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <termios.h>
int pid; //mufide lal control -c
void init()
{
printf("\n\n\n\n******************"
"**************... |
C | #include<stdio.h>
#include<stdlib.h>
struct process
{
int pid ;
int at ;
int bt ;
int wt ;
int ct ;
int tat ;
};
int findWaitingTime(struct process *A , int n)
{
int sum = 0 ;
for(int i = 0 ; i < n ; i++)
{
A[i].wt = A[i].tat - A[i].bt ;
sum = s... |
C | /*
* Program to implement basic operations on stack
* Compilation: stack_program.c
* Exicution: ./a.out
*
* @Sahil Bhatiwal (1910990683) , 2- 08- 2021
* Assignment: Day2_coding_Assignment (Quesiton 1);
*
*/
#include<stdio.h>
//push(insertion ) function
void push(int arr[], int *top) {
int n;
printf("En... |
C | /*
* segmentize.c
*
* Created on: 10 aug 2012
* Author: Wolftower
*
* Description
* This library implements a function that segments
* chromosome/substring files into smaller chunks
*/
#include "segmentize.h"
void seq2chunks(char* sequence, char* seqHeader, char* outputDir, const char* nopathFil... |
C | #include <stdio.h>
#include <string.h>
char code[10];
void putcode();
int main()
{
#ifndef ONLINE_JUDGE
freopen("11223_O dah dah dah!_01.inp","r",stdin);
#endif
int t, i;
char c, l;
scanf(" %d ",&t);
for(i=1; i<=t; ++i)
{
if(i>1) putchar('\n');
printf("Message #%d\n"... |
C | #include <stdio.h>
#include <stdlib.h>
int main()
{
int sayi;
printf("Hello world!\n");
printf("Merhaba canim\n");
printf("heycorversenebor");
printf("sayi syle bana\n");
scanf("%d",&sayi);
printf("girdiginiz sayiyi begendim.\n");
return 0;
}
|
C | /* See LICENSE file for copyright and license terms. */
/* file.h: dealing with entire files. */
#ifndef EPAI_FILE_H
#define EPAI_FILE_H
/* to be used for byte buffers; text strings should use regular char type */
typedef unsigned char epai_byte_t;
typedef enum {
EPAI_ENDIAN_NATIVE,
EPAI_ENDIAN_LITTLE,
EPAI_E... |
C | /* Comentario de
varias lineas */
// Esto es un comentario de un a linea
int x;
int y;
char c;
void mult(){
int z;
x = 2;
y = 3;
z = x * y;
printf("El resultado es %d", z);
}
char x;
void rest(){
int z;
x = 2;
y = 3;
z = x - y;
printf("El resultado es %d", z);
}
|
C | #include "ft_library.h"
char * ft_strjoin(char const *s1, char const *s2){
int s1_len = ft_strlen(s1);
int s2_len = ft_strlen(s1);
char * join_str = (char *)malloc((s1_len + s2_len +1) * sizeof(char));
if (join_str == NULL)
return NULL;
ft_strcpy(join_str, s1);
ft_strcpy(&join_str... |
C | struct Rectangle{
int length;
int breadth;
};
int main(){
struct Rectangle r; /*declaration*/
struct Rectangle r={10,5}; /*initialization*/
r.length = 15;
r.breadth = 10;
printf("Area of Rectangle is %d", r.length*r.breadth);
struct Rectangle *p=&r;
/*Two ways... |
C | // Example from Cousot Habwachs POPL 1978
// Heap sort, where array operations are abstracted away
// to get a non-deterministic scalar program
// expected results: with polyhedra, no assertion failure
int L,R,I,J;
int N = rand(1,100000); // array size
L = N/2 + 1;
R = N;
if (L >= 2) {
L = L - 1;
// model t... |
C | #include "barrier.h"
#include "qsim_magic.h"
#include <stdatomic.h>
#include <stdlib.h>
#define KB(x) ((x) << 10)
#define MB(x) (KB(x) << 10)
#define size MB(16)
#define QSIM_ENABLE 1
#define CACHE_LINE_SIZE 64
int main()
{
unsigned long max_idx = size / sizeof(atomic_int);
atomic_int *array;
array = (atomic_in... |
C | #include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
int main()
{
int fd = open ("data.txt", O_RDWR | O_CREAT | O_TRUNC, 0666);
if (fd == -1)
{
perror ("open");
exit (EXIT_FAILURE);
}
struct flock lock;
... |
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 <stdio.h>
#include <stdlib.h>
#define NUM 6
void Multiple(int arr[],int);/* Multiple()쫬ŧi */
int main()
{
int i,array[NUM]={ 57,48,38,46,25,17 };
/* ŧiõ_}Cl */
printf("IsMultiple()e,}Ce: ");
for(i=0;i<NUM;i++) /* LX}Ce */
printf("%d ",array[i]);
printf("\n");
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int main (int argc, char **argv)
{
const char *prog_name = argv[0];
if (argc < 2) {
fprintf(stderr, "Please input a file name: %s <filename>... |
C | /*PBL4 Q1*/
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
int field[50][50], w, h;
// 迭 ġ Ž
int vx[4] = { -1,1,0,0 }; // x
int vy[4] = { 0,0,-1,1 }; // y ,Ʒ
void dfs(int x, int y) {
int nextX, nextY;
field[x][y] = 0; //湮 Ϸ
for (int i= 0; i < 4; i++) {
... |
C | #include <sys/param.h>
#include "hfsp.h"
#ifndef _HFSP_UNICODE_H_
#define _HFSP_UNICODE_H_
int hfsp_unicode_cmp(struct hfsp_unistr * lstrp, struct hfsp_unistr * rstrp);
/*
* Fold case folding of unicode char.
* ch: The unicode char to fold.
* return: The value folded.
*/
u_int16_t hfsp_foldcase(u_int16_t ch);
... |
C | #include <stdio.h>
#include "ft_putnbr_base.c"
int main()
{
int nb20 = 456;
int min_int = -2147483648;
ft_putnbr_base(min_int, "0123456789");
printf("\n");
ft_putnbr_base(4, "01");
printf("\n");
ft_putnbr_base(nb20, "ABCD");
printf("\n");
ft_putnbr_base(-nb20, "ABCD");
printf("\n");
ft_putnbr_base(nb20, ... |
C | #include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "ft_strcmp.c"
int strcmp2(const char *p1, const char *p2)
{
const unsigned char *s1 = (const unsigned char *) p1;
const unsigned char *s2 = (const unsigned char *) p2;
unsigned char c1, c2;
do
{
c1 = (unsigned char) *s1++;
c2 ... |
C | #include <stdio.h>
#include <math.h>
#include "source.h"
void draw_triangle(unsigned int size)
{
for(int i = 1; i <= size; ++i) {
for(int j = size; j > i; --j) {
printf(".");
}
for(int j = 0; j < i; ++j) {
printf("#");
}
printf("\n");... |
C | #include<stdio.h>
int sortarray(int s[],int n);
int main()
{
int a[5],i,n;
n=sizeof(a)/4;
printf("number of elements:%d\n",n);
for(i=0;i<n;i++)
{
printf("Enter elements:");
scanf("%d",&a[i]);
}
printf("\n Sorting of array:");
sortarray(a,n);
return 0;
}... |
C | #define ex2
#include<stdio.h>
#include<locale.h>
#include<math.h>
/*1. Gere e exiba cada uma das seqncias abaixo com uma quantidade k de termos determinados
pelo usurio.
a. 3, 6, 9, 12, 15,...
b. 1/4, 1/8, 1/12, 1/16, 1/20,... */
#ifdef ex1
int main()
{
setlocale(LC_ALL, "portuguese");
//varive... |
C | static void insert(Node** root,Node* node)
{
while(1)
{
if(*root == NULL)
{
*root = node;
return;
}
else
{
if((*root)->data > node->data)
{
*root = &(*root)->left;
}
else
{
*root = &(*root)->right;
}
}
}
}
|
C | #ifndef _MATRIX_H_
typedef struct vector{
int size;
float* data;
} Vector;
typedef struct matrix{
int row;
int column;
float** data;
} Matrix;
void print_compile_info();
void initialize_vector(Vector* vector, int size);
void free_vector(Vector *vector);
void print_vector(Vector *vector);
void copy_vector... |
C | #include <stdio.h>
#include "../hdr/color.h"
#include "../hdr/display.h"
#include "../hdr/displayTest.h"
#include "../hdr/window.h"
#include "../hdr/video.h"
#define MODE_OFF 0
#define MODE_WHEEL_VIDEO 1
#define MODE_SIDE_TRAIN_VIDEO 2
#define MODE_SOUL_TRAIN_VIDEO 3
#define MODE_SOUL_TRAIN_1_VIDEO 4
#define MODE_PLAN... |
C | /** @file faux.h
* @brief Additional usefull data types and base functions.
*/
#ifndef _faux_types_h
#define _faux_types_h
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
/**
* A standard boolean type. The possible values are
* BOOL_FALSE and BOOL_TRUE.
*/
typedef enum {
... |
C | #include "unamelib.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/utsname.h>
struct utsname systemInfo;
char *systemName()
{
if (systemInfo.sysname != NULL)
return systemInfo.sysname;
else
{
fprintf(stderr, "Error to return systemName\n");
return 1;
}
}
char *syste... |
C | #include "SN76489.h"
void SN_Init(GPIO_TypeDef * port)
{
_port = port;
}
void SN_WriteDataPins(char data)
{
//WE = PA09:0x100
GPIOA->ODR |= 0x100; //WE HIGH
Databus.PORT = _port->ODR;
Databus.bytes[0] = data;
_port->ODR = Databus.PORT;
GPIOA->ODR &= ~(0x100); //WE HIGH
Delay(14); //Delay 14 microseconds
GP... |
C | #include <stdio.h>
#include <math.h>
int main()
{
int n,ang;
while(scanf("%d",&n)!=EOF)
{
for(n=3; n<=100; n++)
ang=((n-2)*180);
printf("%d\n",ang);
}
return 0;
}
|
C | // Link of the problem (language PT-BR): http://br.spoj.com/problems/COFRE/
// (Name of the problem) COFRE - Cofrinhos da Vó Vitória
#include<stdio.h>
int main(void){
int N, J, Z, dif = 0, test = 1;
scanf("%d", &N);
while (N != 0){
printf("Teste %d\n", test++);
for (int i = 0; i < N; i++){
scanf("%d%d", &J... |
C | /* hello.c
*
* Copyright (c) 2016 U.S. Army Research Laboratory. All rights reserved.
* Copyright (c) 2019 Brown Deer Technology, LLC. All rights reserved.
*
* This file is part of the ARL OpenSHMEM Reference Implementation software
* package. For license information, see the LICENSE file in the top level
* dir... |
C | /**
*pat-bl-1014
*2016-11-13
*C version 1.0
*未AC前出错3处
*坑点:要仔细读题,到底是大写还是小写,是英文字符还是字符,是判断字符还是判断下标位置,以及判断的边界在哪里,都要搞清楚
*/
#include<stdio.h>
int main()
{
char str[4][70];
char arrayDay[8][10] = {"zero", "MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"};
int day;
int hh, mm;
int i, j;
for(i = 0;i < 4;i++)
... |
C |
/*Christien Hotchkiss
* CS 344
* OTP
* otp_enc_d.c
* This is the daemon for the encryption program. It listens for oncoming connections with otp_enc. It reads in the length of key and message as well as the character arrays key and message. Then, it uses modulo % 27 to encrypt a plaintext file and outputs the resu... |
C | #include <stdio.h>
#include <string.h>
#include <math.h>
#include <time.h>
void printTitle(char a[]);
void stringToCaps(char a[]);
int main(){
int userHand, computerHand;
char userHandString[10], computerHandString[10];
int result;
int keepAsking;
char keepPlaying = 'Y';
... |
C | #include <stdio.h>
#define N 10
int main(void) {
int a[N];
printf("Enter %d fucking numbers: ", N);
for (int i = 0; i < N; i++)
if (scanf("%d", &a[i]) <= 0) return 1;
printf("In reverse, these fucking numbers are:");
for (int i = N-1; i >= 0; i--)
printf(" %d", a[i]);
putchar... |
C | /**
* Joseph Okonoboh
* Lab 4, SUMMER 2015 CECS 424
*
* driver.c
*/
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "animal.h"
#define MAX_CHAR_PER_LINE 1024
#define DOG 1
#define CAT 2
#define LION 3
#define INVALID 0
static char line[MAX_CHAR_PER_LINE... |
C | /*
============================================================================
Name : LongestCollatzSequence.c
Author : rightmirem
Version :
Copyright : Your copyright notice
Description : Hello World in C, Ansi-style
============================================================================... |
C | #include<stdio.h>
#include<stdlib.h>
struct node
{
int data;
struct node*next;
};
struct node*insert(struct node*start,int x)
{
struct node*p = start,*temp = (struct node*)malloc(sizeof(struct node));
temp->data = x;
temp->next = NULL;
if(start == NULL)
start = temp;
else
{
p = start;
whi... |
C | /* -------------------------------------------------------------------------*/
/* Guardar y visualizar imgenes, A. Lpez */
/* -------------------------------------------------------------------------*/
#include <GL/glut.h>
#include <stdio.h>
#include <stdlib.h>
#define ancho... |
C | #include<stdio.h>
void main()
{
int a,n,i;
printf("enter a,n values");
scanf("%d%d",&a,&n);
for(i=0;i<=n;i++)
{
if(i%2==0)
{
printf("%d",i);
}
}
}
|
C | #ifndef CS_2413_BANG_H
#define CS_2413_BANG_H
#include "dice.h"
#include "players.h"
#include "friendliness.h"
#define NUM_DICE 5
typedef enum {noExit, outlawWin, renegadeWin, deputyWin} GameOver;
/**
* The main function to run the game
* @authors Anamol Acharya, Jonathon Surles, and Shree Shrestha
*/
void bang(... |
C | #include <GL/glut.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "funkcije.h"
#include "image.h"
#define TIMER_INTERVAL 20
#define TIMER_ID 0
#define PI 3.14159265359
#define TEXTUREFILE1 "textures/quad_texture.bmp"
#define TEXTUREFILE2 "textures/act_quad_texture.bmp"
static void on_display();... |
C | #include<stdlib.h>
void merge(long src1[], long src2[], long dest[], long n){
long i1 = 0;
long i2 = 0;
long id = 0;
while(i1 < n || i2 < n){
long min = src1[i1] > src2[i2] ? src2[i2] : src1[i1];
i1++;
i2++;
i1 = src1[i1-1] > src2[i2-1] ? i1 - 1 : i1;
i2 = src1[i1-1] > src2[i2-1] ? i2 : i2 -... |
C | #include <stdio.h>
#include <time.h>
#include <math.h>
#include <stdlib.h>
#include <mpi.h>
#define MASTER 0
#define OUTPUT_NUM 10
void SequentialSort(void);
void CompareLow(int bit);
void CompareHigh(int bit);
int ComparisonFunc(const void* a, const void* b);
int min ( int a, int b ) { r... |
C | /* this contains the public definitions for the player module */
#pragma once
enum playerType {
human, computer, inactive
};
#define Player1 1
#define Player2 2
#define Player3 3
#define Player4 4
#define noPlayer -1
#define playerError -1
#define maxNumberOfPlayers 4
#define GetFirstCity(_league) (GetNextCi... |
C | #include <iostream>
#include "PackedForest.h"
#include "TreeNode.h"
#include "LabelSpan.h"
#include <string>
//#include "LiBE.h"
using namespace std;
using namespace __gnu_cxx;
using namespace mtrule;
////////////////////////////////////////////////////////////////
// Packed Forest.
//////////////////////////////////... |
C | #include "../ostypes.h"
#include "io.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
static FILE *fd;
extern int byteCount;
void openOutput() {
fd = fopen(OUTPUTFILE, "wb");
if (!fd) {
char cwd[1024];
perror("failed to open file for writing");
if (getcwd(cwd, si... |
C | #include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <sys/wait.h>
#include <time.h>
#include "consoleUtils.h"
int main(int argc, char *argv[])
{
//int max_process_num = readNumber(argc, argv);
int max_process_num = 5;
int cur_process_num = 0;
pid_t pid = 0;
int fd[2] = {0};
i... |
C | /*
* Autonroutines.c
*
* Created on: Nov 28, 2014
* Author: Kyle Medeiros and Wenheng Lu
*/
#include "main.h"
#define FORWARD 0
#define BACKWARD 1
#define LEFT 0
#define RIGHT 1
#define UP 0
#define DOWN 1
#define BW 0
#define FW 1
void Autonroutines(int Routine){
if (Routine == 1){ //... |
C | #include <stdio.h>
#include <stdlib.h>
#include <sys/shm.h>
#include <sys/stat.h>
#include <unistd.h>
#include <sys/wait.h>
#define MENSAGEM_MAX 80
#define CHAVE 8180
int main ( int argc, char *argv[]){
int segmento, i;
char *mensagem;
// aloca a memória compartilhada
segmento = shmget (IPC_PRIVATE, MENSAGEM_MAX*... |
C | #include "uart.h"
#include <avr/io.h>
#include <stdio.h>
#include <util/setbaud.h>
#ifdef __cplusplus
extern "C" {
#endif
void uart_init() {
UBRR3H = UBRRH_VALUE;
UBRR3L = UBRRL_VALUE;
#if USE_2X
UCSR3A |= _BV(U2X3);
#else
UCSR3A &= ~(_BV(U2X3));
#endif
UCSR3C = _BV(UCSZ31) | _BV(UCSZ30);
UCSR3B = _BV(R... |
C | #include <stdio.h>
typedef struct node
{
int data;
struct node *next; //定义我自己??
} NODE, *NODEPTR; //此时NODE 是 未完成类型 即 编译器不能确定它的内存大小
//若内部 struct node *p; 就不是未完成类型了,因为 指针大小是固定的
//这时候此结构包含两个成员 一个整形和一个指针
void traverse(NODEPTR head)//遍历链表
{
NODEPTR p = head;
while (p != NULL)
{
printf("%d\... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.