language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include "dht11.h" #include "delay.h" ////////////////////////////////////////////////////////////////////////////////// //ֻѧϰʹãδɣκ; //ALIENTEKսSTM32 //DHT11ʪȴ //ԭ@ALIENTEK //̳:www.openedv.com //޸:2012/9/12 //汾V1.0 //ȨУؾ //Copyright(C) ӿƼ޹˾ 2009-2019 //All rights reserved //////////////...
C
#include <stdio.h> #include <string.h> int main() { int ara[10],i = 0; ara[1] = 101; ara[5] = 2000; ara[2] = 200; ara[0] = 100; ara[3] = 300; ara[4] = 1000; while(i < 6){ printf("%d ",ara[i]); i++; } return 0; }
C
// HashTable.c ... implementation of HashTable ADT // Written by John Shepherd, May 2013 #include "HashTable.h" // convert key into index (from Sedgewick) unsigned int hash(Key k, int tableSize) { unsigned int h = 0; unsigned int h2 = 0; // int a = 31415, b = 27183; // for (; *k != '\0'; k++) { // a = a*b ...
C
/* SAMR3 - wiring Created on: 01.01.2020 Author: Georgi Angelov This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any lat...
C
#include <stdlib.h> #include <stdio.h> #include <unistd.h> #include <string.h> #include <sys/socket.h> #include <arpa/inet.h> #include <fcntl.h> #define BUFFERSIZE 2000 #define PORT 25969 int main() { // variable int sockdf; int recv_size, write_size; struct sockaddr_in servAddr; char buffer[BUFFERSIZE]; // cr...
C
#include <string.h> #include <stdio.h> int ft_strcmp (const char *d, const char *s) { while (*d != '\0') { if (*d != *s) return *d - *s; d++; s++; } return *d - *s; } int main(void) { char d[10] = "bonjour"; char s[10] = "salut"; printf("ft_strcmp : %d\n", ft_strcmp(d, s)); printf("strcmp : %d\n", f...
C
#define PTLIB_IMPL #include "ptlib.h" int main(){ /* ----INITIALIZE FIRST SCREEN---- */ ptlRaster screen1; screen1 = ptlInitRaster(25, 20, '.'); ptlDrawText(screen1, 5, 7, "Hello from screen 1"); while (1){ // ALWAYS store the return value of ptlPressedKey() in an integer, an...
C
/******************************** Author: Sravanthi Kota Venkata ********************************/ #include "sdvbs_common.h" F2D* imageBlur(I2D* imageIn) { int rows, cols; F2D *imageOut, *tempOut; float temp; I2D *kernel; int k, kernelSize, startCol, endCol, halfKernel, startRow, endRow, i, j, ker...
C
/* * ihave.c * * Authors: Ke Wu <kewu@andrew.cmu.edu> * * Date: 10/23/2015 * * Description: the file is used for process the received ihave packet and * send a new ihave packet */ #include "ihave.h" /* process a IHAVE packet that is received from network */ void process_Ihave_packet(int len, ch...
C
/* * File: person.h * Author: psycku * * Created on 2 de Fevereiro de 2013, 0:27 */ #ifndef PERSON_H #define PERSON_H #include <stdio.h> #include <stdlib.h> #include <time.h> #include <ctype.h> #include "utilities.h" //Size of the string named "name" #define NAME_LENGTH 80 //Size of the string named "street" #...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* fractols1.c :+: :+: :+: ...
C
// Program to calculate the number of days between two user entered dates #include <stdio.h> #include <stdbool.h> struct date{ int month, day, year; }; // Function to find the number of days in a month int numberOfDays(struct date d) { int days; bool isLeapYear(struct date d); const int daysPerMonth...
C
#include <stdio.h> #include <string.h> #include <stdlib.h> #define BUF_SIZE 1024 int main(int argc, char** argv) { if (argc < 3) { fprintf(stderr, "%s ctext keyfiles...\n", argv[0]); return -1; } size_t n_files = argc - 1; FILE** files = malloc(n_files * sizeof(FILE*)); for (int i = 1; i < argc; +...
C
#include <detpic32.h> void delay(int ms) { for (;ms>0; ms--) { resetCoreTimer(); while(readCoreTimer()<20000); } } void putc(char byte2send) { if (U2STAbits.OERR==1) { U2STAbits.OERR=0; } while(U2STAbits.UTXBF==1);// wait while UTXBF == 1 U2TXREG=byte2send;// Copy byte2send to the UxTXREG...
C
#include <stdlib.h> #include <stdio.h> /* Inheritance emulation using Animal as abstract base class. */ typedef struct Animal_vtable { void (*eat)(void *); void (*sound)(void *); } Animal_vtable; typedef struct Animal { Animal_vtable *vtable; } Animal; void Animal_eat(Animal *animal) { animal->vtable->eat(an...
C
#include <stdio.h> #include <stdlib.h> #include "gumbo.h" void search_for_links(GumboNode* node); void search_for_links(GumboNode* node) { if (node->type != GUMBO_NODE_ELEMENT) { return; } GumboAttribute* href; GumboAttribute* name; char *hrefstr = NULL; char *hrefname = NULL; if (node->v.element.tag == GUMBO_T...
C
/* ********************* TEXTO SIN ACENTOS *********************/ // Recuerda documentar tus codigos #include <stdio.h> int main() { int inicial = 6, final=10, i; for(i=final; i>inicial; i--) { printf("%d\n",i); } }
C
#include "stdio.h" //冒泡排序 int bubble_sort(int *buf, int size) { int i, j; if(size <= 0) return -1; for(i = 0; i < size - 1; i++){ for(j = 0; j < size - 1 - i; j++){ if(buf[j] < buf[j+1]){ int tmp = buf[j]; buf[j] = buf[j + 1]; b...
C
// What is the difference in meaning between the following pairs (a/b and c/d) of groups of C statements: #include <stdio.h> int main(void) { int x = 1; // a. if (x == 0) { printf ("zero\n"); } // b. if (x == 0) printf ("zero\n"); // c. if (x == 0) { printf (...
C
#include <stdio.h> #include <stdlib.h> /*4.3.4 Insero de caractere 1 Implementar um programa que insere hfens entre as letras de uma cadeia de caracteres, como em f-a-b-u-l-o-s-o.*/ int main() { char caracteresDigitado[100]; int i = 0; printf("Escreva a palavra desejada: "); scanf("%s", caracteresDigi...
C
#pragma once struct AABB { float3 Low; float3 High; }; __device__ AABB WorldPositionAABB; __device__ __inline__ void atomicMin(F32* ptr, F32 value) { U32 curr = atomicAdd((U32*)ptr, 0); while (value < __int_as_float(curr)) { U32 prev = curr; curr = atomicCAS((U32*)ptr, curr, __float_as_int(value)); if (cu...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "list.h" int main(){ //Test case with empty list printf("Starting of Test Case 1\n"); printf("\n"); printf("\n"); list* A = create_list(); remove_from_list(A); print_list(A); flush_list(A); free_list(A); printf("\n"); printf("\n"); //Test...
C
#include "holberton.h" /** *rot13 - function that rotate with 13 places. * *@s:char * * Return: char. */ char *rot13(char *s) { char *str = s, *rot13start = ROT13START, *rot13over = ROT13OVER; int i = 0; for (; *s; s++) { for (i = 0; rot13start[i]; i++) if (*s == rot13start[i]) { *s = rot13over[i]...
C
//If an array arr contains n elements, then write a program to check if arr[0] = arr[n-1], arr[1] = arr[n-2] and so on. #include<stdio.h> int main() { int arr[100],n,i,f=0; printf("Enter total numbers of array(n): \n"); scanf("%d",&n); printf("Enter number of array: \n"); for(i=0; i<n;...
C
#include "exception.h" #include <stdint.h> #include <errno.h> #include <libc.h> #include <kernel/interrupt.h> void exception_init() { /* Install handlers */ interrupt_install(EXCEPTION_DE, exception_handler_de); interrupt_install(EXCEPTION_DB, exception_handler_db); interrupt_install(EXCEPTION_NMI, exception_handl...
C
#include"func.h" int is_file_exist(char *filename) { char *pwd = getcwd(NULL,0); DIR *dir = opendir(pwd); if(NULL==dir) { perror("opendir"); return -1; //means fail } struct dirent *q = NULL; while((q=readdir(dir))!=NULL) { if(strcmp(q->d_name,filename)==0) { return 0; } } return -1; } int recv_...
C
#include "mex.h" #include <string.h> #include "libusb.h" /* Pointer to the USB device */ libusb_device_handle *device = NULL; /* USB time out in milliseconds */ const unsigned int timeout = 5000; /* Clear-up function */ static void clearup(void) { if (device != NULL) { libusb_release_interface(device, 0)...
C
#include "myheader.h" #include "FractionalAddition.h" int main(int argc, char* argv[]) { /** * The c language project main program */ fenshu L; char a; int c; printf("是否建立链表(y/n):"); scanf("%c", &a); getchar(); if(a =='y' || a == 'Y') { system("cls"); L = initlist(L); c = getlist(L); p...
C
#include "debug.h" char * tag_names[] = { "free ", "marked ", "unmarked ", "stack_return", }; char * type_names[] = { "reference ", "error ", "symbol ", "keyword ", "string ", "number ", "list ", "dic...
C
#include <windows.h> HINSTANCE hInstance; HWND hMainWindow; HDC hMemDC, hBlockDC; HBITMAP hMemPrev, hBlockPrev; int board[12][25]; typedef struct _TAG_POSITION { int x; int y; } POSITION; typedef struct _TAG_BLOCK { int rotate; POSITION p[3]; } BLOCK; BLOCK block[8] = { {1...
C
//gcc main.c -std=c99 -O3 -s -lglfw3 -lopengl32 -lglu32 -lgdi32 // #include <GL/glu.h> #include <GLFW/glfw3.h> #include <stdlib.h> #include <stdio.h> #define NUMBER_OF_SHAPES 50 #define MAX_BUFFER 1200 #define LOWER_LIMIT -14.0f #define UPPER_LIMIT 14.0f #define RIGHT_LIMIT 18.5f #define LEFT_LIMIT ...
C
#ifndef INPUTHANDLER_H_INCLUDED #define INPUTHANDLER_H_INCLUDED void inputHandler(char input) { if(input == 'w') { movePlayer(-1); drawPlayer(); }else if(input == 's') { movePlayer(1); drawPlayer(); }else if(input == ' ') { int turret_index = player->y-M...
C
#include "hey.h" int sock, my_ppid, my_id; pthread_t tid_send_hey; pthread_t tid_get_hey; pthread_mutex_t mutex; void Clean_Up() { char msgout[MAX_LINE]; char my_host[MAX_HOST_NAME]; printf("\nHey Client goes bye bye."); pthread_kill(tid_get_hey, SIGINT); pthread_kill(tid_send_hey, SIGINT...
C
#include <yaml.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "yaml-path.h" #define INDENT " " #define STRVAL(x) ((x) ? (char*)(x) : "") void indent(int level) { int i; for (i = 0; i < level; i++) { printf("%s", INDENT); } } void print_event(yaml_event_t *event) { static int level = 0...
C
#include <assert.h> #include <limits.h> #include <math.h> #include <stdbool.h> #include <stddef.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main() {int n,i,j; scanf("%d",&n); for (int i = 1; i <= n; i++) { for (int j = n; j > i; j--) { printf(" "); ...
C
#include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <fcntl.h> int main(int argc, char* argv[]){ mkfifo("fifo", 0600); //só o user pode ler e escrever int entrada = open("fifo", O_RDONLY); char buf[100]; int bytesRead; while((bytesRead = read(entrada, buf, 100))>0){ ...
C
#include <errno.h> #include <stdio.h> #include <strings.h> #include <string.h> #include <stdlib.h> #include "server.h" #include "pgsql_manager.h" static void initPG(PGManager *this); PGManager createPManager() { PGManager this; this.conninfo = "dbname = epicopter"; initPG(&this); this.free = freePManager; ...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_sorted_list_insert.c :+: :+: :+: ...
C
/*Yufan Fei / yfei1 / 113169434 / Section#0403 */ /*I pledge on my honor that I have not given or received any unauthorized assistance on this assignment.*/ /* There are four functions listed below: 1) Print out assembly code(32bits) as human readable words 2) Apply the first function to part of a given array prece...
C
/*********************************************************** Project: Semester Project Company: CPE 490 Embedded Systems Author: Andrew Davies File: gui.c Purpose: functions to create the GUI ***********************************************************/ //**Includes**// #include "gui.h" #include "vga.h" //**Defi...
C
#include <stdio.h> #include <stdlib.h> #include "mystery.h" int array[200]; int add(int x, int y) { return x + y; } int dothething(int value) { int temporary = 0; if (array[value] == -1) { if (value == 0) { array[value] = 0; } else if (value == 1) { array[value] =...
C
#include "../vgmstream.h" #ifdef VGM_USE_G7221 #include "meta.h" #include "../util.h" #include "../coding/coding.h" /* .s14 and .sss - from Idolm@ster DS (and others?) * Raw 24kbit Siren 14 stream, s14 is mono and sss is * frame-interleaved stereo */ VGMSTREAM * init_vgmstream_s14_sss(STREAMFILE *streamFile) { ...
C
/* template * * T. Hennessy * * Description: */ #include <stdio.h> #include <stdlib.h> #include "strings.h" #define MAX_STR_SIZE 256 int main(int argc, char *argv[]) { char in[40], out[40], *ptr; int len; printf("Input a short string\n"); scanf("%39s", in); printf("Input another stri...
C
/* bosh.c : BOSC shell */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <ctype.h> #include <string.h> #include <readline/readline.h> #include <readline/history.h> #include <signal.h> #include "parser.h" #include "print.h" /* --- symbolic constants --- */ #define HOSTNAMEMAX 100 /* --...
C
// Needed by rgb2hsv() float maxrgb(float r,float g,float b) { float max; if( r > g) max = r; else max = g; if( b > max ) max = b; return( max ); } // Needed by rgb2hsv() float minrgb(float r,float g,float b) { float min; if( r < g) min = r; else min = g; ...
C
#include<stdio.h> #include<ctype.h> int main() { char str[30], *p; gets(str); p=str; while(*p) { *p++=tolower(*p); } printf("%s\n\n", str); p=str; while(*p) { printf("%c", toupper(*p)); p++; } }
C
/* Program description: Usage of the ternary if operator */ #include <stdio.h> main() { int w, x, y, z; w = 5; x = 10; y = (x > w) ? x : w; printf("\ny: %d\n", y); (x > w) ? (z = x) : (z = w); printf("z: %d\n", y); }
C
// Program to print greatest of three values #include<stdio.h> void main() { int a,b,c; printf("Enter values"); scanf("%d %d %d",&a,&b,&c); if(a>b&&a>c) { printf("a is greatest"); } else if(b>c&&b>a) { printf("b is greatest"); } else { printf("c is greatest"); } }
C
/* ** my_isalpha.c for my_isalpha in /home/TiphaineLaurent/Library/V2/srcs/my ** ** Made by Tiphaine LAURENT ** Login <TiphaineLaurent@epitech.net> ** ** Started on Tue Apr 25 15:55:12 2017 Tiphaine LAURENT ** Last update Sun Apr 30 00:39:10 2017 Tiphaine LAURENT */ #include "my.h" bool my_isalpha(const char c)...
C
#include <stdio.h> int main(void) { char * p1 = "Klingon"; printf("%s\n", p1); p1[0] = 'F'; printf("%ss!", "Klingon"); return 0; }
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_transfer_from_b_to_a.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdbool.h> #include <stdlib.h> #include <string.h> #include <mqueue.h> #include <time.h> #include <errno.h> #include "mixedAPI.h" #include "mixedAPI_defines.h" #include "llist.h" #include "llist_structs.h" #include "llist_defines.h" #include "debug.h" /***********************************...
C
#include <float.h> #include <stdio.h> #include "color.h" #include "math_.h" #include "matrix.h" #include "opengl.h" static float const GAMMA = 2.2f; float const U_AMPLITUDE = 0.436f; float const V_AMPLITUDE = 0.615f; Color const BLACK = {0, 0, 0}; Color const RED = {1, 0, 0}; Color const GREEN = {0, 1, 0}; C...
C
/* ** EPITECH PROJECT, 2018 ** sort_number.c ** File description: ** sort my number */ #include "my.h" #include <stdio.h> #include <stdlib.h> #include <string.h> void sort_number2(char ***x, char ***y, int k) { char *stock = NULL; char *stock_y = NULL; if (atof((*x)[k]) > atof((*x)[k + 1])) { stock = strdup((*...
C
#include "minishell.h" static int red_null(char **file_name, t_all *all) { int fd; close(all->redirect_1); fd = open(*file_name, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd == -1) { printf("%s\n", strerror(errno)); free(*file_name); return (1); } all->redirect_1 = fd; return (0); } static int red_one(c...
C
#include <stdio.h> #include <stdlib.h> #include <math.h> long long f(int n) { if (n == 1) { return 1; } return n * f(n - 1); } int main() { int n; scanf("%d", &n); printf("%ld", f(n)); return 0; }
C
#define DIST_BONECO 25 void bubble( int v[], int qtd ) { int i; int j; int aux; int k = qtd - 1 ; for(i = 0; i < qtd; i++) { for(j = 0; j < k; j++) { if(v[j] > v[j+1]) { aux = v[j]; v[j] = v[j+1]; v[j+1]=aux; } } k--; } } bool ult...
C
#include <stdio.h> enum car_type {VOLVO, TOYOTA, LAND_ROVER, TESLA}; struct car { enum car_type type; double km; double gas; }; // TODO: // Write a function that takes a Car as an argument and prints all it's stats // If the car is a Tesla it should not print it's gas level void print_all_data(struct ca...
C
#include<stdio.h> #include<math.h> #define pi acos(-1) int main() { double l,t,i,s,ra,f,n,h; scanf("%lf",&t); for(i=1;i<=t;i++) { n=0; scanf("%lf",&l); n=l/5; h=l*6/10; ra=l*h; s=pi*n*n; f=ra-s; printf("%0.2lf %0.2lf\n",s,f); } //p...
C
void createNewUserc() { int i = 0; printf("******************Creating A New Account******************\n"); printf("*Required fields\n"); do { if( i > 0) printf("\nUsername already exists"); i++; memset(buff,0, LENGTH); memset(buffUsername,0,16); printf("\n*Username:"); scanf("%s...
C
#include<stdio.h> #include<stdlib.h> //ð // //ֵ void swap(int *x, int *y) { int tmp = *x; *x = *y; *y = tmp; } void bubble_sort(int arr[], int size) { //bound߽ //γ[bound,size],[i,bound] int bound = 0; int i = 0; for(bound = 0; bound < size; bound++) { for(i = 0; i < bound ; i++) { //жǰĴС if(arr[i] ...
C
#include "adc.h" void adc_init() { GPIO_InitTypeDef GPIO_InitStructure; ADC_InitTypeDef ADC_InitStructure; RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_AFIO|RCC_APB2Periph_ADC1,ENABLE); RCC_ADCCLKConfig(RCC_PCLK2_Div6);//12M 14M ADCʱӣADCCLK GPIO_InitStructure.GPIO_Pin=GPIO_Pin_7;//ADC GPIO_Init...
C
/* prog0601.c */ #include <stdio.h> int linear_search(int key, int data[], int n) { int i; for( i=0 ; i<n ; i++ ){ if( data[i] == key ){ return i; } } return -1; } int main(void) { int data[10] = {4,1,2,7,9,5,3,8,6,10}; int x, found; scanf("%d", &x); found ...
C
#include "Lista.h" struct lista{ char valor; struct lista *prox; }; typedef struct lista Lista; Lista* cria(){ return NULL; } Lista* concatenar(Lista *l1, Lista* l2){ if(l1->prox == NULL){ l1->prox = l2; } else{ concatenar(l1->prox,l2); } } int contaCell(Lista *l){ if(l==NULL){ return 0; } else{ ...
C
#include <stdlib.h> #include <stdio.h> #include <string.h> #include <sys/stat.h> #include <sys/types.h> #include <mqueue.h> #include <unistd.h> #include <sys/mman.h> #define SHM_NAME "/kol_shm" #define MAX_SIZE 1024 int main(int argc, char **argv) { sleep(1); int val = 0; int desc = shm_open(SHM_NAME, O_...
C
void start_measurement(); void end_measurement(); void print_float(float); float pi(float num_its) { float res = 0.0; float i = 0.0; for(; i < num_its; i=i+2.0) { res = res + (4.0 / (1.0 + (i*2.0))); res = res - (4.0 / (1.0 + ((i+1.0)*2.0))); } return res; } int main() { start_measurement(); float res =...
C
/*********************************************************************** * $Id:: lpc_swim_font.c 745 2008-05-13 19:59:29Z pdurgesh $ * * Project: Font management for SWIM * * Description: * See the sma_swim_font.h header file for a description of this * package. * *****************...
C
/* ** EPITECH PROJECT, 2018 ** lib_my ** File description: ** my_memset.c */ #include "my.h" void *my_memset(void *b, int c, size_t len) { size_t i = 0; unsigned char ch = (unsigned char)c; unsigned char *s = (unsigned char *)b; while (i < len) { s[i] = ch; i++; } return (b); ...
C
/* * UART196.c * * Created on: 2015-6-26 * Author: Isaac */ #include<msp430x16x.h> #include"UART169.h" typedef unsigned char uchar; //unsigned char num[128]={0}; /*void Clk_Init(){ //初始化时钟 unsigned int i; BCSCTL1 &=~XT2OFF;//Basic Clock System Control 1,Enable XT2CLK //即...
C
main() { int n,a[301],b[301],i,j=1,k,m,t; scanf("%d", &n); for(i=1;i<=n;i++) scanf("%d", &a[i]); b[1]=a[1]; for(i=2;i<=n;i++) { for(k=1;k<=j;k++) { if(b[k]==a[i]) break; } if(k==j+1&&b[k-1]!=a[i]) { j++; b[j]=a[i]; } } for(i=1;i<=j-1;i++) printf("%d,", b[i]); ...
C
//-------------------------------------------------------------- // Implementation of ls command in C //-------------------------------------------------------------- #include <sys/dir.h> #include <sys/stat.h> #include <sys/param.h> #include <sys/types.h> #include <stdio.h> #include <stdlib.h> #include <dirent.h> #inc...
C
#include <stdio.h> #include <string.h> int main() { char arr[20]; int i = 0; while(scanf("%c",&arr[i]) && arr[i] != '#') i++; char* rev; rev = strrev(arr); for(int j = 0; j < i; ++j) printf("%c ",rev[j]); return 0; }
C
#include <stdio.h> int main(void) { int a[100],i,j,n,temp; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d\t",&a[i]); } for(i=0;i<n;i++) { for(j=0;j<n;j++) { if(a[j]>a[i]) { temp=a[i]; a[i]=a[j]; a[j]=temp; }}} if(a[i]==0) { printf("yes"); } else { printf("No"); } return 0; }
C
static int ot_open(const char *path, struct fuse_file_info *fi) { /* if (strcmp(path+1, options.filename) != 0) return -ENOENT; if ((fi->flags & O_ACCMODE) != O_RDONLY) return -EACCES; */ int inode_num; if ((inode_num = otfind(path)) == -1) { //it means t...
C
/* * Starting in the top left corner of a 2×2 grid, and only being able to move to the right and down, * there are exactly 6 routes to the bottom right corner. 1 1 1 1 0 0 0 0 1 1 1 0 0 0 1 0 1 1 1 1 0 1 0 0 0 1 1 1 1 1 0 0 1 0 0 1 1 1 0 1 0 0 0 1 0 ...
C
#include<stdio.h> #include<stdlib.h> #include<math.h> int main(){ int reais; float centavos, valortotal = 0; printf("Coloque um valor em reais: "); scanf("%f", &valortotal); reais = valortotal; centavos = valortotal - reais; printf("Você tem %d real(is)\n", reais); printf("E %.2f centa...
C
/*WAP to calculate the power of a number Author: Hardik Sharma Roll No. 19301 Date: 16-07-2021*/ #include<stdio.h> #include<conio.h> void main() { int number,power,i,result=1; clrscr(); printf("Enter any number :"); scanf("%d",&number); printf("\nEnter power of the number : "); scan...
C
/* node.h Andrue Peters 4/4/19 The Pi and each Arduino will have this structure containing properties about it. The Pi will be able to tell the Arduino to change certain settings like the power and IR code, but not the other way around. (Technically it's possible, but why?) Note about the address: The a...
C
/* Nome: Aula 3 - Exerccios de Estrutura SequenciaL Copyright: ESAMC - Francisco Author: Elton Date: 02/03/20 20:01 Description: Exerccio 2 - IMC */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> int main () { float kg, m, IMC; //pegar as trs varaveis em float e dig...
C
#include <stdio.h> int main(int argc, char *argv[]) { // accept one command line arg if (argc != 2) { fprintf(stderr, "Usage: ./recover file.raw\n"); return 1; } // remember filename char *filename = argv[1]; // open file in reading mode FILE* inptr = fopen(filename,...
C
// segmentation.c // Cut the picture and returns pointers of begin and end of character # include <stdlib.h> #include <SDL/SDL.h> # include <SDL/SDL_image.h> # include "segmentation.h" # include "draw.h" # include "pixel_operations.h" # include "createMat.h" // Segmentation by line // return the first line where ...
C
#include <stdio.h> main(){ putchar('P'); putchar('R'); putchar('O'); putchar('G'); printf("\n"); return 0; }
C
/*---------- USING FUNCTION WITH ARGUMENTS BUT NO RETURN VALUES --------*/ #include <stdio.h> #include <conio.h> /* prototypes */ void printline (char c); void value (float, float, int); void main( ) { float principal, inrate; int per...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* flag_i.c :+: :+: :+: ...
C
#ifndef LIST_H_INCLUDED #define LIST_H_INCLUDED #define OK 1 #define ERROR -1 typedef int status; typedef int elem_type; typedef struct listNode { elem_type element; struct listNode *next; }listNode; listNode* create_list_front_insert(void); listNode* create_list_end_insert(void); elem_type get_elem_location(li...
C
#include <stdio.h> #include <stdlib.h> int main() { int numero; int i; int acumulador = 0; printf("Ingrese un numero: "); scanf("%d",&numero); for(i=0;i<=numero;i++) { acumulador= acumulador + i; } printf("La suma fue de : %d",acumulador); return 0; }
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <conio.h> #define MAX 100 typedef struct { //1 questo char nome[30]; char cpf[11]; }cliente; typedef struct { cliente dados[MAX]; int qtd; }Lista; // lista Lista* crialista(); int inserir(Lista* lista, cliente cliente, int pos); cliente remover(...
C
void ft_print_params_test(int argc, char argv) { int i = 0; int n = 1; while (argv[n][i] != '\0') { ft_putchar(argv[n][i]); i++; } n++; ft_putchar('\n'); } int main(int argc,char argv) { ft_print_params_test(argc, argv); return (0); }
C
#include <stdio.h> #include <stdlib.h> /******************************************** ⣺ѰҸ *********************************************/ int root; //ʾijܹʱԼöʱ int low[20], num[20]; //ͼ int graph[20][20]; //¼ʱ int count; //ͼеĶԼ int n, m; //ǷǸ int flag[20]; //Сֵ int min(int x, int y) { return x > y ? y : x; } v...
C
#include <stdio.h> #include <stdlib.h> int main(void) { int i,arr[100]; float ncount,pcount,zeros; float pr,nr,zr,n; //printf("Enter n: "); scanf("%f",&n); //printf("Enter elemts"); for(i=0; i<n; i++) { scanf("%d",&arr[i]); } for (i=0; i<n; i++) { if (arr[i] < 0) ...
C
3.7 过程(函数 / 方法调用过程) 要提供对过程的机器级支持,必须要处理许多不同的属性。为了讨论方便,假设过程P调用过程Q,Q执行后返回到P。这些动作包括下面一个或多个机制: 传递控制:在进入过程Q的时候,程序计数器必须被设置为Q的代码的起始地址,然后在返回时,要把程序计数器设置为P中调用Q后面那条指令的地址。 传递数据:P必须能够向Q提供一个或多个参数,Q必须能够向P返回一个值。 分配和释放内存:在开始时,Q可能需要为局部变量分配空间,而在返回前,又必须释放这些存储空间。 3.7.1 运行时栈 C语言过程调用机制的一个关键特性(大多数其他语言也是如此)在于使用了栈数据结构...
C
/************************************************************************* > File Name: vframe.c > Author: sukong > Mail: sukong@outlook.com > Created Time: 2016年05月10日 星期二 09时43分01秒 ************************************************************************/ #include<stdio.h> long vframe(long n, long i...
C
/* * exst (Extension Statistics) * * Returns information about files in a directory by extension. The use of this * is to tell what percentage of files in a directory is used by a particular * type of file. * * Clara Van Nguyen */ //C Includes #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> #incl...
C
#include "clique.h" Pgin* pgin_info(void) { Pgin *pgin; pgin = (Pgin *) malloc(2 * sizeof(Pgin)); /* Inclui clique como primeiro algoritmo do plugin */ pgin[0].type = PGIN_TEST_ALG; pgin[0].label = "Clique"; pgin[0].name = "clique"; pgin[0].flags = 0; /* Indica o final da lista de alg...
C
#include <stdio.h> #include "add.h" #include "sub.h" #include "mul.h" #include "div.h" int main (int argc,void *argv) { printf("This is add function: 1+1=%d\n",add(1,1)); printf("This is sub function: 5-2=%d\n",sub(5,2)); printf("This is mul function: 3*7=%d\n",mul(3,7)); printf("This is div function: ...
C
#include <stdio.h> int main() { int res = 0; for(int i = 4; i >=2; i++) { res *= i; } printf("%d", res); }
C
#include<stdio.h> int main(int argc, char *argv[]) { int i; char a[100]; scanf("%s",a); for(i=0;a[i]!='\0';i++) { if(a[i]=='a' || a[i]=='A' || a[i]=='e' || a[i]=='E' || a[i]=='i' || a[i]=='I' || a[i]=='o' || a[i]=='O' || a[i]=='u' || a[i]=='U') continue; if(a[i]>64 && a[i]<91) a[i]=a[i]+32; printf(".%c",...
C
#pragma once #include "Base.h" matrix calculateSuffixPrefixLCS(const string &A, const string &B) { int m = A.length(), n = B.length(), q = max(n, m); matrix criticalPoint(4 * q + 1, vector<int>(4 * q + 1, 0)); matrix res(4 * q + 1, vector<int>(4 * q + 1, 0)); matrix ans(m, vector<int>(n, 0)); ...
C
#include<stdio.h> main() { int rem,n,sum; printf("enter number:"); scanf("%d",&n); for(sum=0;n>0) { rem=n%10; sum=sum+rem; n=n/10; } printf("sum of the numbers:%d",sum); }
C
#include <stdio.h> void main() { int n, i; printf("Digite a quantidade de caracteres que sua palavra ter: "); scanf("%d", &n); char palavra[n]; printf("Digite a palavra: "); scanf("%s", &palavra); for (i=0; i<=n; i++) printf("%c \n", palavra[i]); }