Racket functions:
·
(truncate num1) converts to decimal and chops after the
decimal point. (truncate -2.5) is -2.
·
(+
num1 num2) returns num1 + num2
·
(remainder num1 num2) returns remainder after even division
of num1 / num2.
o
(cond [ test do-expression
if true ]
[
test do-expression if true ]
[
else do-expression ] )
·
(eq? list null) returns true if the list is empty
·
(first list) returns the first item of the list
·
(drop list 1) returns the list minus the first
item of the list
C /C++ functions:
stdio.h:
void
* malloc (int size ) returns a pointer to the newly allocated memory
but will return null if cannot allocate.
FILE *fopen(const char *filename, const char
*mode) returns a pointer to
the FILE but will return null if cannot open
int fprintf(FILE
*stream, const char *format, ...) returns
the number of characters written
int fscanf(FILE
*stream, const char *format, ...) returns
the number of characters read
int scanf(const char *format, ...) returns the number of
variables filled
int printf(const char *format, ...) returns the number of
characters written
int puts(const
char *str) returns the number of
characters written
char *fgets(char *str, int n, FILE *stream)
returns a pointer to a string of characters
int sprintf(char
*str, const char *format,
...) returns the number of characters written
int sscanf(const char *str, const char *format, ...) returns the number of
variables filled
string.h
in C and <cstring> in C++
char *strcat(char *dest, const char *src) returns char *dest
char *strcpy(char *dest, const char *src) returns char *dest
char *strchr(const
char *str, int c)
returns a pointer to the first occurrence of c in str
or a null pointer if not found.
int strcmp(const char *str1, const char
*str2) returns 0 if equal, -number if str1 less than str2 and +number
if str more than st2.
size_t strlen(const char *str)
char *strstr(const
char *haystack, const char *needle)
returns a pointer to the first occurrence of needle in haystack or a null
pointer if not found.
ctype.h in C and <cctype> in C++
int tolower(int c) returns the lowercase version of c
int toupper(int c) returns the uppercase version of c
<string> in c++