language
large_stringclasses
1 value
text
stringlengths
9
2.95M
C
#include <stdio.h> #include <stdlib.h> int main() { int year; printf("Enter the year :\n"); scanf("%d", &year); if ((year%4==0 && year%100!=0) || (year%100==0 && year%400==0)) { printf("Yes %d is a leap year :)",year); } else { printf("No You doofus %d is not a leap year, what w...
C
#include "graphics.h" /* * Author: Amartya Vadlamani * Notes: Not much really */ void drawIncreasingCircles(int x, int y, int radius, int numOvals, int padding, int growthFac){ for (int i = 0; i <= numOvals; i++){ drawOval(x, y, radius, radius); x += radius + padding; y -= growthFac / 2...
C
/* Escribir un programa ISO C MULTIPLATAFORMA que procese el archivo “bigEndian.dat” sobre sí mismo, leyendo nros. de 4 bytes Big-Endian y triplicando los impares. */ #include <inttypes.h> #include <stdio.h> #include <unistd.h> #include <arpa/inet.h> int main(){ const char* file = "bigEndian.dat"; FILE* read = ...
C
#include <stdio.h> #include <stdlib.h> int main(void) { int i, n, max, *pArr = NULL; do { printf("Input n: "); scanf("%d", &n); } while (n <= 0); pArr = (int *)malloc(sizeof(int) * n); for (i = 0; i < n; i++) { printf("a[%d] = ", i); scanf("%d", &pArr[i]); } max = pArr[0]; for (int i = 1; i < n;...
C
#include <stdio.h> #include <math.h> float DIS (int , int , int , int); int main(){ int V; float D1,D2; int I; int X[6]; for(I=0,V=1;I<6;I++,printf("\n") ){ if(I==0||I==2||I==4){ printf("in X%d :",V); scanf("%d",&X[I]); } if(I==1||I==3||I==5){ printf("in Y%d :",V); scanf("%d",&X[I]); V++; } ...
C
#include <stdio.h> #include <string.h> void printChars(int size, char c ); /* provided, DO NOT IMPLEMENT */ void printCheckerLine(int checkerWidth, int checkerCount, char c1, char c2); void printCheckerBoard(int checkerWidth, int checkerCount, char c1, char c2); int main(void) { char command[80]; int checkerWidth...
C
#include "led.h" #include "delay.h" #include "sys.h" #include "usart.h" #include <math.h> #include "lcd.h" #include "my_exit.h" extern volatile int move_left; extern volatile int move_right; void simulate ( void ) { int score_num = 0; /* */ const int r = 20; /* С뾶 */ const int l = 320; /* Ļ...
C
// Copyright (c) 2014 Parker Harris Emerson // Lab 1-1 Assignment for New Beginnings Fall 2014, Assigned by Bryant York. // Write a C program to sequentially search a list of positive integers read from a file named “data1.txt” for a positive integer read from the terminal. Your program should print the index or inde...
C
/* This is a test of the isGameOver() function. The game ends when the last Province is bought, or when three supply piles are depleted. */ #include <stdbool.h> #include "dominion.h" #include "dominion_helpers.h" #include <stdio.h> #include <math.h> #include <stdlib.h> #include <string.h> #include <time.h> #i...
C
/* *@function obtenir permet d'obtenir le choix de l'usager pour une option du menu *@param char* *@return void */ void obtenirss(char *pt){ char c; printf("Tapez : \n"); printf(" - Q pour Quitter \n"); printf(" - V pour Visualiser \n"); printf(" - C pour Chercher\n"); ...
C
#include <stdio.h> #include <math.h> #include <stdlib.h> #include <string.h> char * sttr; char * sfrac_simplify(char * n); double sfrac_todouble(char * x); void my_reverse(char str[], int len); char * sfrac_fromdouble(double x); char * sfrac_add(char * n1, char * n2); char * sfrac_sub(char * n1, char * n2); char * s...
C
#include<stdio.h> #include<conio.h> #include<stdlib.h> #include<windows.h> char square[10] = {'0','1','2','3','4','5','6','7','8','9'}; int checkWin(); void drawBoard(); void main() { int player = 1,i,choice; char mark; // X,O do{ drawBoard(); player = (player % 2)? 1 : 2 ...
C
#define _CRT_SECURE_NO_WARNINGS 1 #include <stdio.h> #include <string.h> //int main() //{ // struct S // { // int num; // char name[20]; // char sex; // int age; // float score; // char addr[30]; // }; // struct S s1; // printf("%d\n", sizeof(s1)); // return 0; //} //int main() //{ // struct S // { // int num...
C
//Program to find the shortest sequence of paths taken by a knight from source to destination vertex #include<stdio.h> #include<ctype.h> #include<string.h> #include<stdlib.h> #define N 8 typedef struct Node { int x; int y; int distance; }Node; //valid movement of the knight int row[] = {-2, -...
C
/* ** EPITECH PROJECT, 2018 ** myftp ** File description: ** dir_command.c */ #include "server.h" static int change_dir(char **tab) { char *path = realpath(tab[1], NULL); if ((tab[1] && tab[2] != NULL) || (path == NULL) || (chdir(tab[1]) == -1)) { return (1); } return (0); } void cwd(char **tab, t_client *c...
C
/* jisSem1.c : JIS C 5.1.2.3 Program execution pp.8-9 */ #include <stdio.h> char line[4] = {'1', '2', '3', '\0'}; char buff[100]; int column; char getchar1(); int main() { char c1='a', c2=1; float f1, f2=3.14f; double d=2.0; short a1, a2, x11, x12, x13, x21, x22, x23, x24, b1, b2; int sum; cha...
C
#include <stdio.h> int main(void) { int arr[2]={1,2}; int *ptr = arr; for(int i=0 ; i<2; i++){ ptr[i]++; } printf("%d, %d\n",*(arr+0),*(arr+1)); }
C
#include<stdio.h> #define ANSI_COLOR_RED "\x1b[31m" #define ANSI_COLOR_GREEN "\x1b[32m" #define ANSI_COLOR_RESET "\x1b[0m" #define ANSI_COLOR_CYAN "\x1b[36m" int arr[4][11]; void display() { printf("\n\n"); printf(ANSI_COLOR_CYAN" <버스 좌석표> \n"ANSI_COLOR_RESET); ...
C
/// A sample C extension. // Demonstrates using ldoc's C/C++ support. Can either use /// or /*** */ etc. // @module mylib #include <string.h> #include <math.h> // includes for Lua #include <lua.h> #include <lauxlib.h> #include <lualib.h> /*** Create a table with given array and hash slots. @function createtable @para...
C
/* zapbig.c 8-22-00 LTH Write the hex bytes [B0 47 05 80 00 01 00] to an EEPROM at address 1. This is handy for over-writing an EEPROM that was previously loaded with 'B2' code for boot-load testing. By writing the seven bytes above we create an EEPROM that acts like the 24LC00 supplied on the stock development boar...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include <malloc.h> typedef struct LNode { int data; struct LNode *next; }LNode; int initLink(LNode *L) { LNode *head=L->next, *p; while (head) { p = head; head = head->next; free(p); } L->next = NULL; print...
C
/* CUDA speed test without the memory overhead gcc-mp-4.8 -O3 cudadgemmtest.c common.c -o cudadgemmtest -I../../../../netlib/CBLAS -I/usr/local/cuda/include/ -L/usr/local/cuda/lib -lcublas export DYLD_LIBRARY_PATH=/usr/local/cuda/lib ./cudadgemmtest > ../../../results/mac_os_x-x86_64-dgemm-cuda_nooh.csv */ #includ...
C
#include <string.h> #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <ctype.h> /* This file contains special methods to dealing with cummon string operations when reading a mathematical expression and parsing it to a expression stack. */ void resize_assing(char *str, char* new_str){ ...
C
/* parse.c - parser ** ** Syntax: ** <expression> ::= <apply> ** | <expression> ";" <identifier> <atomic> ** <apply> ::= <atomic> ** | <apply> <atomic> ** <atomic> ::= "\" <identifier> <atomic> ** | "(" <expression> ")" ** | <identifier>...
C
#include<stdio.h> main() { getvalues(); perimeter(); area(); } getvalues() { int x; printf("Enter radius of the circle:"); scanf("%d",&x); } perimeter() { float c,x; c=2*3.14*x; printf("\nPerimeter is %f",c); } area() { float a,x; a=3.14*(x*x); printf("\nArea is %f",a); }
C
#include <string.h> #include <stdio.h> #include <stdlib.h> #include "structure.h" int main(){ char val[10]; int n=0; memset(val, 0, 10); struct GBN_Receiver_Queue *q = create_queue(); while(1){ printf("Enter the value to store: "); scanf("%d", &n); printf("\n"); memcpy(val, &n, sizeof(int))...
C
#include<stdio.h> void main() { int x,y,t; printf("enter the number is"); scanf("%d%d",&x,&y); t=x; y=x; y=t; printf("the swapping number is%d%d",x,y); }
C
#include<stdio.h> void main() { char ch; printf("enter the alphabet:"); scanf("%c",&ch); switch(ch) { case'a': printf("vowels"); break; case'e': printf("vowels"); break; case'i': printf("vowels"); break; case'...
C
////*Using a mutex to protect access to global variable*////// /* This program is a modified version of the previous program. It uses a mutex to protect access to the global variable glob. When we run this program with a similar command line to that used earlier, we see the glob is always reliably incremented*/ #includ...
C
// // Vector3.c // GroupDevelopTutorial // // Created by 岡本 直樹 on 2016/12/21. // Copyright © 2016年 Naoki Okamoto. All rights reserved. // #include "Vector3.h" Vector3 Vector3_init(double x, double y, double z) { Vector3 vec; vec.vec[0] = x; vec.vec[1] = y; vec.vec[2] = z; vec.plusWith = __Vector3_plusWith...
C
// File containing User defined definitions such as configuring the si114x_init file for an indoors or general mode #ifndef INDOORS #ifndef GENERAL // If either INDOORS or GENERAL is defined, it must have been defined via a command-line switch. In this case, // this code is never reached and the command line switch ta...
C
#include <fcntl.h> #include <errno.h> #include <string.h> #include <stdlib.h> #include <assert.h> #include <arpa/inet.h> #include <sys/socket.h> #include "bmp_log.h" #include "bmp_recv.h" #include "bgp_router.h" #include "bmp_session.h" #include "bmp_process.h" int bmp_session_compare(void *a, void *...
C
#ifndef _OBJ_H_A #define _OBJ_H_A #include <stdlib.h> int* findDisappearedNumbers(int* nums, int numsSize, int* returnSize) { int *arr = (int*)malloc((numsSize + 1) * sizeof(int)); int i, j, count = 0; for (i = 0; i <= numsSize; i++) arr[i] = 0; for (i = 0; i < numsSize; i++) { arr[nums[i]]++; } arr[0] = 1...
C
#pragma once #include "stdbool.h" /* STRUCTS */ typedef struct merge_sort_array { int* data; int size; }MergeSortArray; /* FUNCTIONS */ //Reads the file with numbers, put numbers in an array, sorts the array and returns it int* quick_sort_from_file(const char* fName, bool print); //Main quicksort function void...
C
#include <stdio.h> #include <stdlib.h> #include <pthread.h> #include <string.h> #include <sys/time.h> #define HASHTABLE_SIZE 1000099 #define LOCALBUFFER_SIZE 100 /* node structure for heap */ typedef struct node { /* square orientation */ char str[17]; /* stores the distance from the expected orientation */ int d...
C
/*Write a program to draw a point of width 10 pixel*/ #include<GL/glut.h> #include<stdio.h> #include<math.h> struct scanLine { int y; int x[20]; }; struct Edge { int x1,y1; float m; }e[20]; void MyInit ( void ) { glClearColor ( 0.0, 0.0, 0.0, 0.0 ); //white background glColor3f(0.0f, 1.0f,0.0f); // green drawing c...
C
/* ITS240-01 Lab 10 ch11p546pe1 04/17/2017 Daniel Kuckuck Write a C program that stores the following numbers in an array named ‘miles’: 15, 22, 16, 18, 27, 23, 20. Have your program copy the data stored in miles to another array named ‘dist’ and then display the values in the dist array. */ #include <stdio....
C
#include "libs/Header.h" #pragma warning(disable : 4996) #define SectionSize sizeof(IMAGE_SECTION_HEADER) #define PExoortDirecotry64 &Image_Nt_Header64.OptionalHeader.DataDirectory[0] #define PExoortDirecotry32 &Image_Nt_Header32.OptionalHeader.DataDirectory[0] #define PImportDirectory64 &Image_Nt_Header64.OptionalHea...
C
#include <GL/glut.h> #include <GL/glu.h> typedef enum { FALSE = 0, TRUE = 1 } bool; void init(void) { glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glShadeModel(GL_FLAT); } void drawFractal(int level, bool isRoot) { if (level < 0) return; glutWireCube(1.0); glPushMatrix(); glTranslatef...
C
#include <stdio.h> #include <cs50.h> // Collatz Conjecture // Program that calculates how many steps it takes to get back to 1. int collatz(int n); int collatz(int n) { if(n == 1) { return 0; } else if((n % 2) == 0) { return 1 + collatz(n/2); } else { return 1 +...
C
#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include "../my.h" #include "../my_list.h" void *xmalloc(int size) { void *ptr; if ((ptr = malloc(size)) == NULL) { printf("CANT MALLOC SRY\n"); my_exit(); } return (ptr); } int xfork() { pid_t pid; int i; if ((pid =...
C
#pragma once #include "Prototypes.h" /****************************************************************************************** * Function Name: get_valid_string(char *string) * * Funtion Description: * This function allows a user to give a description to an item * * * User-interface variables:- * *OUT (Return val...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* sha.c :+: :+: :+: ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "myhtml.h" int main(){ char buf[256],uid[80],age,male; int len; char* query; // char* method; char* ptr; // char* env; putContentType(); ptr = getenv("REQUEST_METHOD"); if(strcmp(ptr,"GET") == 0){ putHT...
C
// һ // 1.5ַ/ // ׼ṩһ/дһַĺ򵥵getcharputchar // ÿεʱgetcharıжһַ뽫Ϊֵء // ÿεputcharʱӡһַ
C
#include "../src/internal.h" #include "test.h" #include "util.h" #include <passwand/passwand.h> #include <stdlib.h> #include <string.h> TEST("encode: encode(\"\")") { const char *empty = ""; char *r; int err = encode((const uint8_t *)empty, strlen(empty), &r); ASSERT_EQ(err, PW_OK); ASSERT_NOT_NULL(r); ASS...
C
// ユークリッド互除法 # include <stdio.h> int main(){ int a,b,c; a = 3136; b = 126; do{ c = a % b; printf("%4d %% %4d = %4d\n",a,b,c); a = b; b = c; }while(c!=0); // LMC = 最大公約数 printf("LMC=%2d.\n",a); }
C
#include <stdio.h> //avoid putting function inside functions cause compile error void sayHello() { printf("this is a procedure not function cus it returns nothing"); } int main() { //declaring variable int age = 32; const int a; //this is a constrant printf(" hello from c !!! \n "); printf("same thing here \...
C
#include "test-common.h" static int req_closed; static int write_cb_called; static int shutdown_cb_called; static uv_http_req_t req; static void req_write_client(int fd) { client_send_str("GET /path HTTP/1.1\r\n\r\n"); client_expect_str("HTTP/1.1 200 OK\r\n" "ABC: DEF\r\n" ...
C
#include "encryptor.h" #include <stdio.h> #include <string.h> #include <stdlib.h> #define S_SIZE 256 void encryptor_ksa(encryptor_t * self); void encryptor_prga(encryptor_t * self, int len); void encryptor_swap_S(encryptor_t * self, int i, int j); void stderr_keystream_hexa_uppercase(encryptor_t *self , int len); voi...
C
#include<stdio.h> #include<stdlib.h> int main() { int a=0, b=1, c=0; printf("Ingrese el numero del que quiere sacar su factorial\n"); scanf("%d", &a); for (int i = 1; i <= a; i++) { c=b*i; b=c; } printf("El factorial de %d es %d\n", a, c); return 0; }
C
#include "lib.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <limits.h> unsigned long long potencia(int n, int potencia){ unsigned long long resultado = 1; for(int i = 0 ; i < potencia ; i++){ resultado *=n; } return r...
C
/* Задача 13. Направете обединение с членове unsigned short и char. Ограничете използваните битове до 6. Инициализирайте и изведете на конзолата. union <tagUnion> { Ctype m_bitField : N; }; */ #include <stdio.h> #include <stdint.h> union myunion { unsigned short Var1:6; int8_t Var2:6; char var3:6; } Sh...
C
/** * recover.c * */ #include <stdio.h> #include <stdlib.h> #include <string.h> // prototypes int isjpeg(); int main(int argc, char* argv[]) { // ensure proper usage if (argc != 1) { printf("Usage: ./recover\n"); return 1; } // filename for input file char* infile = "card....
C
#include<stdlib.h> #include<stdio.h> #define SqStackInitSIZE 20 typedef struct { int* data; int top; int capacity; }SqStack; #pragma region SqStackFunctions SqStack* initSqStack(); SqStack* createSqStack(int size); int isEmptySqStack(SqStack* S); int isFullSqStack(SqStack* S); int push(SqStack* S, int va...
C
#ifndef LISTA_H_INCLUDED #define LISTA_H_INCLUDED #include"sqlite3.h" typedef struct osoba { char imie[100]; char nazwisko[100]; struct zespoly *ulubione; struct osoba*next; }osoba; typedef struct zespoly { char nazwa[100]; struct zespoly *next; }zespoly; //Funkcja przygotowuje plik "Uzyt...
C
/***************************************** * *A simplest shell written in c lang. * * Basic lifetime of a shell * - Initialize: A typical shell would read and execute its configuration * and execute its configuration files. These change aspects of the shell's behavior. * - Interpret: Next, the shel...
C
#include<stdlib.h> #include<stdio.h> #include<mysql/mysql.h> MYSQL *conn_ptr; unsigned int timeout = 7; //超时时间7秒 int main(){ //初始化 int ret = 0; //错误返回null conn_ptr = mysql_init(NULL); if(!conn_ptr){ printf("mysql_init failed! line %d\n",__LINE__); return -1; } //设置超时...
C
#include<unistd.h> #include<time.h> #include<stdio.h> #include<malloc.h> #include<stdlib.h> /* Main Function Starts here */ int my_xtime(struct timespec *ktime){ //printf("\n Call to system to display time:"); int ret_value= syscall(326,ktime); if(ret_value != 0){ printf("\nSyscall not executed.\n"); } ...
C
#include <stdlib.h> #include <limits.h> #ifndef LAPTOP #include <msp430.h> #include "temp_bins.h" #include "temp_thresholds.h" #include "adc_sensor.h" #else #include <stdio.h> #include <assert.h> #include <time.h> #endif #define NUM_BINS 10 /*total number of bins*/ #define USE_LEDS #define FLASH_ON_BOOT /*Need to ca...
C
/* Small S3M player written as AICA firmware * * (c)2000 Dan Potter * * Notes on using: * * To use this player, you just need to load your S3M into sound RAM * at 0x10000, and then load this program into the ARM CPU. This program * will then parse the S3M into samples and tracks, etc, and start * playing it. ...
C
#include<reg51.h> //sbit pin1=P2^0; //sbit pin2=P2^1; void uart_ins() { TMOD = 0x20; // use timer 1 8-bit auto reload moad TH1 = 0xfd; // 9600 bord rate SCON = 0x50; // use 8-bit 1 start bit 1 stop bit TR1 = 1; // start timer 1 } void uart_send(unsigned char uart_data) { SBUF = uart_data; ...
C
/* readdir.c */ #include <stdio.h> #include <errno.h> #include <sys/types.h> #include <dirent.h> #include <unistd.h> #include <fcntl.h> #include <sys/stat.h> int main(int argc, char **argv) { DIR *dirp; // open directory descriptor struct dirent *dp; // directory entry pointer FILE *outfile; // ...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> void main(int argc, char *argv[]) { FILE *fp; int c; fp = fopen(argv[1], "w"); c = fgetc(stdin); while(c!=EOF){ fputc(c, fp); c = fgetc(stdin); } fclose(fp); }
C
#include <stdio.h> #include <stdlib.h> struct Node { int data; struct Node* next; }; typedef struct Node Myn; typedef Myn * P; struct Node* head; //global void insert(int x) { // using type def P tmp =(p)malloc(sizeof(Myn)); // add 1st elemen insert at begining .t // no using typedef // struct Node* t...
C
#include<stdio.h> int main(){ int n, i, j, dem, count=0; int a[100]; int b[100]; scanf("%d", &n); for(i=0;i<n;i++) scanf("%d", &a[i]); for(i=0;i<n;i++){ dem=0; for(j=0;j<n;j++){ if(a[i]==a[j]&&i!=j) dem=1; } if(dem==0){ printf("%d ", a[i]); count++; } } if(count==0) printf("0"); return 0; } ...
C
/* * @Descripttion: exec查看网络配置 * @Author: Altair * @Date: 2020-04-22 14:47:19 */ #include <stdio.h> #include <unistd.h> #include <errno.h> #include <string.h> int main(int argc, char *argv[]) { if (execl("/sbin/ifconfig", "/sbin/ifconfig", NULL) == -1) //如果execl()返回-1,就表明它执行失 if (execlp("ipconfig", "ip...
C
// Unit test for the discardCard() method. // Business requirements: // discardCard() gets called whenever there is a need to remove a card to the player's hand. // The card should be sent to the trash pile if (and only if) that is specified. // Only the hand should be affected. // Discarding from the front, middle, a...
C
/* xparsecfg * tool to parse configuration file. * current tool have static predefined parameter. * this tool is a layered one. * gcc xparsecfg.c -Wall -ggdb3 -o xparsecfg */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "parserclass.h" #include "filecfgparser.h" #include "stduserparser.h" ...
C
#include "lexer.h" /* * TODO Implement escaping */ // maybe TODO maybe rollout homemade strlen /* * An array of keywords */ char* theKeywords[] = { "int", "char", "long", "void", "short", ...
C
#include <stdio.h> #include <libxml/parser.h> #include <libxml/tree.h> int main(int argc, char **argv) { xmlDocPtr doc = NULL; //ļָ xmlNodePtr root_node = NULL; xmlNodePtr sk_node = NULL, ipport_node = NULL;//ڵָ xmlNodePtr dm_node = NULL, name_node = NULL;//ڵָ // һļԼһڵ doc = xmlNew...
C
#include <stdio.h> #include <stdlib.h> #include <time.h> #include "dijkstra.h" #include "floyd.h" #define ANSI_COLOR_CYAN "\x1b[36m" #define ANSI_COLOR_RESET "\x1b[0m" int G[][5] = { {0, 10, 0, 30, 100,}, {10, 0, 50, 0, 0, }, {0, 50, 0, 20, 10, }, {30, 0, 20, 0, 60, }, {100, 0, 10, 60, 0, },...
C
// Luis Ivan // Hill Cipher // This program converts plain text in to encrypted text // when provided with a cipher key of "n" length. // "n" can not be any larger than 9 or smaller than 2 /* matrix multiplaction and hill key cipher math encrypt |d|e|f| |a| (d*a + e*b + f*c)%26 |m| |g|h|i| *...
C
#include<stdio.h> #include<string.h> int i=0,j=0,k=0,z=0,length=0; char stk[15], input[50]; char left[50][50], right[50][50], temp[5], str[50]; int rule, stk_idx, inp_idx; int is_operator(char ch){ if(ch=='+' || ch=='-' || ch=='*' || ch=='/' || ch=='^' || ch=='(' || ch==')') return 1; return 0; } int ma...
C
#include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/wait.h> int main() { int ret = fork(); int childID = getpid(); int parentID = getppid(); if(ret == 0 ) { printf("Child \n"); exit(0); } else { wait(NULL); printf("Child ID : %d \...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <assert.h> #include <ctype.h> #include <time.h> #include "mspms2.h" /** * Check if any dihedral, angle, bond share the same ending pairs. */ int InitCheckUniques() { int mm, ii, jj; PSAMPLE_MOLECULE pSampleMole; ...
C
#include "TPO.h" int AgregarNodoUsuario(USU *usuario, NodeUser *root) { NodeUser *current=root; int id=1; if(current==NULL){ root = (NodeUser*)malloc(sizeof(NodeUser)); root->user=*usuario; root->user.id=id; return id; } while(current->nxt!=NULL){ current=current->nxt; } current...
C
//switch~case ޴ #include <stdio.h> void one(int x) { puts("\n 1.one \n"); } void two(int x) { puts("\n 2.two \n"); } void three(int x) { puts("\n 3.three \n"); } void four(int x) { puts("\n 4.four \n"); } int main(void) { int number; puts("\n *޴ * \n"); while (1) { printf(" ȣ ϼ[0 to quit]:"); scanf...
C
#include "newi2c.h" void I2C_WriteByte(I2C_TypeDef * I2Cx,uint8_t slave_addr,uint8_t reg_addr, uint8_t data) { while (I2C_GetFlagStatus(I2Cx, I2C_FLAG_BUSY)) ; I2C_GenerateSTART(I2Cx, ENABLE); //开启I2Cx while (!I2C_CheckEvent(I2Cx, I2C_EVENT_MASTER_MODE_SELECT)) ; /*EV5,主模式*/ I2C_Send...
C
#include <cs50.h> #include <ctype.h> #include <stdio.h> #include <string.h> // could int main(void) { // store string to name string name = GetString(); // takes the first letter and puts to upper case printf("%c", toupper(name[0])); // increments through string places, use 'n'...
C
#include <stdio.h> #include <stdlib.h> #include <string.h> struct cadastro { char nome[50]; int codigo; float sal; }; int main() { FILE *fp; FILE *new; struct cadastro func[3]; char ch; int x; fp = fopen("exerc3.txt", "r+b"); new = fopen("exerc4.txt", "w+b"); for (x = 0...
C
#include<stdio.h> #include<assert.h> #include<stdlib.h> #include<string.h> struct Person { char *name; int age; int height; int weight; }; struct Person *Person_create(char *name, int age, int height, int weight) { struct Person *who = malloc(sizeof(struct Person)); assert(who != NULL); who->name = strdup(n...
C
// This file is part of the Corinthia project (http://corinthia.io). // // See the COPYRIGHT.txt file distributed with this work for // information regarding copyright ownership. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // ...
C
#include "arthimetic.h" void main(){ int number1,number2; //get input from keyboard printf("Enter The First Number: \n"); scanf("%d",&number1); printf("Enter The Second Number: \n"); scanf("%d",&number2); //display the result printf("The sum is:%d\n",Add(number1,number2) ); printf("The diffrence is:%d\n",Subt...
C
/* ** redirection.c for redirection in /home/abollo_h/minishell1/pipe ** ** Made by ** Login <abollo_h@epitech.net> ** ** Started on Fri Jan 31 15:05:13 2014 ** Last update Sun May 25 19:49:06 2014 TAWFIK */ #include <stdlib.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include <sys/stat.h> #...
C
/* * utils.h * * Created on: Jul 7, 2013 * Author: alessandro */ #ifndef UTILS_H_ #define UTILS_H_ /** * Given one of the resolution unit used in the EXIF Tags ( ResolutionUnit and FocalPlaneResolutionUnit ) * this methods will return the resolution value associated ( in millimeters ) * @param resolutio...
C
#include<stdio.h> void main() { char yesno='y'; while(yesno=='Y'||yesno=='y') { int num1,num2,ans; char ch; printf("enter your first number"); scanf("%d",&num1); printf("enter your second number"); scanf("%d",&num2); printf("choose operatio...
C
#include<stdio.h> #include<stdlib.h> #include<string.h> #include<assert.h> char * my_strtok(char *input,char t){ static unsigned int token=0; static char **part_token = NULL; static unsigned int current_returned_tokens=0; if(input){ unsigned int i=0,j=0; /*Count the tokens and create the part_token array*/...
C
#include <stdio.h> int main() { int score; printf(" Էϱ : "); scanf("%d", &score); // ùٸ if if (score <= 70) printf(""); else if (score <= 90) printf(""); else printf(""); // ߸ if if (score <= 70) printf(""); if (score <= 90) printf(""); if (score <= 100) printf(""); /* if - else if - else ...
C
#include<stdio.h> #include<unistd.h> #include<linux/unistd.h> #include<linux/time.h> int main() { struct timespec time; int ret = syscall(326, &time); if(ret==0) { printf("Successfully returned the System call\n"); printf("Time in nanoseconds: %ld\n", time.tv_nsec); } else { printf("System call failed t...
C
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_db.c :+: :+: :+: ...
C
struct{ double circle_t,circle_r; double dot_r; double speed; //pixels per second }player={0,100,5,50*M_PI}; double player_get_x(){ return cos(player.circle_t)*player.circle_r; } double player_get_y(){ return sin(player.circle_t)*player.circle_r; } void player_rotate(double direction){ player...
C
#include <stdio.h> #include <cs50.h> void question(void); void printMario(int); int height = 0; int main(void){ question(); } void question(void){ printf("Height : "); height = get_int(); if (height > 0 && height < 24){ printMario(height); } else if (height == 0){ height=0; ...
C
#include <stdio.h> int main (){ //Declarando variáveis int num1; //Dado printf("Informe um número: "); scanf("%d", &num1); //Processamento if (num1 > 100){ printf("%d", num1); }else{ num1 = 0; printf("%d", num1); } }
C
#include <stdio.h> int main(){ int a,b; while (1) { /* code */ printf("Ctrl+Cで終了\n" ); printf("計算する値を入力してください\n"); printf("例:5%%8\n" ); scanf("%d %d",&a,&b ); printf("答えは:%d\n",a%b ); } return 0; }
C
/**************************************************************** * Autor: José Manuel C. Noronha * Autor: Noé Godinho * Turma: PL2 * Grupo: 5 * Ano Lectivo: 2016 - 2017 ***************************************************************/ /* Includes, Definições e Notas */ #include "../lib/ex8.h" /* * função que...
C
/* * Cyclone V HPS Interrupt Controller * ------------------------------------ * Description: * Driver for enabling and using the General Interrupt * Controller (GIC). The driver includes code to create * a vector table, and register interrupts. * * The code makes use of function pointers to register ...
C
/************************************************************************* > File Name: src/2010.c > Author: JS > Created Time: 2016年03月12日 星期六 19时14分14秒 ************************************************************************/ #include <stdio.h> #include <math.h> int main() { int m, n; while (scanf("%...
C
#include <stdio.h> #include <stdlib.h> void copy(int *A, int *B, int low, int high) { int i; for (i = low; i <= high; i++) { A[i] = B[i]; } } int merge_and_count(int *A, int *B, int low, int mid, int high) { int left, right, i, count; left = i = low; right = mid + 1; count = 0; while (l...
C
#include<stdio.h> #include<stdlib.h> #include<sys/types.h> #include<sys/socket.h> #include<sys/uio.h> #include<netinet/in.h> #include<arpa/inet.h> #include<unistd.h> #include<string.h> void main(int argc,char* argv[]) { int sockid,rval; char a1[50],a2[50],b1[50],b2[50]; sockid=socket(AF_INET,SOCK_STREAM,0); if(sock...