# include
using namespace std;
Int main () {
Char s [80], a;
int i;
Cin. Getline (s, 80);
Cin> a;
for(i=0; S [I]!='\ 0'; I++) {
If cout< (s [I]==a); & lt;" The characters in a string for the first time in the subscript is: "& lt; }
If (I - 1==strlen (s)) cout<1 & lt;
}
CodePudding user response:
Break the location of the wrong, it should belong to the if statement inside, add a bracket on the# include
# include
using namespace std;
Int main () {
Char s [80], a;
int i;
Cin. Getline (s, 80);
Cin & gt;> a;
for (i=0; S [I]!='\ 0'; I++) {
If (s==a) [I] {
Cout & lt; <"The character in the string for the first time in the subscript is:" & lt; break;
}
}
If (I - 1==strlen (s)) cout & lt; <1 & lt;return 0;
}