I'm doing an assignment for school and can't get past this error. I'm getting an syntax error in my code stating on line 28 expected an expression before ']'. Thank you for your time. Edit: It now compiles but it doesn't find a display the name when entered.
#include<iostream>
#include<string>
using namespace std;
string searcharray(string [], string);
int main()
{
string Phone_Numbers[] = { "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" };
string Name, found;
cout << "Please enter a name to display the phone number: ";
getline(cin, Name);
found = searcharray(Phone_Numbers, Name);
cout << "We found this Phone number listed with the name you entered: \n";
cout << found;
return 0;
}
string searcharray(string *Phone_Numbers, string Name)
{
string found;
found = Phone_Numbers[]->find(Name);
return found;
}
Aucun commentaire:
Enregistrer un commentaire