C++

来自开放百科 - 灰狐
(版本间的差异)
跳转到: 导航, 搜索
第8行: 第8行:
 
     std::cout << "hello, world\n";
 
     std::cout << "hello, world\n";
 
}
 
}
 +
==Library==
 +
Standard C++ library headers listed below, 13 constitute the Standard Template Library, or STL.
 +
*<algorithm> -- (STL) for defining numerous templates that implement useful algorithms
 +
*<bitset> -- for defining a template class that administers sets of bits
 +
*<cassert> -- for enforcing assertions when functions execute
 +
*<cctype> -- for classifying characters
 +
*<cerrno> -- for testing error codes reported by library functions
 +
*<cfloat> -- for testing floating-point type properties
 +
*<ciso646> -- for programming in ISO 646 variant character sets
 +
*<climits> -- for testing integer type properties
 +
*<clocale> -- for adapting to different cultural conventions
 +
*<cmath> -- for computing common mathematical functions
 +
*<complex> -- for defining a template class that supports complex arithmetic
 +
*<csetjmp> -- for executing nonlocal goto statements
 +
*<csignal> -- for controlling various exceptional conditions
 +
*<cstdarg> -- for accessing a varying number of arguments
 +
*<cstddef> -- for defining several useful types and macros
 +
*<cstdio> -- for performing input and output
 +
*<cstdlib> -- for performing a variety of operations
 +
*<cstring> -- for manipulating several kinds of strings
 +
*<ctime> -- for converting between various time and date formats
 +
*<cwchar> -- for manipulating wide streams and several kinds of strings
 +
*<cwctype> -- for classifying wide characters
 +
*<deque> -- (STL) for defining a template class that implements a deque container
 +
*<exception> -- for defining several functions that control exception handling
 +
*<fstream> -- for defining several iostreams template classes that manipulate external files
 +
*<functional> -- (STL) for defining several templates that help construct predicates for the templates defined in <algorithm> and <numeric>
 +
*<iomanip> -- for declaring several iostreams manipulators that take an argument
 +
*<ios> -- for defining the template class that serves as the base for many iostreams classes
 +
*<iosfwd> -- for declaring several iostreams template classes before they are necessarily defined
 +
*<iostream> -- for declaring the iostreams objects that manipulate the standard streams
 +
*<istream> -- for defining the template class that performs extractions
 +
*<iterator> -- (STL) for defining several templates that help define and manipulate iterators
 +
*<limits> -- for testing numeric type properties
 +
*<list> -- (STL) for defining a template class that implements a list container
 +
*<locale> -- for defining several classes and templates that control locale-specific behavior, as in the iostreams classes
 +
*<map> -- (STL) for defining template classes that implement associative containers
 +
*<memory> -- (STL) for defining several templates that allocate and free storage for various container classes
 +
*<numeric> -- (STL) for defining several templates that implement useful numeric functions
 +
*<ostream> -- for defining the template class that performs insertions
 +
*<queue> -- (STL) for defining a template class that implements a queue container
 +
*<set> -- (STL) for defining template classes that implement associative containers with unique elements
 +
*<sstream> -- for defining several iostreams template classes that manipulate string containers
 +
*<stack> -- (STL) for defining a template class that implements a stack container
 +
*<stdexcept> -- for defining several classes useful for reporting exceptions
 +
*<streambuf> -- for defining template classes that buffer iostreams operations
 +
*<string> -- for defining a template class that implements a string container
 +
*<strstream> -- for defining several iostreams classes that manipulate in-memory character sequences
 +
*<utility> -- (STL) for defining several templates of general utility
 +
*<valarray> -- for defining several classes and template classes that support value-oriented arrays
 +
*<vector> -- (STL) for defining a template class that implements a vector container
  
 
==C++学习==
 
==C++学习==

2008年5月18日 (日) 06:36的版本

C++语言是一种应用较广的面向对象的程序设计语言,使用它可以实现面向对象的程序设计。面向对象的设计与面向过程的设计是有很大区别的,面向对象的程序设计是在面向过程的程序设计的基础上一个质的飞跃。要学会面向对象的程序设计,首先要学会一种面向对象的语言,即要学会用VC编程,就要先有C++的基础,而学习C++语言首先要认识它面向对象的特性和实现面向对象的方法。

第一个 C++ 程序

  1. include <iostream>

int main() {

   std::cout << "hello, world\n";

}

