Write the code to ask a user to enter a word and store it in astring called currentPassword. Also write the code to search theentire array of Passwords from the previous question. Every time itfinds currentPassword in the array, it should increment a variablecalled totalPasswords. When it is finished, it should print thisvariable. You may assume that the array called Passwords has beendeclared and initialized. Do not assume anything else has beendeclared or initialized.
in c++
Solution
NOTE: Information about password array is not given,Sohere it is assumed that array is of type string.
#include <iostream>
using namespace std;
int main()
{
string currentPassword;
int totalPasswords=0;
cout<<“Enter a
OR
OR