Please see attached file.
I am getting 5 errors of "function does not take 3 parameters", one error at each case.
Please see attached file.
I am getting 5 errors of "function does not take 3 parameters", one error at each case.
just look at your code....
Code:void print (string names[50], int count, int areacode[50], int numbers[50]);you define the function print to take four varibales in it's prototype and only pass in three when you call it...Code:print (areacode, numbers, names);
i assume you wanted something a bit more like this:
yet i have no clue why you define print to arrays when you oly pass in single integers........Code:print (names, count, areacode, numbers);
I've taken care of the previous errors, but now I'm getting this:
"conditional expression of type 'class std::basic_string<char, struct std::char_traits<char>, class std::allocator<char> >' is illegal"
I have no idea what this means...
PLEASE HELP!!
That program still had two errors in it. First of all you can't use cin to get more then one character unless you use a speciaal function. The following statement:
should be replaced by:Code:cout<<"Enter name to be deleted: "; cin>>del;
the getline function will take all the symbols entered into the cin stream and save them into del untill it finds a newline character ('\n').Code:cout<<"Enter name to be deleted: "; getline(cin, del);
Second of all you made quite an elemantairy mistake in the if statement that gave you the error:
basically what you check here is if the del string got succesfully copied into names[item]. you would get better results when using:Code:if (names[item]=del)
but don;t worry about the second one to much evryone does it so now and then .Code:if (names[item] == del)
Thanks,
I had just figured out the first one before I checked your reply.
I fixed the second one--DUH!
but now I'm getting 2 more errors...
I think it may be a linking problem with my external file???
Here's my "phonelist.txt" and it's located in the same directory as my program:
419 4731212 Anna
313 8561212 Bobby
517 7341212 Cindy
800 5551212 Zoe
Last edited by DoItAllMom115; 04-16-2003 at 08:19 PM.
The linking error you got was because the prototype of the save function was different from it's initialization. You have to replace the initialization with:
you forgot the int count. Further more you have to make sure that you initialize all the variables you use. else you get pretty strange results.Code:void save(int areacode[50], int numbers[50], string names[50], int count) { ofstream outfile; outfile.open("phonelist.txt"); outfile<<areacode[50]<<numbers[50]<<names[50]; outfile.close(); }
Also you might wish to alter your print a bit so it will only output entries that actually exist and not just go through all the elements in the list. you could do this by limiting it's for loop till to aslong as item is less then count. Also i have my doubts about your save function you may wish to look over that. THere is most probably some other stuff in there i did not see yet. I only skimmed it over a bit.
I've got the program to compile.
The print function works ok, but none of the others do.
Mostly they just loop through the choices a few times.
HELP!!