The code looks like this:
Copy Code code as follows:
#include
#include
#define N 10//n factorial
int main ()
{//array 1-bit 1!
int Ary[n] = {1, 1};
int I, J;
for (i = 2; I {
The factorial of each subscript, the No. 0 digit
1. System (Execute shell command)
related FunctionsFork,execve,waitpid,popen
Table header File#include
Defining Functionsint system (const char * string);
function DescriptionSystem () invokes fork () to produce a subprocess that is invoked by
In some of the previous reading or learning, there has been a feeling of the attitude of the problem, that is to think that understand, but do not do, I feel that the effect of reading is not very big. ls command is estimated that we use the most in
The problem of baby cows ' children
Description: A newborn cow begins the 4th year with a cow (assuming only a cow) and a year later. Now give you a newborn cow, and ask how many cows are there in 20 years?I try to write two methods, deficiencies,
1.const and references
You can bind a reference to a constant, called a reference to a constant. You cannot assign a value to that reference.
Such as:
const int CI = 1024;
const int &ri = CI;
Interpretation: RI is a reference to CI.
Personal implementation Examples:
Copy Code code as follows:
#include
#include
#define M 4
int add (int a, int b);
int sub (int a, int b);
int mul (int a, int b);
int div (int a, int b);
Int (*oper_func[]) (int, int) = {
Add,
let's look at one of the following examples
A.C:
Copy Code code as follows:
int main (int argc, char *argv[])
{
fprintf (stdout, "normal\n");
fprintf (stderr, "bad\n");
return 0;
}
$/A
Normal
Bad
$/a > TMP 2>&1
$ cat
Customize a chain-type stack, C + + language implementation, deficiencies, also hope to correct!
Copy Code code as follows:
MyStack.cpp: Defines the entry point for a console application.
Construct a chain stack of its own, with push
Use the following sequence to declare the pointer.
[Storage-class-specifiers] [Cv-qualifiers] Type-specifiers
[ms-modifier] declarator;
Any valid pointer specifier can be used for declarator. The syntax for the simple pointer
C + + How to generate random numbers: Here is the rand () function, the Srand () function, C + + does not have the random (int number) function.
(1)If you just generate random numbers and don't need to set a range, you can just use RAND (): rand ()
We can write programs in a variety of ways for a particular task. The following code can also implement the function of the previous temperature conversion program: #include
/* Print Fahrenheit temperature-Celsius temperature
For a C language program, the memory space consists primarily of five parts of the code segment (. Text), the data segment (. data), the BSS segment (. BSS), the heap and the stack, where code snippets, data segments, and BSS segments are compiled
Let's take a look at the code to see the results of three ways of passing.
Copy Code code as follows:
#include
#include
using namespace Std;
void Change1 (int n)
{
cout n + +;
}
void Change2 (int &n)
{
cout n + +;
}
void
Compiler header files using gcc do not contain stdlib.h, use the Atoi function (atoi function is declared in stdlib.h), compile without error
If you add the-wall option at compile time, there will be a warning, excuse me, why is this?This is
inline functions (in-line functions, built-in functions)
Calling a function requires a certain amount of time and space overhead. C + + provides a way to improve efficiency by replacing function calls at compile time with function bodies, similar
1. ForewordThe Unix world has a famous saying: "A line of shell script than Wan C program", although this sentence is somewhat exaggerated, but it is undeniable that the use of scripting can greatly simplify some programming work. For example, to
In C, one of the common uses of function pointer variables is to pass the function name to the formal parameters of the other function as a function parameter. This allows you to call a different function in the process of calling a function based
C language GETCWD () function: Get the current working directoryheader file:
#include
To define a function:
char * GETCWD (char * buf, size_t size);
Function Description: GETCWD () copies the current working directory
C language Getpid () function: Get process identifierheader file:
#include
To define a function:
pid_t getpid (void);
Function Description: Getpid () is used to obtain the process identification code for the current
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service