---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Debug Assertion Failed!
Program: C:\Windows\SYSTEM32\MSVCP140D.dll
File: d:\program files (x86)\microsoft visual studio 14.0\vc\include\xstring
Line: 1682
Expression: string subscript out of range
For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.
(Press Retry to debug the application)
---------------------------
中止(A) 重试(R) 忽略(I)
---------------------------
//for ( index = 0; index != sizeof(str1); ++index)
//sizeof是查看字节的,写法错误。
for ( index = 0; index != str1.size(); ++index)
{
if (ispunct(str1[index]))
str1_sum += 1;
}
#include
#include
int main()
{
using namespace std;
string str1;
int str1_sum(0);
cout
关注
打赏
