#include <iostream>
#include <cstring>
using namespace std;
int main()
{
int n;
cin >> n;
string a;
cin >> a;
int index;
for(int i=0;i<strlen(a);i++)
{
if(a[i]=="?")
{
index=i;
}
}
cout << index;
return 0;
}
I want to find the "?" in the string if there is any, but I get error: "ISO C++ forbids comparasion between pointer and integer"
Any help?
Use single quotes around the '?' character to indicate a char instead of a string. That's why your comparison is failing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With