== Reference 1 == (Basic knowledge of C programming)
(in real) -- (in C program)
Integer -- int
Float -- float
Long float -- double
Character -- char
String -- char[x] ('x' means the spaces you set)
int -- %d
float -- %f
double -- %lf
char -- %c
char[x] -- %s
-- to define constant --
(if you want to set 'pi' to '3.1416')
(we need to set the constant from the begining)
Example
#include
#define pi 3.1416
'a' Equal to 'b' -- (a == b)
'a' Not equal to 'b' -- (a != b)
'a' Greater than or equal to 'b' -- (a >= b)
'a' Smaller than or equal to 'b' -- (a <= b)
'a' Greater than 'b' -- (a > b)
'a' Smaller than 'b' -- (a < b)
----------------------------------------
== Reference 2 == (Maths. function)
You must add "#include " after "#include " and before "main()"
For example:
#include
#include
main()
Square Root -- sqrt(x)
Absolute value -- abs(x)
X times X -- pow(x,2)
Log -- log(x)
Ceiling -- ceil(x) = (1.2 will change to 1.0)
Floor -- floor(x) = (1.2 will change to 2.0)
----------------------------------------
== Reference 3 == (if..else)
"if..else" is using for if you have two choices.
Example(1):
(if 'input' and 'a' are the same, then it'll print 'Yes' on the screen)
(if 'input' and 'a' are not same, then it'll skip the action below this fuction)
if (input == a)
printf("Yes");
Example(2):
(if the program have two action)
if (input == a)
printf("Yes");
else
printf("No");
Example(3)
(if..else if)
(if 'input' is not equal to 'a' or 'b', then the program will skip these two action)
if (input == a)
printf("Good");
else if (input == b)
printf("Fair");
Example(4)
(if you have more than one action that need to run below 'if' or 'else')
(then you need to add '{' and '}' at the begin and end of the action)
if (input == a)
{ printf("Yes");
printf("Good");
}
----------------------------------------
== Reference 4 == (while looping)
"while" is using for your program that need to run the action many times.
Example:
(Please see 'Program 6' on Example page)
----------------------------------------
== Reference 5 == (Use of string)
String Copy - strcpy
Add to last - strcat
String Compare - strcmp
String Length - strlen
Example(1) (String Copy)
('a' copy to 'b')(suppose 'a' is 'abc' and 'b' is nothing)
strcpy(b,a);
printf("%s\n%s",a,b);
== Output ==
abc
abc
Example(2) (Add to last)
('a' add to 'b')(suppose 'a' is 'abc' and 'b' is 'def')
strcat(b,a);
printf("%s",b);
== Output ==
defabc
Example(3) (String Compare)
(this function let you to compare two string is same or not)
(if it is same, then it'll output '0')
(we usually use 'strcmp' in 'if..else' and 'while looping')
(suppose 'a' is 'abc' and 'b' is 'abc')
while (strcmp(a,b)==0)
printf("both of them are same.");
Example(4) (String Length)
(this function let you to know how many character has input in the variable)
(suppose 'a' is 'tree' and count is a integer)
count = strlen(a);
printf("%d",count);
== Output ==
4
               (
geocities.com/tokyo/garden/8818)                   (
geocities.com/tokyo/garden)                   (
geocities.com/tokyo)