How can use the proper code to compare an input array with string?
#include<iostream>
#include<cstring>
#include<stdlib.h>
using namespace std;
int main()
{
char user[30] ;
string nama[5]="ali33,abu123,ahmad456,kasim123,rahmat123";
int w,i ;
cout<<"username : ";
cin>>user[30];
for(i=0;i>=0;++i)
{
w=strcmp(nama[i],user);
}
I'm using Dev-C++, and the error is on this line:
w=strcmp(nama[i],user)
Does anyone know how to fix this?
cin>>user[30];does? And yourforloop makes no sense. Basically, most of your code makes no sense, and without comments, we have no way to know what it's supposed to do.