To make the program more useful for aging population, this assignment shall perf
ID: 3539218 • Letter: T
Question
To make the program more useful for aging population, this assignment shall perform the same whole name or partial name search as in Program Challenge 10- 18 with one additional feature:
The search shall return all results with no typos, or one letter typo, or one digit typo with the same string length of the entered search pattern. The letters including a-z and A-Z characters. The digits include 0-9. No other characters are not required to be included in this program. For example,
*case 1: search on "8765" also returns the following matched patterns: "8767", "8865", "8715", ...etc.
*case 2: search on "abcd" also returns the following matched patterns: "abcb", "zbcd", "abad", ...etc.
i made code until no typo..
but i dont know how to make one typo
this is my code
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
const int num=11;
const int length=27;
char people[num][length] = {"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"};
char lookUp[length];
char *strPtr = NULL;
int i;
cout<< " People and Phone numbers"<<endl;
cout<< "Enter name or phone number: ";
cin.getline(lookUp, length);
cout<<"result: "<<endl;
for (i=0; i<num; i++)
{
strPtr = strstr(people[i], lookUp);
if (strPtr != NULL )
{
cout<<" "<<people[i]<<endl;
}
}
if (strPtr == NULL )
{
cout << "No matching product was found"<<endl;
}
}
Explanation / Answer
I can't use the system(pause) and the results turn out to be double. How can I fix this ?
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.