language large_stringclasses 1
value | text stringlengths 9 2.95M |
|---|---|
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* error.c :+: :+: :+: ... |
C | #include <stdio.h>
struct cust_st
{
int acc_no;
char cust_nm[30];
float bal;
};
struct tran_st
{
int acc_no;
char trantype;
float amt;
};
int main()
{
int choice=1;
while(choice!=4)
{
printf("\nSelect choice from menu\n\n 1. Accept customer details\n
2. Record withdrawl/Deposit transaction\n 3. Print low... |
C | #include "../node.h"
static const char *mode_strings[] = { "lowpass", "highpass", "bandpass", "notch", "off", NULL };
enum { LOWPASS, HIGHPASS, BANDPASS, NOTCH, OFF };
typedef struct {
Node node;
int mode;
float d1, d2;
NodePort in, freq, q; /* inlets */
NodePort out; /* outlets */
} SvfNode;
stat... |
C | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <error.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define ERR_EXIT(m) \
do{ \
perror(m); \
exit(EXIT_FAILURE); \
}while(0)
/*
*set flag using fcntl function
*
*/
void set_flag(int fd,int flag)
{
... |
C | #include "compiler.h"
char *BOILERPLATE =
"#include <stdlib.h>\n"
"#include <stdio.h>\n"
"#include <stdbool.h>\n"
"\n"
"typedef char *str;" CC_NEWLINE
"typedef unsigned long long u64;" CC_NEWLINE
"typedef unsigned int u32;" CC_NEWLINE
"typedef unsigned short u16;" CC_NEWLINE
"typedef unsigned char u8;" CC_NEWLINE
"typ... |
C |
#include <stdio.h>
#include <math.h>
int main ()
{
float f(float x)
{
float y;
y= cos(x/2)-sin(2*x);
return y;
}
float fprima(float x)
{
float y;
y=-(sin(x/2)/2)-2*cos(2*x);
return y;
}
float newtonRaphson(float X0,int iter)
{
int i=0;
float xi, xim,erp;
xi=X0;
printf("i \t Xi \t\t Xi+1 ... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "funciones2.0.h"
int buscarLibre(char vector[][20], int *index, int largo);
int inicializarVector (char vector[][20], int len);
int buscarNombre(char *pNombre,
char lista[][20],
int len,
int *pIndex)
... |
C | #include <stdio.h>
int main()
{
float x = 5;
float y = 3;
float ergebnis;
ergebnis = pow(x, 2) + y;
printf ("Ergebnis von x^2 + y : %f\n", ergebnis);
system ("PAUSE");
return 0;
}
|
C | #include <graphics.h>
#include <stdio.h>
struct line
{
float x1,y1;
float x2,y2;
};
struct line makeline()
{
struct line l;
//Manual entry
printf("Enter x1: ");
scanf("%f", &l.x1);
printf("Enter y1: ");
scanf("%f", &l.y1);
printf("Enter x2: ");
scanf("%f", &l.x2);
printf("Enter y2: ");
scanf("%f", &l.y2... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef char String[128];
typedef enum { false, true } bool;
typedef enum { bird, fish, insect, mammal } typeAnimal;
typedef struct {
typeAnimal type;
double size;
String name;
} Animal;
bool informAnimal (Animal* a);
typeAnimal typeFromString (St... |
C | //lab 04 - Ejercicio 12 - Programa para mostrar el mayor elemento que tiene la lista
#include <stdio.h>
#include <stdlib.h>
typedef struct Nodo{
int valor;
struct Nodo *sgte;
}nodo;
typedef struct Lista{
nodo *ini;
nodo *fin;
int tam;
}lista;
lista *crearLista(){
lista *newlista;
if (newlista=(li... |
C |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <assert.h>
#include <stdint.h>
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include <time.h>
#include "matrixOperations.h"
int file_select(const struct dirent *entry);
int main (int argc, char **argv) {
... |
C | /**
* @file
*
* @version 1.0
*
* @section DESCRIPTION
*
* Implementation of the io_metadata API.
*/
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
#include <string.h>
#include "io_metadata.h"
#include "jansson.h"
#include "logging.h"
/* Private API ************************************************... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* line_not_close.c :+: :+: :+: ... |
C | /*************************************************************************
* ---------> File Name: spawn.c
* ---------> Author: chengfeiZH
* ---------> Mail: chengfeizh@gmail.com
* ---------> Time: 2015年07月28日 星期二 10时52分13秒
************************************************************************/
... |
C | #include <stdio.h>
/*
* cat, reversing each line with a function
*/
#define MAXLINE 1000
int getLine(char s[], int lim);
void reverseStr(char s[]);
int main()
{
int len;
char line[MAXLINE];
while((len = getLine(line, MAXLINE)) > 0)
{
reverseStr(line);
printf("%s\n", line);
}
}
int getLine(char s[], int... |
C | #include "4.h"
// innentől kezdve a SOROK és az OSZLOPOK értéke 2
#define SOROK 2
#define OSZLOPOK 2
int main()
{
int matrix[SOROK][OSZLOPOK]; // 2*2 mátrix
get_matrix(SOROK, OSZLOPOK, matrix); // bekérjük a mátrix elemeit
print_matrix(SOROK, OSZLOPOK, matrix); // kiírjuk a mátrix elemeit
printf("\... |
C | /*
* main.c
*
* Created on: 8 abr. 2021
* Author: eneko
*/
#include "punto.h"
#include "poligono.h"
#include <stdlib.h>
#include <stdio.h>
void imprimePuntosYDistancia(Punto p1, Punto p2);
float perimetro(Poligono poli);
int main(void) {
Punto p = { 1, 2 };
// printf("(%i, %i)\n", p.x, p.y);
//
// //1.1
... |
C | /*
** EPITECH PROJECT, 2017
** 42sh
** File description:
** 42sh
*/
#include "my.h"
static const builtin_t built_po[] = {
{"env", &the_printenv},
{"setenv", &the_setenv},
{"unsetenv", &the_unsetenv},
{"cd", &the_cd},
{"alias", &the_alias},
{"history", &the_history},
{"unalias", &the_unalias},
{"where", &the_w... |
C | #include "among3D.h"
void ft_scale(t_data *data, int x, int y, int color)
{
int a;
int b;
a = (x + 1) * RAD_SCALE;
b = (y + 1) * RAD_SCALE;
x = x * RAD_SCALE;
y = y * RAD_SCALE;
while (y < b)
{
while (x < a)
{
ft_my_pixel_put(data, x, y, color);
x++;
}
x = x - RAD_SCALE;
y++;
}
}
void ft_p... |
C |
#include <stdio.h>
#include <stdbool.h>
#define MAX 7
/*
Al igual que Los anteriores Shell Sort permite el intercambio de numeros dentro de una matriz por mas que estos esten muy separados.
basicamente desplaza al elemento mayor al lugar del elemento menor si esta se encontrara en una posicion con un valor mas ... |
C | #include "shell.h"
#include <path.h>
#include <disk.h>
#include <readline/readline.h>
char *getPrompt()
{
if ( !is_mounted() )
return strdup("➜ ");
char *cwd = get_cwd();
char *prompt = malloc(strlen(cwd) + 4);
strcpy(prompt, cwd);
strcpy(prompt + strlen(cwd), "➜ ");
free(cwd);
return prompt;
}
int main(... |
C | #include "lists.h"
/**
* insert_dnodeint_at_index - inserts a new node at a given position
* @h: head pointer to list
* @idx: position in list to insert node (starts at 0)
* @n: number to store in node
* Return: address of the new node | NULL if it failed
*/
dlistint_t *insert_dnodeint_at_index(dlistint_t **h, u... |
C | /*
* sample.c - deal with sample buffers
*
* Separated from signal.c January 2022
* Written September 2018 by Chuck McManis
*
* Copyright (c) 2018-2019, Chuck McManis, all rights reserved.
*
* I hereby grant permission for anyone to use this software for any
* purpose that they choose, I do not warrant the so... |
C | #include<stdio.h>
int main()
{
int a,i,c,d;
float cel , incInFahr ;
float fahrenheit;
scanf("%d",&a);
for(i=1;i<=a;i++)
{
scanf("%d %d",&c,&d);
fahrenheit = (((cel * 9)/5)+32 ) ;
fahrenheit +=incInFahr;
cel = (5/9*(fahrenheit - 32));
... |
C | /** @file gmst.h
* @brief Implementation of gmst
*
* @author Victor Coman
* @date May 2021
*/
#include "sat_const.h"
#include "gmst.h"
double gmst(double Mjd_UT1)
{
double Secs = 86400.0;
double Mjd_0 = floor(Mjd_UT1);
double UT1 = Secs * (Mjd_UT1 - Mjd_0);
double T_0 = (Mjd_... |
C | #include <stdio.h>
int binary_search(int A[], int key, int imin, int imax)
{
if (imax < imin)
return -1;
else
{
int imid = (imin+imax)/2;
if (A[imid] > key)
return binary_search(A, key, imin, imid-1);
else if (A[imid] < key)
return binary_search(A, key, imid+1, imax);
... |
C | /*
COMPUTE UPC DIGIT.
*/
#include<stdio.h>
#include<ctype.h>
#include<string.h>
#define MAX_LEN 100
void read_string(FILE* in, char* word){
// inputs:
// FILE* in = file to read string from
// char* word = pointer to string entered by user
// Function reads the input file and
// transfers the alphanumeric string
... |
C | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <time.h>
#include "videojuego.h"
extern int32_t time_now_ms(void);
static void jugador_remover(struct videojuego *vj)
{
struct jugador jugadores_restantes[JUGADORES];
return;
pthread_mutex_lock(&vj->lock);
i... |
C | #include "gb.h"
#include <assert.h>
void GB_update_joyp(GB_gameboy_t *gb)
{
if (gb->model & GB_MODEL_NO_SFC_BIT) return;
uint8_t key_selection = 0;
uint8_t previous_state = 0;
/* Todo: add delay to key selection */
previous_state = gb->io_registers[GB_IO_JOYP] & 0xF;
key_selection = (gb->... |
C | /*
* PLC firmware is available under the MIT License. See http://opensource.org/licenses/MIT for full text.
*
* Copyright (C) Dmitry Ognyannikov, 2011
* Created: 19.06.2011 22:26:59
*/
#include "os.h"
void InitPins(void)
{
// Registers: DDRA (mode, direction), PORTA (out data), PINA (input)
//... |
C | #include "problem_st2.h"
// Grammar:
// logic ::= comp {&&, ||} logic | comp
// comp ::= expr {<,>,==, != etc.} expr | expr;
// expr ::= mult {+, -} expr | mult
// mult ::= term {*, /} mult | term
// term ::= ( logic ) | number
struct node_t *
build_syntax_tree(struct lexem_t** lex) {
//printf("\nBuilding syntax ... |
C | /*
* Copyright (C) 2015-2017 Alibaba Group Holding Limited
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
int trap_open(const char *path, int flags)
{
#ifdef WITH_LWIP
return -ENOSYS;
#else
int fd = open(path, flags);
if (fd < 0) {... |
C | #include <stdio.h>
#include <stdlib.h>
#include "tool.h"
#include <time.h>
#define length 10000
int main()
{
int arr1[length];
fillArray(arr1, length);
//Metod bulbashki//
clock_t Start = clock();
BubbleSort(arr1, length);
clock_t End = clock();
printArray(arr1, length);
printf("\nTime of bubble sorting... |
C | /**
* \file /arch/x86/gdt.c
* \brief Contains functions for the GDT (Global Descriptors Table) management
*/
#include <types.h>
#include <x86/gdt.h>
/**
* \brief The kernel GDT
*/
static struct Gdt_entry kgdt[NBR_GDT_ENTRIES] __attribute__ ((__aligned__ (8)));
/**
* \brief The value to load in the GDT register... |
C | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* wchar_handler.c :+: :+: :+: ... |
C | #ifndef __HW_MPU6050_H__
#define __HW_MPU6050_H__
#include <stdint.h>
#include <stdbool.h>
/*
*define struct used for Gyroscope
*if any one want to get Gyroscope data
*he must define this struct first
*/
struct mpu6050Gyroscope
{
int16_t gyroX;
int16_t gyroY;
int16_t gyroZ;
};
/*
*define struct used f... |
C | #include "bubble.h"
#include "heap.h"
#include "quick.h"
#include "set.h"
#include "shell.h"
#include "utilities.h"
#include <inttypes.h>
#include <math.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define OPTIONS "absqhr:n:p:"
#define SEEDMAX 4294967295
#define MAX_COLL... |
C | #include <stdio.h>
main(){
int numero;
numero=1;
for(numero = 1; numero < 57; numero++)
{
printf("%d\n", numero);
}
numero=1;
while( numero < 57)
{
printf("%d\n", numero);
numero++;
}
numero=1;
do
{
printf("%d\n", numero);
numero++;
}
while( numero < 57);
} |
C | #include <stdio.h>
int main()
{
int a;
scanf("%d", &a);
puts(a & 1 ? "1" : "0");
return 0;
}
|
C | #ifndef __POSIX_SEMAPHORE_H__
#define __POSIX_SEMAPHORE_H__
/*==========================================================================
* FILE: semaphore.h
*
* SERVICES: POSIX semaphore API interface
*
* DESCRIPTION: POSIX semaphore API interface based upon POSIX 1003.1-2004
*
* Copy... |
C | //
// Created by q on 3/24/2020.
//
#include "bst.h"
void errMessage() {
perror(ERR_MEM_ALLOC);
exit(EXIT_FAILURE);
}
BSTNodeT * createNode(int key) {
// function that creates a new node
BSTNodeT * n = (BSTNodeT*)malloc(sizeof(BSTNodeT));
if(!n) {
errMessage();
}
else {
n->... |
C | #include <stdio.h>
#include <stdlib.h> /* à compléter pour malloc() et free */
#include <assert.h> /* à compléter pour assert() */
int main(){
int x=1;
int * y;
int ** z;
y = &x ; /* initialisation du pointeur y */
z = (int**) malloc(2*sizeof(int*))... |
C | /*chatroom server function
*想法一(服务端转发):服务端每接受一个客户端的连接就把它的sockfd和sockaddr记录(可用数组记录)下来。
* 当客户端发来消息时,服务端将消息转发给除了该客户端外的所有已连接客户端;
* 当有客户端退出,则把它的sockfd和sockaddr从数组中移除;
*必须包含的功能:可群聊,也可私聊(发送消息时以<IPaddr>或<port>或其<sockfd>开头) (port或者sockfd就会成匿名聊天了)
*考虑拓展的功能:服务端也可发送消息
* */
#include "serv... |
C | ///
/// @file frame.c
/// @headerfile frame.h "frame.h"
///
/// @authors
/// Allisson Barros 12/0055619\n
/// Daniel Luz 13/0007714\n
/// Luiz Fernando Vieira 13/0013757\n
/// Mariana Pannunzio 12/0018276\n
/// Mateus Denucci 12/0053080\n
///
/// @date 28/06/2017
///
/// ... |
C | /*************************************************************************
> File Name: open.c
> Author: ggboypc12138
> Mail: lc1030244043@outlook.com
> Created Time: 2020年08月22日 星期六 20时35分45秒
************************************************************************/
#include <stdio.h>
#include <fcntl.h>
#inc... |
C | /* Simple udp server with stop and wait functionality */
#include"packet.h"
char buffer[100/PDR][PACKET_SIZE];
int totalpkts;
int main(void)
{
FILE* fp=fopen("output.txt","w");
fd_set rfds;
totalpkts = 0;
printf("SERVER TRACE\n\n");
printf("TYPE SEQ.NO SIZE CHANNEL\n\n");... |
C | #include <time.h>
#include <stdio.h>
#include <errno.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include "logger.h"
#include "string_allocation.h"
#define RED_BOLD "\033[1;31m" /* 1 -> bold ; 31 -> red */
#define RED "\033[0;31m" /* 0 -> normal ; 31 -> red */
#define YELLOW ... |
C | #include <sys/wait.h>
#include <signal.h>
#include "print_wait_status.h" /* Declares printWaitStatus() */
#include "tlpi_hdr.h"
void printStatus(int code, int status) {
if (code == CLD_EXITED) {
printf("Child has exited with a status: %d\n", status);
} else if (code == CLD_KILLED) {
pr... |
C | // ======================================================================== //
// Copyright 2009-2015 Intel Corporation //
// //
// Licensed under the Apache License, Version 2.0 (the "License"); //
// y... |
C | #include <stdio.h>
#include <stdlib.h>
#include "function.h"
int maxValue(Node *tree){
int left_max=0, right_max=0, max = tree->data;
if(tree->left) left_max = maxValue(tree->left);
if(tree->right) right_max = maxValue(tree->right);
if(left_max > max) max = left_max;
if(right_max > max) max = right... |
C | #ifndef SQLIST_H_
#define SQLIST_H_
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include <stdbool.h>
//״̬
#define true 1
#define false 0
#define OK 1
#define ERROR 0
//
typedef int Status;
typedef int ElemType;
//˳
typedef struct SqList{
ElemType* elem;
int length;
int listsize;
}Sq, *pSq... |
C | /*
author : ryoma okuda
id : s1270174
*/
#include <stdio.h>
#include <stdlib.h>
#define A 48271L
#define M 2147483647L
#define Q (M / A)
#define R (M % A)
static int x = 1;
int data[100];
int next_rnd2(void)
{
x = A * (x % Q) - R * (x / Q);
if (x < 0)
x = x + M;
return x;
}
int main()
{
... |
C | #include "libmx.h"
static void printerr_line(int i);
static void empty_lines(char *strarr);
static void INVLD_LINE_ASCII(char **strarr);
static void INVLD_LINE_INPUT(char **strarr);
static void INVLD_LINE1_DIGIT(char *strarr);
static void INVLD_FILE(int c, char *v[]);
void mx_pf_errors(int c, char *v[]) {
INVLD_... |
C | #include <stdio.h>
#include <string.h>
#include <winsock.h>
#define MAXLINE 1024
int main(int argc, char** argv) {
WSADATA wsadata;
SOCKET sd;
struct sockaddr_in serv;
int i, n, serv_len = sizeof(serv);
char str[1024] = "How are you?";
// Is WSAStartup() U WinSock DLL ϥ
WSAStartup(0x1... |
C | #ifndef __DEQUE_H__
#define __DEQUE_H__
#define TRUE 1
#define FALSE 0
typedef int Data;
typedef struct _node
{
Data data;
struct _node *prev;
struct _node *next;
} Node;
typedef struct _DLdeque
{
Node *head;
Node *tail;
} DLDeque;
typedef DLDeque Deque;
void DequeInit(Deque *pdeq);
int DQIsEmpty(Deque *pdep... |
C | #include "holberton.h"
#include <stdio.h>
#include <stdlib.h>
/**
* _strdup - hat returns a pointer to a newly allocated space in memory
* @str: string
* Return: Return NULL if str = 0
*/
char *_strdup(char *str)
{
int largo;
char *b;
char *c;
if (str == NULL)
return (NULL);
while (str[largo] != '\0')
{
... |
C | #include<stdio.h>
#include<stdlib.h>
int cmp(const void *a,const void *b)
{
return *(int*)a-*(int*)b;
}
int main() {
int t, n;
scanf("%d",&t);
while(t--){
int n,l[10002];
scanf("%d",&n);
for (int i = 0; i < n; i++)
scanf("%d",&l[i]);
qsort(l,n,sizeof(int),cmp);
int max = 0;
for (int k = 2; k... |
C | #include<stdio.h>
int main(int argc, char const *argv[])
{
int i;
printf("number square cube\n");
for(i=0; i<=10; i++){
printf("%d %6d %6d\n", i, i*i, i*i*i);
}
return 0;
}
|
C | //
// Created by snorcros on 11/18/20.
//
#include "mpi_labs.h"
/**
* Реализуйте на основе технологии MPI
* многопоточную программу умножения
* длинных целых чисел методом Шёнхаге — Штрассена
* */
// Инициализация массива, представляющего собой число
void init_num(int *num, int len, int simple)
{
int i;
i = 0;... |
C | #include "utils.h"
bool checkIfLabelStringIsValidInInstruction(char* input_word)
{
while (*input_word) {
if (!isdigit(*input_word) && !isalpha((*input_word)))
return false;
input_word++;
}
return true;
}
bool checkIfLabelStringIsValidInStart(char* input_word) {
int count = 0;
int check = str... |
C | /*
** my_swap.c for my_swap in /home/rosey_c/rendu/Piscine-C-simple
**
** Made by rosey
** Login <rosey_c@epitech.net>
**
** Started on Fri Oct 18 16:31:29 2013 rosey
** Last update Fri Oct 18 17:21:20 2013 rosey
*/
int my_putchar(char c)
{
write(1, &c, 1);
}
int my_swap(int *a, int *b)
{
int ptr;
ptr ... |
C | #include "tabrakan.h"
#include <stdlib.h>
void gambarHancur(titik p) {
//titik pe = {p.x,p.y};
int i = 0;
//titik pd = {p.x+10,p.y-10};
for (i=0;i<10;i++) {
usleep(50000-(i*5000));
warna c = {255, 10+20*i, 0, 255};
bufferDrawCircle(p, 10-1*i, c);
}
for (;i>=0;i--) {
usleep(100000-(i*10000));
warna ... |
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>
#include <sys/socket.h>
#include <netinet/in.h>
int main(){
int socked_id = 0;
int conexion = 0;
char msm[]="Mi primer socket exitoso";
//Estructura de conexion al server
struct sockaddr_in Server_Ramon ;
Server_Ramon.sin_family= AF_INET;//Familia de protoc... |
C | #include<stdio.h>
int main()
{
int i,n,rem;
printf("Enter Any Digits of No");
scanf("%d",&n);
for (i=0; i<=n; i++)
{
rem=n%10;
printf("%d",rem);
n=n/10;
}
return 0;
} |
C | #define TT_TRACE_MODULE_NAME "single_list_entry_demo"
#define TT_TRACE_DEBUG 1
#include "ttlib.h"
#include "../color.h"
typedef struct __tt_demo_single_list_entry_t{
tt_single_list_entry_t entry;
tt_size_t user_data;
}tt_demo_single_list_entry_t, *tt_demo_single_list_entry_r... |
C | /*!
* @file
*
* GL EmbeddedProCamp - Task#1
*
* Task: Create function to copy all \b digits
* from input string to output string
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
//! Test, if char in range of ANSI-table digits(0x30~0x39 char code).
#define IS_ANSI_DIGIT(char) \... |
C | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void)
{
long a;
long b;
long buf;
if (scanf("%ld", &a) != 1 || scanf("%ld", &b) != 1)
return EXIT_FAILURE;
buf = a;
a = b;
b = buf;
printf("%ld %ld", a, b);
return EXIT_SUCCESS;
}
|
C | #include <stdio.h> // printf
#include <math.h> // round
#define LOWER -50
#define UPPER 300
#define STEP 40
void header(int); // Ex. 1-15
int conv(int, int);
int main () {
/* flags:
dir for 1-4
ord 1-5 */
int t, dir = 1, ord = 0;
header(dir);
for (t = (ord == 1 ? LOWER : UPPER); // Ex. 1-5 up or... |
C | #include <stdio.h>
int main()
{
float length, width, area;
length = 27.2;
width = 13.8;
area = length * width;
printf("The length of the rectangle is %f", length);
printf("\nThe width of the rectangle is %f", width);
printf("\nThe area of the rectangle is %f", area);
return 0;
}
|
C | # include <stdlib.h>
# include <stdio.h>
# include <math.h>
# include <time.h>
# include <string.h>
# include "triangle_svg.h"
int main ( );
void test01 ( );
/******************************************************************************/
int main ( )
/**************************************************************... |
C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <time.h>
#include "define.h"
void copyPosStruct( struct Position pos, struct Position* pos0 )
{
int i,x,y;
for( i=0; i<256; i++ )
{
pos0->board[i] = pos.board[i];
pos0->boardNum[i] = pos.boar... |
C | #include<stdio.h>
void main(){
char ch1,ch2,ans;
printf("Enter two character:\n");
scanf("%c %c",&ch1,&ch2);
printf("ch1 = %c\n",ch1);
printf("ch2 = %c\n",ch2);
printf("ch1 ascii = %d\n",ch1);
printf("ch2 ascii = %d\n",ch2);
// ans = ch1 + ch2;
// printf("Addition of ch1 and ch2 in characters = %c\n",ans);
// pr... |
C | #include <stdio.h>
main()
{
float celsius, fahr;
int lower, upper, step;
lower = -20;
upper = 150;
step = 10;
celsius = lower;
while (celsius < upper) {
fahr = celsius * (9.0 / 5.0) + 32.0;
printf("%3.0f\t%3.0f\n", celsius, fahr);
celsius = celsius + step;
}
}
|
C | #define _USE_MATH_DEFINES
#include "geo_sphere.h"
#include <GL/glew.h>
#include <GL/gl.h>
#include <math.h>
void drawTexturedSphere(float r, int segs) {
int i, j;
float x, y, z, z1, z2, R, R1, R2;
// Top cap
glBegin(GL_TRIANGLE_FAN);
glNormal3f(0,0,1);
glTexCoord2f(0.5f,1.0f); // This is an ugly (u,v)-... |
C | #include "variadic_functions.h"
/**
* print_numbers - function that prints numbers, followed by a new line.
* @separator: const char
* @n: const unsigned int
* @...: any arguments
* Return: void
*/
void print_numbers(const char *separator, const unsigned int n, ...)
{
va_list list;
unsigned int surplus = n;
... |
C | /**************************************************************
* Brett Waugh
* 4 October 2017
* Checks to see if the Universal Product Code (UPC) is valid.
**************************************************************/
#include <stdio.h>
int main(void)
{
// Declarations.
int d, i1, i2, i3, i4, i5, j1, j2, j3, j4,... |
C | #include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int main(int s,char *str[])
{
int l,a,count;
char *str[]="Vinoth ravi";
a=a_to_i(str[]);
l=strlen(str);
for(count=0;count<1;count++)
{
if(str[count]=='a'&&'A'||str[count]=='e'&&'E'||str[count]=='i'&&'I'||str[count]=='o'&&'O'||str[count]=='u'&&'U';
{
printf("vowel a... |
C | #include<stdio.h>
int ft_putchar(char c)
{
write(1, &c, 1);
return 0;
}
void ft_print_numbers(void)
{
char num;
num = '0';
while (num <= '9')
{
ft_putchar(num);
num++;
}
}
int main(){
ft_print_numbers();
return 0;
}
|
C | int gcd(int u,int v)
{
if (v==0) return u;
else return gcd(v,u-u/v*v);
/*it's a comment*/
}
int main(void){
int x;
int y;
x=1;
y=1;
gcd(x,y);
} |
C | /* This is a test program for cmpeq8 instruction. */
/* { dg-do run } */
/* { dg-options "-march=rv32gc_zpn -mabi=ilp32d -O2" } */
#include <rvp_intrinsic.h>
#include <stdlib.h>
#include <stdint.h>
static __attribute__ ((noinline))
uint32_t cmpeq8 (uint32_t ra, uint32_t rb)
{
return __rv_cmpeq8 (ra, rb);
}
static... |
C | #include<stdio.h>
int main()
{
int num;
int start;
printf("Enter a number to check prime:\n");
scanf("%d",&num);
for(start=2;start<num;start++)
if(num%start==0)
break;
if(num==start)
printf("given number is a prime number\n");
else
printf("given number is not a prime number\n");
return 0;
}
|
C | #include "sgr.h"
#include "stdio.h"
static uint8_t get_mode(uint32_t mode) {
switch(mode) {
case 0x80000:
return 1;
case 0x100000:
return 4;
case 0x40000:
return 5;
case 0x200000:
return 7;
default:
return 0;
}
}
void sgr_sequence(uint32_t attribute,... |
C | #include <stdio.h>
//Takes numbers and tells you what grade they would receive.
//Greater than 89 is an A, less than 60 is an F, -1 breaks the scan loop.
int main()
{
int x;
while (printf("Please enter a grade:\n") && scanf("%d", &x) && x != -1) {
printf("%c\n", x<100?x>59?'J'-(x/10):'F':'A');
}
return 0;
} |
C | /**
* Author : Atul Pundhir
* Description: Program for Change dispenser
*/
#include <stdio.h>
#include <cs50.h>
#include <math.h>
int main(void){
float n=0.0;
int k = 0;
//User input and validation
do{
printf("O hai! How much change is owed?\n");
n = GetFloat();
}while(... |
C | #include<stdio.h>
#include<stdlib.h>
int main(void){
int n,num;
int i,j,k,l;
int **store;
scanf("%d",&n);
int *output = (int*) malloc (sizeof(int)*n);
for(i=0;i<n;i++){
scanf("%d",&num);
store = (int**) malloc (sizeof(int*) * num);
for(k=0;k<num;k++)
... |
C | #include <stdlib.h>
#include "queen_attack.h"
#define BOARD_SIZE 8
uint8_t is_off_board(position_t p) {
return (p.row >= BOARD_SIZE || p.column >= BOARD_SIZE);
}
attack_status_t can_attack(position_t queen_1, position_t queen_2) {
if (is_off_board(queen_1) || is_off_board(queen_2)) {
return INVALID_P... |
C |
#include <stdlib.h>
#include <ctype.h>
#include <signal.h>
#include <event2/event.h>
#include "util.h"
void fprintf_bytes(FILE *fp, const void *b, size_t l)
{
const char *buf = b;
for(;l; l--, buf++) {
char c = *buf;
if(isprint(c))
fputc(c, fp);
else
fprintf(... |
C | #include "config.h"
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#if defined(HAVE_FUNC_GETTIMEOFDAY) && defined(HAVE_SYS_TIME_H)
#include <sys/time.h>
#endif
#if defined(HAVE_FUNC_TIME) || defined(HAVE_FUNC_CLOCK_GETTIME)
#include <time.h>
#endif
#if defined(HAVE_FUNC_GSTAFT)
#include <windows.h>
#... |
C | #define _POSIX_C_SOURCE 200809L
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <error.h>
#include <stdlib.h>
#include <assert.h>
void handler();
int main() {
struct sigaction action;
action.sa_handler = handler;
sigemptyset ( &action.sa_m... |
C | #pragma once
typedef struct _linked_list LinkedList;
LinkedList* list_instanteate();
int list_add(LinkedList* list, void* elem);
int list_insert(LinkedList* list, int index, void* elem);
int list_add_first(LinkedList* list, void* elem);
int list_clear(LinkedList* list);
LinkedList* list_clone(LinkedList* list);
int lis... |
C | #include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h>
#include <signal.h>
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/time.h>
#include <stdlib.h>
#include <memory.h>
#include <string.h>
#include <dirent.h>
#defin... |
C | /*
* This file is part of GreatFET
*/
#include <gpio.h>
#include <gpio_lpc.h>
#include <greatfet_core.h>
#include "one_wire.h"
static struct gpio_t dq = GPIO(5, 8);
/* In the future we'll use a timer for the delay
* but for now a delay of 100 us is delay(3000)
*/
uint8_t one_wire_init_target(void)
{
gpio_output... |
C | /*
Write a program that prints an n X n magic square (a square arragement of the numbers
1, 2, ...., n^2 in which the sum of the rows, colums, and diagonals are all the same.)
The user will specify the value of n:
This program creates a magic square of a specified size.
The size must be odd number between 1 and 99.
En... |
C | #include<stdio.h>
#include<stdlib.h>
typedef struct LNode{
int data;
struct LNode* next;
}LNode, *LinkList;
LinkList fun(LinkList L,int x){
if(L){
if(L->data==x){
LinkList p;
L->next=fun(L->next, x);
p=L; //注意内存泄露!!!
L=L->next;
free(p);
}else{
L->next=fun(L->next,x);
}
}
return L;
}
int ma... |
C | #include<stdio.h>
#include<math.h>
#define pr 0.0000001
long double newtonRaphson(long double x,long double c){
long double h = (2*x*x*x+6*x*x+7*x-3*c)/(6*x*x+12*x+7);
while (fabs(h) >= pr)
{
h = (2*x*x*x+6*x*x+7*x-3*c)/(6*x*x+12*x+7);
x = x - h;
}
return x;
}
int main(){
int t;... |
C | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
srand(time(NULL));
int size;
printf("Give me a number: \n");
scanf("%d", &size);
char Array[size][size];
for (int i=0; i<=size-1;i++){
for (int j=0; j<=size-1;j++){
Array[i][j]='*';
}
}
for (int i=0; i<=size-1;i++){
fo... |
C | #include "maze.h"
/*
Add your implementation of the functions in "maze.h" here.
*/
struct maze* maze_create(struct location *init_valid_locations,
int valid_location_count,
struct location init_location_start,
struct location init_location_end)
{... |
C | /*
* mm_alloc.c
*
* Stub implementations of the mm_* routines. Remove this comment and provide
* a summary of your allocator's design here.
*/
#include "mm_alloc.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>
#include <sys/resource.h>
/* Your final implementation should commen... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.