Note_20150204_C++ Basics
来源:互联网 发布:如何安装网络监控 编辑:程序博客网 时间:2024/05/02 04:33
Just as what I have state, this is just my own note.
1. All C++ programs must have a main() function, and it is there that program execution begins.
2. All variable must be declared before they are used.
3. C++ supports a variety of data types, including integer and floating point. (All right, WTF, there is no fixed-point)
4. The output operator is <<, and when used with cout, it causes information to be displayed on the screen.
5. The input operator is >>, and when used with cin, it reads information from the keyboard.
6. Program execution stops at the end of main().
In C++, one function cannot be embedded within another function. But could call.
A prototype declares a function prior to its first use.
A parameter is a variable defined by a function that receives an argument.
The term argument refers to the value that is used to call a function. The variable that receives the value of an argument is called a parameter. In fact, functions that take arguments are called parameterized function.
//Returning a value example.
#include<iostram>
using namespace std;
int mul(int x, int y);
int main()
{
int answer;
answer = mul (10,11); //assign return value
cout << "The answer is " << answer;
return 0;
}
int mul(int x, int y)// here we declare the return typing and the function name, its parameter
{
return x*y;//return product of x and y
}
The General Form of C++
return-type function-name(parameter list)
{
body of the function
}
Global Variable: Make a variable and its data stay in existence throughout the entire execution of the program.
\b-------backspace
\f--------form feed
\n--------newline
\r--------carriage return
\t--------horizonal tab
\"--------double quote
\'--------single quote character
\\--------backslash
\v--------vertical tab
\a--------alert
\?--------?
\N--------octal constant
\xN--------hexadecimal constant
C+has three general classes of operators: arithmetic, relational and logcial, and bitwise.
The modulus operator % also works in C++ in the same way that it does in other languages. Remember that the modulus operation yields the remainders of an integer division.
A one-dimensional array is a list of related variables. type var_name[size]
- Note_20150204_C++ Basics
- Basics
- Menu Basics
- XML Basics
- WAP Basics
- Internet Basics
- HTML Basics
- Xen Basics
- USB Basics
- DC Basics
- template basics
- maven basics
- OOP-basics
- RCU - Basics
- Git Basics
- SVN Basics
- git basics
- iptables basics
- STL常用容器成员函数列表
- codeforces 478D Red-Green Towers (dp)
- cocos2d-x 地图随英雄移动
- 遍历HashMap的方法
- (四)封装和优化的一些规范
- Note_20150204_C++ Basics
- 条款10 令operator=返回一个reference to *this
- 一个JavaScript库,用于多点触摸手势:Hammer.js
- 重连通分量
- Ubuntu下CodeBlock基本环境配置
- hadoop-1.2.1伪分布配置hbase-0.98.0
- registry key 'Java Runtime Environment' has value'1.8',but '1.7' is requaired
- LeetCode 16.3Sum Closest
- 啊哈C——学习5.9练习