this the program that im doing..
when i compile it i get the error
(expected primary expression before "char" in line 20
and storage size of "B" isn't known in line 12)
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
#include <string.h>
using std::operator>>;
#include <conio.h>
int main ()
{
char A [] = "akire";
char B [];
cout << "\t\t\tGUESS A PASSWORD";
cout << "\n\t\t ";
cin >> char B[];
if (char B[] == char A[])
cout << "\n\n\n\n\t\t CONGRATULATIONS!!! YOU HIT IT.." << endl;
if (char B[] != char A[])
cout << "\n\n\n\n\t\t MALI KA... BUTI NGA SAYO!!!" << endl;
getch ();
return 0;
}
When you declare the "B" you use [] which means that it will be an array. To use this syntax you must initialize the array the same time (like "A"). Else you have to enter in the [] the size of your array.
When you use cin >> char B[]; you have to enter the position of the B array where you want to store the user's input. To read into an array you need a loop.
Also you shouldn't use the "char B[]" everywere you wantto use the B array bbecause itis syntax error. You should use B[position].
Last you cant compare arrays with (B[] == A[]). You need to check each value individually.