#include<iostream>
#include<string>
using namespace std;
//function to search for the name in the array
int search(string name[], string uname, int n)
{
//iterate over the array
for(int i = 0;i < n;i++)
{
//if the name in array if equal to
the given name, return the index
if(name[i] == uname)
{
return i;
}
}
//if the name not found in the array return -1
return -1;
}
int main()
{
//create two parallel arrays
string name[] = {"name1", "name2", "name3"};
string password[] = {"password1", "password2",
"password3"};
//prompt the user to enter name
cout<<"Enter your name: name: ";
string uname;
cin>>uname;
//prompt the user to enter password
cout<<"Enter your password: ";
string pass;
cin>>pass;
//calculate the size of the array
int n = sizeof(name)/sizeof(name[0]);
//search the name in the names array
int index = search(name, uname, n);
if(index != -1)
{
//if the current name and password
are at the same index in parallel arrays
if(password[index] == pass)
{
//match
them
cout<<"It's matching!"<<endl;
}
else
{
//otherwise they
are not matching
cout<<"It's NOT matching!"<<endl;
}
}
//if the name not found in the array, they are not
matching
else
{
cout<<"It's NOT
matching!"<<endl;
}
}

If you have any doubts please comment and please don't dislike.
Exercise Five: (Parallel Array) In this exercise create two string arrays. One array will hold your...
Design a program that has two parallel arrays: a String array named people that is initialized with the names of seven of your friends, and a String array named phoneNumbers that is initialized with your friends’ phone numbers. The program should allow the user to enter a person’s name (or part of a person’s name). It should then search for that person in the people array. If the person is found, it should get that person’s phone number from the...
Design a program using a RAPTOR flowchart that has two parallel arrays: a String array named people that is initialized with the names of twenty of your friends, and a String array named phoneNumbers that is initialized with your friends’ phone numbers. The program should allow the user to enter a person’s name. It should then search for that person in the people array. If the person is found, it should get that person’s phone number from the phoneNumbers array...
Count the vowels in a string You'll create an array of 5 Strings (words and or phrases). Then, you will determine the number of vowels in each string and display each in a meaningful way. Examples: (Your choice as to how this will look. But, it must be neat and meaningful.) a nut for a jar of tuna: 8 vowels OR 8 vowels: a nut for a jar of tuna Must include this code within <?php and ?> tags Includes...
Write a C++ program that simulates a lottery game. Your program should use functions and arrays. Define two global constants: - ARRAY_SIZE that stores the number of drawn numbers (for example 5) -MAX_RANGE that stores the highest value of the numbers ( for example 9 ) The program will use an array of five integers named lottery, and should generate a random number in the range of 0 through 9 for each element of the array. The user should enter...
Lab: User login system (python) Create a user login system. Your code should do the following: 1.Load your user database from “UD.txt” (USE THE EXACT FILE NAME, file is given in the folder) 2.Display “Login or create a new user? Select L to login, select C to create new user.” 3. If wrong selection is entered, take the user back to step 2. 4. If the user entered “L”, display “Please enter your user name and hit enter” 5. Check...
The following code uses a Scanner object to read a text file called dogYears.txt. Notice that each line of this file contains a dog's name followed by an age. The program then outputs this data to the console. The output looks like this: Tippy 2 Rex 7 Desdemona 5 1. Your task is to use the Scanner methods that will initialize the variables name1, name2, name3, age1, age2, age3 so that the execution of the three println statements below will...
Array Processing - Dictionary Program NOTE: Review the parallel array example from class Another method of "Sequentially Searching an Array" is covered in the book in Chapter 8. Using Notepad, write psuedocode ONLY for the following situation. Create and load an array with the following 7 values. Add one more word (of your own choosing) for a total of 8 words. biff comely fez mottle peruke bedraggled quisling Create a second array (parallel array). To hold the defintions to these...
In Java, Please do not forget the ToString method in the
Student class!
In this exercise, you will first create a Student class. A Student has two attributes: name (String) and gradePointAverage (double). The class has a constructor that sets the name and grade point average of the Student. It has appropriate get and set methods. As well, there is a toString method that prints the student's name and their grade point average (highest is 4.0) You will then write...
Write a program that has an array of at most 50 strings that hold people’s names and phone numbers. You can assume each string’s length is no more than 40. You may make up your own strings, or use the following: "Becky Warren, 555-1223" "Joe Looney, 555-0097" "Geri Palmer, 555-8787" "Lynn Presnell, 555-1212" "Holly Gaddis, 555-8878" "Sam Wiggins, 555-0998" "Bob Kain, 555-8712" "Tim Haynes, 555-7676" "Warren Gaddis, 555-9037" "Jean James, 555-4939" "Ron Palmer, 555-2783" The program should ask the user...
This is a two-part assignment. It is better to submit the files for both parts when you are done than to submit part 1 first and part 2 later.In the Array.h file includes the class definition and member functions implementations.PART 1Write And Test An Array Class [Array.TestDriver.cpp] Write a data structures class. The resulting class can be used in any program in place of a C++ array, in case you want the advantages of range safety and built-in size tracking.Requirements....