Nuts I'll be soon. I still cant get this to run.It keeps telling me cannot convert from const and I cant find where I declared a constant. Help Please!

#include <iostream>
#include <iomanip>
#include <conio.h>
 
using namespace std;
void call(void (*));
void Menu(char [11][25]);
void Add(char [11][25]);
void Update(char [11][25]);
void Delete(char [11][25]);
void Sort(char [11][25]);
void Print(char [11][25]);
void Printarr(char [11][25]);
void Quit(char [11][25]);
 
char Option, *oPtr = &Option;
char ArraySize =[11][25];
char fname[11][25]={"none","none","none","none",
"none","none","none","none","none","none"};
int main()
{

system("cls");
Menu(fname);
return 0;
}
void call(void (*opt)(char arr[11][25]))
{
(*opt)(fname);
}
void Menu(char arr[11][25])
{
void (*f[6])(char arr[11][25]) = {Add, Update, Delete, Sort, Printarr, Quit};
cout << "\t Menu"
<< "\n1. Add"
<< "\n2. Update"
<< "\n3. Delete"
<< "\n4. Sort"
<< "\n5. Print"
<< "\n6. Quit" 
<< "\n\nChoose and Option: ";
cin >> Option;
call(f[Option-1]);
}
void Add(char arr[11][25])
{
int Subscript = 0;
system("cls");
cout << "\t Adding Name Page\n\n";
Print(arr);
cout << "\n Which element do you want to add a name to (0 - 9): ";
cin >> Subscript;
if (Subscript < 0 || Subscript > 9)
{
cout << "\nSorry Invalid Selection Hit Enter to Return to the Main Menu\n";
system("pause");
system("cls");
Menu(fname);
}
else
{
if(strcmp(arr[Subscript], "none")== 0)
{
cout << "\nEnter a name: ";
cin >> arr[Subscript];
system("cls");
Menu(fname);
}
else
{
cout << "A name is already in this array. If you want"
<< "\nto update please go back to the Main Menu and "
<< "\nchoose the update option." << endl;
system("pause");
system("cls");
Menu(fname);
}
}
}
void Update(char arr[11][25])
{
int Subscript = 0;
char choice = 'b';
system("cls");
cout << "\t Update Name Page\n\n";
Print(fname);
cout << "\nWhich element do you want to Update(0 - 9): ";
cin >> Subscript;

if(Subscript < 0 || Subscript > 9)
{
cout << "\nSorry Invalid Selection Hit Enter to Return to the Main Menu\n";
system("pause");
system("cls");
Menu(fname);
}
else
{
if(strcmp(arr[Subscript], "none")< 0||strcmp(arr[Subscript], "none")> 0)
{
cout << "A name is already entered into this array."
<< "\nAre you sure you want to update this name? (Y/N)";
cin >> choice;
if(choice == 'Y' || choice == 'y')
{
cout << "\nEnter a name: ";
cin >> arr[Subscript];
system("cls");
Menu(fname);
}
else if(choice == 'N' || choice == 'n')
{
system("cls");
Menu(fname);
}
else
{
cout << "\nSorry Invalid Selection\n";
system("pause");
system("cls");
Menu(fname);
}
}
else
{ 
if(strcmp(arr[Subscript], "none")== 0)
{
cout << "You chose an array that has none listed in it"
<< "\nplease go back to the Main Menu and "
<< "\nchoose the Add option." << endl;
system("pause");
system("cls");
Menu(fname);
}
}
system("cls");
Menu(fname);
}
}
void Delete(char arr[11][25])
{
int Subscript = 0;
char choice = 'b';
system("cls");
cout << "\t Delete Name Page\n\n";
Print(fname);
cout << "Which element do you want to change(0 - 9): ";
cin >> Subscript;
if(Subscript < 0 || Subscript > 9)
{
cout << "\nSorry Invalid Selection Hit Enter to Return to the Main Menu\n";
system("pause");
system("cls");
Menu(fname);
}
else
{
if(strcmp(arr[Subscript], "none")== 0)
{
cout << "There is nothing to delete in this array."
<< "\nPlease go back to the Main Menu and "
<< "\nchoose another option." << endl;
system("pause");
system("cls");
Menu(fname);
}
else
{
strcpy (arr[Subscript], "none") ;
}
}
system("cls");
Menu(fname);
}
void Sort(char arrNames[11][25])
{
char hold;
for (int Pass = 1; Pass < 10; Pass++)
{
for (int j = 0; j < 10 - 1; j++)
{
if(strcmp(arrNames[j], arrNames[j + 1]) > 0)
{
strcpy(hold, arrNames[j]);
strcpy(arrNames[j], arrNames[j+1]);
strcpy(arrNames[j+1], hold);
}
}
}
}
void Print(char arrNames[11][25])
{
for(int i = 0; i < 10; i++)
{
cout << "arrName[" << i << "] = " << arrNames[i] << endl;
}
}
void Printarr(char arrNames[11][25])
{
system ("cls");
cout << "\t Print Name Page\n\n";
for(int i = 0; i < 10; i++)
{
cout << "arrName[" << i << "] = " << arrNames[i] << endl;
}
cout << "\n\n";
system("pause");
system("cls");
Menu(fname);
}
void Quit(char arr[11])
{
cout << "Called Quit" << endl;

}

Recommended Answers

All 2 Replies

Try to indent your code, it makes it easier for yourself and more importantly (;)) for us.
Try to tell on what line you get the error by making it red in the code or something.

Few people want to wade through a lot of unindented code to find out where the problem occurs at all.

>>char ArraySize =[11][25];
This is incorrect syntax.

>>strcpy(hold, arrNames[j]);
variable hold is defined to be a single char. You can not copy a string to a char variable.

>>void Quit(char [11][25]);
Function prototype and actual function are different. your compiler will produce unresolved externals error.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.