Error pada program c++ error: no match for 'operator==' (operand types are 'std::string'

#include <iostream>
#include <string>

using namespace std;

int main()
{
    int a;
string b[10];
 cout<< "\t\t  Gejala Gejala \n";
 cout<< "\t1.pusing               3.batuk\n";
 cout<< "\t2.demam                4.Pilek\n";

cout << "Masukan Jumlah gejala : ";
            cin >> a;

 for (int i = 0; i < a; i++)
            {
                cout << "_________________________________________________________________________\n";
                cout << "\nMasukkan gejala Ke-" << i + 1 << endl;
                cout << endl;
                cout << "Nama gejala   : ";
                cin >> b[i];
                cout << endl;
            }

if(b[0] == 'pusing'){
    cout<<"berhasil\n";

}else{
    return 0;
}
    return 0;
}

Screenshot (64).png

Terjadi error ketika saya mencoba membuat if dengan kondisi pada array pertama.

mohon bantuannya.

avatar nandadwihusnasadikin
@nandadwihusnasadikin

3 Kontribusi 1 Poin

Diperbarui 2 tahun yang lalu

3 Jawaban:

Jawaban Terpilih

<div>Coba #include &lt;string.h&gt;</div>

avatar patrickbambang
@patrickbambang

2 Kontribusi 4 Poin

Dipost 2 tahun yang lalu

<div>tanda '&nbsp; ' di ganti sama " " di pusing<br><br></div><pre>if(b[0] == 'pusing')</pre><div>jadi</div><pre>if(b[0] == "pusing")</pre><div><br>karena variabel b di deklarasikan sebagai string</div>

avatar muhammadfatih_google_6459
@muhammadfatih_google_6459

1 Kontribusi 1 Poin

Dipost 2 tahun yang lalu

<div><a href="https://www.probestworld.com/voipphone">virtual phone</a><br>the club model is free for a one-12 months trial, which allows to screen blood sugar and maintain a healthy life-style. at the same time, customers will robotically turn out to be "diabetes angels"<br>individuals of, can take this direction to participate in publications on healthful existence, get consulting offerings on diabetes, and help each other with other diabetes fellow tourists inspire every different to live a more healthy existence.<br><br><br><br></div>

avatar llugroujo
@llugroujo

1 Kontribusi 0 Poin

Dipost 2 tahun yang lalu

Login untuk ikut Jawaban