I'm using the book C++primer by Stanley B.Lippman and this error is caused by the solution of Excersise 3.2.3 test 3.10.It requires that write a program that reads a string of characters including punctuation and writes what was read but with the punctuation removed.
here's the code:
#include "stdafx.h"
#include <iostream>
#include <string>
#include <cctype>
using namespace std;
int main() {
string s;
cout << "Please input a string of characters including punctuation:" << endl;
getline(cin, s);
for (auto c : s) {
if (!ispunct(c))
cout << c;
}
cout << endl;
return 0;
}
when I run this code in Visual studio 2017 it shows this:
Debug Assertion failed.
Expression:c>=-1&&c<=255
For information on how your program can cause an assertion failure,see the Visual C++ documentation on asserts.
why it shows like this? I can't understand.