实际上,C++11标准作为一种趋势,大有占领C类语言编程界的苗头,不过确实好用,说起来还得妙一句啊!
int main() { //attention please //int arr[size__] = {0}; for (int i = 0; i != 10; i++) { arr[i] = i; } for (auto j : arr) { cout << j << endl; } //another //int ia[txt_size()]; //const char ca[] = { 'h','e','l','l','o' }; const string ca("hello"); //const char* p = ca; auto p = &ca[0]; while (*p) { cout << *p++ << endl; } //str string ss; //di di di, error //ss[0] = 'H'; //ss[1] = 'e'; ss.append("H"); ss.append("e"); ss.append("l"); ss.append("l"); ss.append("o"); cout << ss << endl; return 0; } constexpr unsigned int txt_size() { //return -1; return 6; }
C#也是一种靠谱的语言,C、C++、C#等,有交集,当然也有很大的区别,关键是,一不小心就用混了,所以,挑兼容性高的用,与时俱进比较好!