language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /*
** EPITECH PROJECT, 2019
** my_evil_str
** File description:
** reverse string
*/
int my_strlen(char const *str);
char *my_evil_str(char *str)
{
int max = my_strlen(str);
int i = 0;
while (i < max/2)
{
char to_save = str[i];
str[i] = str[max-1-i];
str[max-1-i] = to_save;
... |
C | #include <stdio.h>
union x {
char u1;
int u2;
int u3;
};
void output_func(union x *arg1) {
printf("%c\n", arg1->u1);
printf("%d\n", arg1->u2);
printf("%d\n", arg1->u3);
}
|
C | #include <stdio.h>
int main(){
int num1; /* first input number */
int num2; /* second input number */
int sum; /* sum of two input numbers */
printf("Please enter first integer ");
scanf ("%d", &num1);
printf("Please enter second integer ");
scanf("%d", &num2);
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <netdb.h>
#include <netinet/in.h>
#include <string.h>
#include "board.c"
#define RED "\x1B[31m"
#define RESET "\x1B[0m"
#define GREEN "\x1B[32m"
void * on_signal(void * sockfd) {
char buffer[64];
int n;
int socket = *... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* cubfile.c :+: :+: :+: ... |
C | #include "lists.h"
/**
* delete_nodeint_at_index - function that deletes a node in specific position
* @head: pointer to pointer to head
* @index: index to delete node
* Return: 1 or -1
*/
int delete_nodeint_at_index(listint_t **head, unsigned int index)
{
listint_t *tt, *tmp;
unsigned int i = 1;
if (*head)
... |
C | // SensoryMotor
// Sends sensory inputs to, and receives motor outputs from a serial port connection
// (works with the python app InputsVehicleBrain.app and circuit Gizmo_new.cad)
// Emily Mackevicius Nov 27, 2012
//
// Based on several of Neil Gershenfeld's HTMAA example files //
#include <avr/io.h>
#include <util/... |
C | #include <stdio.h>
#include <stdlib.h>
typedef struct k{
int ok1;
int ok2;
}KEK;
typedef struct tree{
KEK tuple;
struct tree* subtrees;
}Tree;
// test1: updating tree using adresses directly
// remarks: an incomplete structure can't have an array of itself inside
// aka struct tree subtrees[15] doesn'... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* quoting.c :+: :+: :+: ... |
C | //labString1.c
#include<stdio.h>
#include<string.h>
int main()
{
char ch1;
char str1[50], str2[50];
printf("Enter first string: ");
gets(str1);
printf("Enter second string:");
gets(str2);
if((strcmp(str1,str2))==-1)
printf("\"%s\" comes before \"%s\" \n",str1,str2);
else if((strcmp(str1,str2))=... |
C | #include "__HEADER__.h"
int main(int argc, char* argv[]){
if( !strcmp(argv[1],"TRUE" ) ){
printf("True");
}else if( !strcmp(argv[1], "FALSE") ){
printf("False\n");
}else{
printf("Nope\n");
}
return 0;
}
/*
* Run by sending parameter.
*/ |
C | #include <stdio.h>
#include <stdlib.h>
#define ROWS 12 /* linhas */
#define COLS 12 /* colunas */
#define NOTNULL(x) (x != NULL)
/*
funcao que soma todos os elementos abaixo da diagonal principal
Entradas:
float* matrix -> O ponteiro para a matriz original
int* items -> Ponteiro opcional cas... |
C | #include <stdio.h>
#include <math.h>
#ifndef PSO_H_
#define PSO_H_
// Maximum Swarm Size
#define PSO_MAX_SIZE 100
#define PSO_INERTIA 0.7298
// Neighbour Hood Schemes
// Global best topology
#define PSO_NHOOD_GLOBAL 0
// Ring topology
#define PSO_NHOOD_RING 1
// Random neighborhood topology
#define PSO_NHOOD_RA... |
C | #include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int main ()
{
int fd;
int size;
char content[] = "My name is Anjali";
size = sizeof(content);
char reading[size];
fd = open("anjali", O_RDWR | O_CREAT, S_IRWXU);
write(fd, content, size-1);
lseek(fd, 0, SEEK_... |
C | #include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dw.h"
struct list *head;
struct list *curr;
char start_room[20];
char exit_room[20];
int player_doughnuts;
int player_milkshakes;
int
createRooms(int rooms){
struct room *new_room;
char names[21];
int scan, i, num_doughnuts, ... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* olya_new_add.c :+: :+: :+: ... |
C | /***************************
* Name: Vicky Mohammad
* ID: 0895381
***************************/
#include "HeapAPI.h"
/**
* Internal functions to search for the max element between the data stored at index i
* and the left child. This function will use compares data using the function pointer and return the index ... |
C | /* ---------------------------------------------------------------------------------------------------
Program :morse.c
Deskripsi :Body dari header file (morse.h) pada ADT morse
Author :
Referensi :https://phitchuria.wordpress.com/2018/04/04/algorithm-c-morse-code-binary-tree/
Versi / tan... |
C | #include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <netinet/in.h>
#include <pthread.h>
#define SOCKET_PORT 8888
#define MAX_CONNECT 5
//线程里处理每个连接请求
void *handle_every_connect(void *thread_args)
{
int connect_arg = *((int *)thread_ar... |
C | #include <err.h>
#include <sndio.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define BUFSIZE 64
typedef struct Settings {
int delay;
char * in;
FILE * out[16];
bool noblock;
} Settings;
Settings setCh(Settings s, ch... |
C | #include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
int main()
{
int p = (int)getpid();
char fn[80];
sprintf(fn, "/proc/%d/stat", p);
FILE* fp = fopen(fn, "r");
if (fp) {
size_t size = fread(fn, sizeof (char), sizeof (fn), fp);
if (size > 0) {
strtok(fn, " "); // (1) pid %d
... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h> //work with procesos
#include <time.h>
#include <sys/wait.h>
#include <errno.h> //to catch children processes
/*This program shows how execl can be used with post processing, within a process tree*/
int main(int argc, char* argv[]){
i... |
C | #include "uls.h"
void mx_sort_a_time(t_data **data_list) {
t_data *ptr1 = *data_list;
t_data *ptr2 = NULL;
if (!ptr1)
return;
while (ptr1->next != NULL) {
ptr2 = ptr1->next;
while (ptr2) {
if (ptr1->buffer->st_atime < ptr2->buffer->st_atime)
mx_swap_... |
C | /*
*/
#include <stdio.h>
void repeat_print(char c, int n)
{
for (int i=0; i<n; i++) {
printf("%c", c);
}
printf("\n");
}
void money_pyramid(int n)
{
for (int i=1; i<=n; i++) {
repeat_print('$', i);
}
}
int main()
{
printf("How many levels?\n");
int n;
scanf("%d", &n);... |
C | #include<stdio.h>
#include<string.h>
void conv(char *s1,int a,int key);
main(int args,char* argv[])
{
char *s0,*s2,*s3;
int a,b,c,i;
s0=argv[1];
s2=argv[2];
s3=argv[3];
a=strlen(s0);
b=strlen(s2);
c=strlen(s3);
printf("%d %d %d \n",a,b,c);
conv(s0,a,1);
printf("\n");
conv(s2,b,2);
printf("\n");
printf("%s... |
C | /* Test code for chunk */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <inttypes.h>
#include <stdbool.h>
#include <getopt.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "dtype.h"
#include "table.h"
#include "chunk.h"
#include "report.h"
static ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
char * removeDuplicates(char * S){
int i = 0, top = 0,len;
len = strlen(S);
char *stack = malloc(len * sizeof(char));
stack[top++] = S[i++];
while (i < len)
{
if (S[i] != stack[top - 1])
stack[top++] = S[i];
... |
C | #include <stdio.h>
int find_max(int* source, int length) {
int max = source[0];
for (int i = 0; i < length; i++) {
if (source[i] > max) {
max = source[i];
}
}
return max;
}
int main(void) {
int source[10] = {5, 0, 6, 7, 8, 1, 2, 99, 4, 3};
int max = find_max(source, 10);
pri... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pwd.h>
#include <grp.h>
#include <unistd.h>
#include <sys/types.h>
int main()
{
uid_t uid;
gid_t gid;
struct passwd *pw;
struct group *pg;
int i;
uid = getuid();
pw = getpwuid(uid);
gid = getgid();
pg = getgrgid(g... |
C | //
// main.c
// BMICalc
//
// Created by Shane Doyle on 24/12/2013.
// Copyright (c) 2013 Shane Doyle. All rights reserved.
//
#include <stdio.h>
typedef struct {
float heightInMeters;
int weightInKilos;
} Person;
float bodyMassIndex(Person person)
{
return person.weightInKilos / (person.heightInMete... |
C | //på[`CJaƶq(LXaW٭nӲĤ@ӦrjpƧ)
#include <stdio.h>
#include <string.h>
int main(void)
{
int n,i,j;
char input[75];
int sum[7]={0};
//England France Germany Italy Spain Turkey()
scanf("%d",&n);
for(i=0;i<n;i++)
{
for(j=0;j<3;j++)//n]T]:|England Harry Poter@TӦr
{
scanf("%s",input);
//ۤvnƧǦAhP_
if(strc... |
C | //
// Created by tomer on 10/12/2020.
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void reverseLines(char*);
char** splitLines(char*, int*);
void reverseArray(char**, int);
char* joinLines(char**, int);
char** addLine(char**, int*, char*);
/**
* add line to array of lines.
*/
char** addLine(char** ... |
C | #include <stdio.h>
extern ** environ; /* 环境变量表的指针 */
int main()
{
int i;
/*遍历打印环境变量,但是这种方法并不是被推荐的。
*原因会在后面的章节详细说明,这里的代码只是为了演示环境变量
*/
for(i = 0; environ[i] != NULL; i++)
printf("each : %s\n", environ[i]);
return 0;
}
|
C | #include <ansi.h>
inherit "room/room";
int unlocked;
reset(arg)
{
::reset(arg);
if(arg) return;
set_light(1);
short_desc = "Storage room";
long_desc =
"A general storage room. \n";
items =
({
});
dest_dir =
({
"/players/angel/area/mansion/room/broiler_room_10", "broiler",
});
}
init(){
... |
C | #include <stdio.h>
#include <stdlib.h>
#include "simos.h"
#define OPload 2
#define OPadd 3
#define OPmul 4
#define OPifgo 5
#define OPstore 6
#define OPprint 7
#define OPsleep 8
#define OPend 1
void initialize_cpu ()
{ // Generally, cpu goes to a fix location to fetch and execute OS
CPU.interruptV = 0;
CPU.numC... |
C | //
// SuspendQueue.c
// OS
//
// Created by Wu Xin on 10/13/13.
// Copyright (c) 2013 Wu Xin. All rights reserved.
//
#include <stdio.h>
#include "SuspendQueue.h"
#include "global.h"
/************************************************************************
addToSuspendQueue
add the process to suspend queue after... |
C | #include<stdio.h>
#include <stdlib.h>
int main()
{
int n,m,i,a[100],j,t,sum=0;
scanf("%d %d\n",&n,&m);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
scanf(" ");
}
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(a[i]<a[j])
{
t=a[i];
... |
C | #include<stdio.h>
int main(void)
{
printf("Input a number:");
printf("is your input word");
return 0;
} |
C | #include<stdio.h>
#include<string.h>
void print_arr(int *arr_base, int arr_size);
int main(void)
{
int int_arr[] = { 5,8,0,4,1,9 };
int int_arr_size = 0;
//ʼָ(Ļַ)
int int_arr_ptr = int_arr;
//int int_arr_ptr = &int_arr[0];
int_arr_size = sizeof(int_arr) / sizeof(int_arr[0]);
printf("Ϊ:");
print_arr(int_ar... |
C | #include<stdio.h>
#include<conio.h>
void main()
{
int l,b,res;
clrscr();
printf("Enter the length:");
scanf("%d",&l);
printf("Enter the breadth:");
scanf("%d",&b);
res=l*b;
printf("Area of rectangle is %d sq.units",res);
getch();
}
|
C | #include "header.h"
char* trim_dir(char*cwd) // Put root dir into folder names (Changes to relative(~) from absolute)
{
int len = strlen(cwd), len1 = strlen(INTDIR);
int i;
for(i=0;i<len1;i++)
{
if(cwd[i]!=INTDIR[i])
{
break;
}
}
if(len < len1)
{
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <string.h>
typedef struct nodo_abb{
int valor;
struct nodo_abb *izq;
struct nodo_abb *der;
}nodo_abb;
void ingresarNumeros();
void recorrerDFS(nodo_abb *a);
nodo_abb *agregar_abb(struct nodo_abb *arbol, int val);
void borrar_abb(struct ... |
C | /* A simple server */
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#define MAXBUFLEN 256
int checkReadyForRead(int sockfd)
{
while (1){
char read_buffer[MAXBUFLEN];
fd_set... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* philo_bonus_tools.c :+: :+: :+: ... |
C | #include <stdio.h>
#include <math.h>
int main(){
double X, soma, fat = 1.0;
int N;
scanf("%lf%d", &X, &N);
soma = X;
int i;
for(i = 1; i < N; i++){
fat=1.0;
int j;
for(j = 2; j <= (i*2)+1; j++){
fat *= j;
}
if(i%2 == 1){
soma -... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>
int main(int argc, const char * argv[]) {
int player, c1, r1, c2, r2;
bool valid;
while(scanf("%d %d %d %d %d", &player, &c1, &r1, &c2, &r2) != EOF) {
valid = true;
if(c1 - c2 == 0) {... |
C | #include <stdio.h>
void main(){
int n,t,res=0;
printf("Enter num:");
scanf("%d",&n);
t=n;
while(n!=0){
res=res*10+(n%10);
n=n/10;
}
(res==t)?printf("Is a Palindrome"):printf("Not a Palindrome");
}
/*
Output:
Enter num:121
Is a Palindrome
*/
|
C | #include <stdio.h>
int main ()
{
short int a, b;
a = 32767;
b = a + 1;
printf("%d, %d\n", a, b);
}
|
C | #include <homestead/saveload.h>
#include <homestead/homestead.h>
#include <stdio.h>
#include <stdlib.h>
#include <mICE/mICE.h>
int saveVillage(struct Village* village) {
FILE* file = fopen(SAVE_FILE, "wb");
if (!file) return 0;
fwrite(village, sizeof(Village), 1, file);
fwrite(village->calendar, sizeof(Calendar),... |
C | #include <stdio.h>
#define MAX 8
#define INF 1415*8+1
#define MIN(A,B) A<B?A:B
int n;
int mark[MAX];
double map[MAX][MAX];
double min;
void TSP(int rec,double sum,int cnt){
int i;
if(mark[rec]) return;
mark[rec]=1;
if(cnt==n){
min=MIN(min,sum);
mark[rec]=0;
return;
}
for(i=0;i<n;i++){
if(map[rec][i... |
C | #include<stdio.h>
#include <assert.h>
#include<gmp.h>
void find_phi(mpz_t phi,mpz_t p1,mpz_t p2 ) //computes the value of phi
{
mpz_t one ;
mpz_init(one);
mpz_set_si(one,1);
mpz_sub (p1,p1,one); // p1 = p1 - 1
mpz_sub (p2,p2,one); // p2 = p2 - 1
mpz_mul(phi,p1,p2); // phi = p1 * p2
}
|
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <unistd.h>
#include <stdbool.h>
#include "pet.h"
#include "owner.h"
#include "game.h"
extern const ShopItem ShopCatalog[12];
void Game_Init(Owner **Player, Pet **MyPet) {
char type[4];
char PlayerName[MAXST];
char PetName[MAXST... |
C | #include "Fibonacci.h"
#include <Telegraph.h>
int Fibonacci(int n)
{
int i;
int prev = 1;
int prevprev = 1;
int temp;
for(i = 2; i < n; i++)
{
temp=prev;
prev=prev+prevprev;
prevprev=temp;
}
//TELE_DEBUG_INIT();
TELE_DEBUG_PRINTF0("in Fibonacci!\n");
//TELE_DEBUG_DONE();
return pr... |
C | /*
** read_pos.c for in /home/tdebrand/PSU_2016_navy
**
** Made by Thomas DEBRAND PASSARD
** Login <tdebrand@epitech.net>
**
** Started on Tue Jan 31 14:19:23 2017 Thomas DEBRAND PASSARD
** Last update Sat Feb 18 16:38:07 2017 Thomas DEBRAND PASSARD
*/
#include "my.h"
int folder_to_array(int ac, char **av, t_tool... |
C | #include <stdio.h>
int main()
{
int X; //Distância percorrida
float Y; //Combustivel gasto
float consumo; //Consumo médio;
scanf("%d", &X);
scanf("%f", &Y);
consumo = X/Y;
printf("%.3f km/l\n", consumo);
return 0;
} |
C | #include <stdlib.h>
#include <stdio.h>
#include "ArbreMiMa.h"
#include "ListePos.h"
int EvaluerPlateau_0(int plateau[H][H])
{
int i,j;
int res = 0;
/*A Completer*/
for (i = 0; i < H; j++)
for (j = 0; j < H; j++)
{
if (plateau[i][j] == NOIR)
res++;
if (plateau[i][j] == BLANC)
res--;
}
return (... |
C | //#include<stdio.h>
//#include<string.h>
char *my_strstr(char *str, char const *to_find)
{
if(str != NULL && to_find != NULL)
{
char *flag = NULL;
while(*str != '\0')
{
char *dest = str;
char const *src = to_find;
if(*dest == *src)
{
flag = dest;
while(*dest && *src && *dest++ == *src++)
... |
C |
#include "unit_test.h"
// Base address of the memory mapped IO region
volatile uint32_t * __mmio_base = (uint32_t*)0x00001000;
//! Direct access to mtime
volatile uint64_t * __mtime = (uint64_t*)0x00001000;
//! Direct access to mtimecmp
volatile uint64_t * __mtimecmp = (uint64_t*)0x00001008;
volatile uint32_t... |
C | #include <stdio.h>
#include <syscalls.h>
#include <string.h>
int fputc(int fd, char c)
{
return syscall_write(fd, &c, 1);
}
int putc(char c)
{
return fputc(SYSLOG, c);
}
int fputsn(int fd, char * c, int n)
{
return syscall_write(fd, c, n);
}
int fputs(int fd, char * c)
{
return syscall_write(fd, c, strlen(c));
... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
struct Node
{
char value;
struct Node *next;
};
struct Node *top = NULL;
bool topChecker(char topValue, char currentValue)
{
printf("comparing %c %c\n", topValue, currentValue);
if (topValue == '(' && currentValue == ')... |
C | #include<stdio.h>
void main(void){
int sum=0,i;
for(i=1;i<=100;i++){
if (i%7==0) sum+=i;
}
printf("sum=%d",sum);
} |
C | /*
入力された整数が奇数か偶数かを判別し、さらに3の倍数か否かも判別するプログラムを作成したい。
以下はそのサンプルプログラムである。このプログラムでは条件分岐の部分を3つの異なる方法で実装し、同じ結果を三度出力するようにしている。
下線部を埋めて実行例のような動作をするように完成させなさい。
*/
/* 奇数、偶数、3の倍数を判別するプログラム */
/* 作成者:Tsuyoshi Kumamoto*/
/* 作成日:5/9/2017*/
#include <stdio.h>
int main()
{
int a;
printf("整数を入力してください ");
scanf("%d", &a);
prin... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "dlinkedlist.h"
#include "key.h"
#include "program.h"
#include "highlightmenu.h"
#include "data_handlers.h"
/* --------------------------- Public Data Handlers ------------------------------- */
/* make a new data container */
Employ... |
C | /*
** This code provides implementation of the functions
** defined in the array data type interface, using some
** operations defined in item.h.
*/
#include<stdlib.h>
#include<stdio.h>
#include"array.h"
#include"item.h"
void randinit_array(item_t *array,int N)
{
int i;
for(i=0;i<N;i++){
array[i]=rand_item();
}
... |
C | #include <stdio.h>
#include <string.h>
int main(void)
{
int i, j;
char name[10][100] = {"tom", "jim", "mary"};
// zhang san | li si | wang ma zi
/*name[0] = "zhang san";*/
strcpy(name[0], "zhang san");
for (i = 0; i < 3; i++)
{
printf("please input %d name : ", i + 1);
fgets(name[i], sizeof(name[i]), st... |
C | #include <gtk/gtk.h>
#include <stdio.h>
GtkWidget *checkbutton;
GtkWidget *togglebutton;
GtkWidget *radiobutton1, *radiobutton2;
void quit ( GtkWidget *window, gpointer data)
{
gtk_main_quit();
}
void add_widget_with_label ( GtkContainer * box,
gchar * caption, GtkWidget * widget)
{
GtkWidget *label = gt... |
C | /*
MT2020013 Apoorv Panse
Write a program to create five new files with infinite loop. Execute the program in the background
and check the file descriptor table at /proc/pid/fd.
*/
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
int main() {
... |
C | #include <stdio.h> // printf
#include <stdlib.h> // malloc, free, exit
#include <math.h> // sqrt
#include "ponto.h"
struct ponto {
float x;
float y;
};
Ponto* cria (float x, float y){
Ponto* p = (Ponto*)malloc(sizeof(Ponto));
if (p == NULL){
printf("Memoria insuficiente! \n");
exit(1);
}
p->x = x;
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <check.h>
#include "hash_set.h"
/*
* Print the contents of a set.
*/
void print_set(hash_set_t *set)
{
bool print_comma = false;
printf("[ ");
for (size_t i=0; i < set->capacity; i++) {
if (print_comma) {
printf(", ");
} else {
... |
C | #include "func.h"
#include <signal.h>
int main(int argc, char *argv[])
{
signal(SIGCHLD, sig_child);
int sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock == -1)
HANDLE_ERROR("socket");
socklen_t size_addr = sizeof(struct sockaddr_in);
struct sockaddr_in *serv_addr = malloc(size_addr);
mem... |
C | #include <stdlib.h>
#include "constants.h"
#include "linknode.h"
LinkNode *new_node(int x, int y)
{
LinkNode *node = (LinkNode *)malloc(sizeof(LinkNode));
SDL_Rect body_rect;
body_rect.h = body_rect.w = RECT_SIZE;
// multiplying positions with SCALE for getting exact positions on screen
body_rect.... |
C | /********
Develop Tic tack toe game by using C language to implement this game.
************/
#include<stdio.h>
#include<string.h>
int board(char a[][3],char);
int main()
{
int i,j,c,x=0,y=0,s1,s2,k;
char a[3][3],ch,play[5],z[10],name1[10],name2[10],m[10],n[10];
do
{
name1[0]='\0';
na... |
C | #include<stdio.h>
#include<string.h>
int main(){
char a[101][101];
int b[101][101];
int n, m, i, j, k, l, flag = 0;
scanf("%d %d", &n, &m);
long int count = 1;
while(n != 0 && m != 0){
memset(b, 0, sizeof(b));
for(i = 0; i < n; i++){
scanf("%s", a[i]);
}
for(i = 0; i < n; i++){
for(j = 0; j < m; j++){
... |
C | #include <stdio.h>
#include <stdlib.h>
#include<math.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
// la solurion est d'ajouter des if else imbriqus
main(int argc, char *argv[]) {
float a,b,c,x,x0,x1,x2,D;
printf("donner a:");
scanf("%f",&a)... |
C | /* vim: set tabstop=4:softtabstop=4:shiftwidth=4:noexpandtab */
/***************************************************************************
*
* File Name: mathdp31.c
*
* Purpose: Contains functions increased-precision arithmetic operations.
*
* Below is a listing of all the functions in this file. T... |
C | #include <stdio.h>
void main(){
printf("Void: %d\n", sizeof(void));
printf("Char: %d\n", sizeof(char));
printf("Short: %d\n", sizeof(short));
printf("Int: %d\n", sizeof(int));
printf("Long: %d\n", sizeof(long));
printf("Float: %d\n", sizeof(float));
printf("Double: %d\n", sizeof(double));
printf("long double: %... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: ... |
C | #include<stdio.h>
#include<stdlib.h>
#include<curses.h>
#include<math.h>
int channel[50]={0},n,tf=5,ttemp[10],a=0,k=2,w=0;
int ds[10]={1,1,1,1,1,1,1,1,1,1},is[10]={0},js[10]={0};
int status[10]={1,1,1,1,1,1,1,1,1,1};
typedef struct
{int data[5];
int dest;
int time;}station;
void send(int sno);
int stat_ini();
int se... |
C | struct book
{
int num;
char name[27];
};
int main()
{
int n,i,j,l,sum[26],t=0,T=0;struct book a[1000];memset(sum,0,sizeof(sum));char A;
cin >> n;
for(i=0;i<n;i++)
{
cin >> a[i].num >> a[i].name;
l=strlen(a[i].name);
for(j=0;j<l;j++)
{
sum[a[i].name[j]-'A']++;
}
}
for(i=0;i<26;i++)... |
C | /***************************************************************************/
/* */
/* function create_outputname */
/* */
/* it cr... |
C | /*
** EPITECH PROJECT, 2017
** replace_letter_optn3.c
** File description:
** By DavidS
*/
#include <string.h>
#include <stdlib.h>
#include "proto.h"
static int replace_bis(char **tab, char *tmp, int i, int j)
{
if (tmp[j] == 'A')
tab[i][j] = 'T';
if (tmp[j] == 'G')
tab[i][j] = 'C';
if (tmp[j] == 'T')
tab[i]... |
C | #include <stdio.h>
#include <string.h>
#include <curl/curl.h>
#define FROM_ADDR "devikakrishnan249@gmail.com"
#define CC_ADDR "devikakrishnan249@gmail.com"
int sendemail(char *To, char *path_p) {
char *to = (char*)To;
char *file_path = (char*)path_p;
CURL *curl;
CURLcode res = CURLE_OK;
... |
C | #include<conio.h>
#include<stdio.h>
void dfs(int v);
typedef enum boolean {false,true} bool;
int n, a[10][10];
bool visited[10];
void main()
{
int i,j,v;
printf("Enter the number of nodes in the graph \n");
scanf("%d",&n);
printf("Enter the adjacency matrix \n");
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
... |
C | #include<stdio.h>
#include<stdlib.h>
#include<time.h>
void TSP(int* C, int* A, int* path, int* fpath, int *sum, int *fsum, int flag, int n, int b, int a, int *sc){
int i,k;
flag++;
for(k=0;k<n;k++)
if(*(C+n*flag+k)==0){
*(C+n*flag+k)=k+1;
*sum=*sum+*(A+n*b+k);
... |
C | // TODO : 1.Write a program which accept number from user and print that number of $ and * on screen.
/*
Algorithm
START
Accept one number from user as no.
Iterate one loop till that number
Display that number of $ and *
STOP
*/
#include<stdio.h>
v... |
C | int login,aluno,b=0,c=0,d=0;
void validacao_aluno(){
char usuario1[10];//estring para digita usuario;
int senhar;//para digitar a senhar
cadastroaluno = fopen("arquivos\\cadastros_alunos.txt","a+");
registradas_notas = fopen("arquivos\\notas_alunos.txt","a+");
if(cadastroaluno == NULL && regi... |
C | #include <omp.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
typedef struct Q {
int* q;
int pos;
int size;
} Q;
struct Q* initQ(int n) {
int i;
struct Q *newQ = (struct Q *) malloc(sizeof(Q));
newQ->q = (int*) malloc(sizeof(int)*n);
newQ->pos = -1;
newQ->size = n-1;
return... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
typedef struct Node {
int value;
struct Node *next;
} Node;
void display(Node *);
void freeList(Node *);
void push(Node **, int);
Node *reverse(Node *);
int main(void)
{
int x;
Node *node = NULL;
Node *reversed;
// Initialize the t... |
C | #include "fllist.h"
//initializes an empty file_list
fllist* create_list(){
fllist *new_list = (fllist *)malloc(sizeof(fllist));
if(new_list == NULL){
perror("Already out of memory. Quitting program\n");
exit(1);
}
new_list->head = NULL;
new_list->size = 0;
return new_list;
}
//attempts to open and parse no... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
void rock(int n) {
if (n==0) {
printf("Computer chose rock! It's a draw.\n");
}
else if (n==1) {
printf("Computer chose scissors! Congratulations, you win.\n");
}
else {
printf("Computer chose paper! Sorry, you lose.\n");
}
}
void paper(int n) {
if... |
C | #include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main(int argc, char *argv[])
{
int loop_iterations=atoi(argv[1]), fixed_count=1000, count, count1;
double start, end, time=0;
struct timespec st;
for(count=0; count<loop_iterations; count++)
{
//Start time clock
clock_gettime(CLOCK_THREAD_C... |
C | //READ THE LINE BELOW FOR LOCATIONS OF THREAD AND MUTEX!
//Mutex on lines 24 and 41. Pthread creation on line 101
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <sys/stat.h>
#include <time.h>
#include <pthread.h>
//Mutex was made a global variable so that it didnt have to be pa... |
C | #define ex19
#include <stdio.h>
#include <stdlib.h>
#ifdef ex1
main()
{
int k = 0, cont1 = 0, cont2 = 0, cont3 = 0, cont4 = 0, seq;
while(k <= 0)
{
printf("Insira o numero de termos que serao apresentados: ");
scanf("%d",&k);
if(k <= 0)
{
printf("\nNumero invali... |
C | #include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<unistd.h>
#include<sys/wait.h>
#include<pthread.h>
#include<semaphore.h>
#include<fcntl.h>
#include<string.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<sys/ipc.h>
#include<sys/shm.h>
#include<ctype.h>
#include<signal.h>
int Xfd, Yfd;
pid_t p... |
C | /*
Author: LargeDumpling
Email: LargeDumpling@qq.com
Edit History:
2016-01-08 File created.
*/
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define D 10000000
char tex1[D],tex2[D];
int main(int argc,char *argv[])
{
int i;
FILE *f1=fopen(argv[1],"r"),*f2=fopen(argv[2],"r");
fread(tex1... |
C | /*
* Tapis.c
*
* Created on: Feb 16, 2020
* Author: zahrof
*/
#include "Tapis.h"
void mktapis(size_t maxsize, tapis * t, ft_event_t * cv, char * str){
t->nom=newcopy(str);
t->allocsize= maxsize;
t->begin=0;
t->sz=0;
t->cv=cv;
t->tab=malloc(maxsize*sizeof(paquet));
}
int empty(tapis * t){ return (t-... |
C | int numbers(char *str, int i)
{
while (str[i] == 32)
i++;
while (str[i] >= 48 && str[i] <= 57)
i++;
return (i);
}
int ft_atoimod(char *str, int i)
{
int r;
r = 0;
while (str[i] >= 48 && str[i] <= 57)
{
r = (r * 10) + (str[i] - 48);
i++;
}
printf("%d\n", r);
return (r);
}
int parenthesis(char *str, ... |
C | #include <unistd.h>
void ft_putnbr_base(int nbr, char *base);
int is_base_valid(char *base, int *len_out);
void base_conv_rec(long int n, char *base, int *base_len);
void ft_putnbr_base(int nbr, char *base)
{
int base_len;
long int num;
if (is_base_valid(base, &base_len))
{
num = nbr;
if (nbr < 0)
{
... |
C | #include <stdio.h>
void func1( int a )
{
int i ;
for( i = 0; i<a ; i++)
{
if( i%2 == 0 )
{
printf( "test\n" ) ;
}
else {
printf( "test1\n" ) ;
}
}
}
void main()
{
int j = 5 ;
func1( j ) ;
}
|
C |
#include "UI.h"
/*Functia de afisare a medicamentelor din lista
* Date de intrare: ptr - un pointer la o lista de Medicamente
* Se vor afisa medicamentele din lista (daca sunt) sub forma: Cod:
* Nume:
* ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.