- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
string s;
cout << "input words order:" << endl;
getline(cin, s);
int pos=0;
while (true)
{
pos=s.find(" ", pos+1);
if (pos==string::npos)
break;
num++;
}
num++;
string words[num];
pos=0;
for (int i=0; i<num; i++)
{
pos=s.find(" ");
if (pos==string::npos)
{
words[i]=s;
break;
}
words[i]=s.substr(0, pos);
pos++;
s=s.erase(0, pos);
}
что за компилятор?
gcc
оно в MSVC ругается?
За C++ не знаю.
Итак, где здесь C++?=:P
http://en.wikipedia.org/wiki/Variable-length_array
А вот VS 2008 нет.