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'){

    return 0;
    return 0;

Screenshot-64.pngScreenshot (64).png
Terjadi error ketika saya mencoba membuat if dengan kondisi pada array pertama.
mohon bantuannya. 

avatar nandadwihusnasadikin


3 Kontribusi 1 Poin

Jawaban Terpilih

Coba #include <string.h>
avatar patrickbambang


2 Kontribusi 4 Poin


Coba #include <string.h>
avatar patrickbambang


2 Kontribusi 4 Poin

tanda '  ' di ganti sama " " di pusing

if(b[0] == 'pusing')
if(b[0] == "pusing")

karena variabel b di deklarasikan sebagai string
avatar muhammadfatih_google_6459


1 Kontribusi 1 Poin

virtual phone
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"
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.

avatar llugroujo


1 Kontribusi 0 Poin

Login untuk gabung berdiskusi