目录

Library

Standard C++ library headers listed below, 13 constitute the Standard Template Library, or STL.

  • <algorithm> -- (STL) for defining numerous templates that implement useful algorithms
  • <bitset> -- for defining a template class that administers sets of bits
  • <cassert> -- for enforcing assertions when functions execute
  • <cctype> -- for classifying characters
  • <cerrno> -- for testing error codes reported by library functions
  • <cfloat> -- for testing floating-point type properties
  • <ciso646> -- for programming in ISO 646 variant character sets
  • <climits> -- for testing integer type properties
  • <clocale> -- for adapting to different cultural conventions
  • <cmath> -- for computing common mathematical functions
  • <complex> -- for defining a template class that supports complex arithmetic
  • <csetjmp> -- for executing nonlocal goto statements
  • <csignal> -- for controlling various exceptional conditions
  • <cstdarg> -- for accessing a varying number of arguments
  • <cstddef> -- for defining several useful types and macros
  • <cstdio> -- for performing input and output
  • <cstdlib> -- for performing a variety of operations
  • <cstring> -- for manipulating several kinds of strings
  • <ctime> -- for converting between various time and date formats
  • <cwchar> -- for manipulating wide streams and several kinds of strings
  • <cwctype> -- for classifying wide characters
  • <deque> -- (STL) for defining a template class that implements a deque container
  • <exception> -- for defining several functions that control exception handling
  • <fstream> -- for defining several iostreams template classes that manipulate external files
  • <functional> -- (STL) for defining several templates that help construct predicates for the templates defined in <algorithm> and <numeric>
  • <iomanip> -- for declaring several iostreams manipulators that take an argument
  • <ios> -- for defining the template class that serves as the base for many iostreams classes
  • <iosfwd> -- for declaring several iostreams template classes before they are necessarily defined
  • <iostream> -- for declaring the iostreams objects that manipulate the standard streams
  • <istream> -- for defining the template class that performs extractions
  • <iterator> -- (STL) for defining several templates that help define and manipulate iterators
  • <limits> -- for testing numeric type properties
  • <list> -- (STL) for defining a template class that implements a list container
  • <locale> -- for defining several classes and templates that control locale-specific behavior, as in the iostreams classes
  • <map> -- (STL) for defining template classes that implement associative containers
  • <memory> -- (STL) for defining several templates that allocate and free storage for various container classes
  • <numeric> -- (STL) for defining several templates that implement useful numeric functions
  • <ostream> -- for defining the template class that performs insertions
  • <queue> -- (STL) for defining a template class that implements a queue container
  • <set> -- (STL) for defining template classes that implement associative containers with unique elements
  • <sstream> -- for defining several iostreams template classes that manipulate string containers
  • <stack> -- (STL) for defining a template class that implements a stack container
  • <stdexcept> -- for defining several classes useful for reporting exceptions
  • <streambuf> -- for defining template classes that buffer iostreams operations
  • <string> -- for defining a template class that implements a string container
  • <strstream> -- for defining several iostreams classes that manipulate in-memory character sequences
  • <utility> -- (STL) for defining several templates of general utility
  • <valarray> -- for defining several classes and template classes that support value-oriented arrays
  • <vector> -- (STL) for defining a template class that implements a vector container

C++学习

C++语言中出现的 extern "C"语法

extern "C" {
  extern int getopt(int, char * const *, const char *);
  extern char *optarg;
}

被extern "C"修饰的变量和函数是按照C语言方式编译和连接的;

这源于C++支持函数重载,而过程式语言C则不支持。而编译后的名字会有所不同,

void foo( int x, int y ); 
c  编译后 _foo
c++ 编译后 _foo_int_int
void foo( int x, float y )
c++ 编译后 _foo_int_float

编译后的类似_foo_int_int这样的名字包含了函数名、函数参数数量及类型信息,C++就是靠这种机制来实现函数重载的。

相关链接

Free C/C++ Compilers

C/C++ News Groups

  • comp.lang.c.moderated
  • comp.lang.c++.moderated
  • comp.std.c++

C/C++ Misc

C++ Libraries

精彩图集

Cpp-book.jpg

VC ++

VC++6.0MSDN

下载1 ISO文件 
下载2 RAR 文件
下载3 RAR 文件

External links

Materials

Tutorials

Electronic books

Support

Other

Libraries and code repositories

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