#includeusing namespace std; int main() { cout << "Come up and C++ me some time.n"; cout << "YOu won't regret it.!" << endl; return 0; }
通常,C++函数可被其他函数激活或调用,函数头阐明了函数与调用他的函数之间的接口。位于函数名前面的部分叫做函数返回类型,函数名后面的部分叫做形参列表。可使用int main(void)或void main()作为开头
#includeusing namespace std; int main(void) { cout << "Come up and C++ me some time.n"; cout << "YOu won't regret it.!" << endl; return 0; }
#includeusing namespace std; void main() { cout << "Come up and C++ me some time.n"; cout << "YOu won't regret it.!" << endl; }
using叫做编译指令。简单来说,没加之前使用cout需要写为std::cout<<"Hello World".使用之后可省略std。
变量名:
1、在名称中只能使用数字、字母、字符和下划线。
2、名称的第一个字符不能是数字。
3、区分大写字符和小写字符。
4、不能将关键字作为名称。
进制的转换
#includeusing namespace std; int main() { int chest = 42; int waist = 42; int inseam = 42; cout << "chest =" << chest << " (decimal for 42)" << endl; cout << hex; cout << "waist =" << waist << " (hexadecimal for 42)" << endl; cout << oct; cout << "inseam =" << inseam << " (octal for 42)" << endl; return 0; }



