error C3861: 'paint_Menu': identifier not found
Mar 6, 2018 at 7:26am UTC
What do this error means
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
int numInList;
void addName()
{
if (numInList < MAX)
{
system ("CLS" );
cout << "Enter Name: " ;
cin >> list[numInList].name;
cout << "Enter IC number: " ;
cin >> list[numInList].ic;
cout << "Enter State: " ;
cin >> list[numInList].state;
cout<<"Enter Contact number:" ;
cin >> list[numInList].num;
numInList++;
}
else
{
cout << "List full\n" ;
}
}
void printOneName(int i)
{
int choice;
system ("CLS" );
cout << endl;
cout << list[i].name << endl;
cout << list[i].ic << endl;
cout << list[i].state << endl;
cout << list[i].num << "\t" <<endl;
cout<<"1 Back to MainMenu" ;
cin>>choice;
switch (choice)
{ case 1:
paint_Menu();
break ;
}
}
void printNames()
{ int i;
int choice;
if (numInList<=0)
{
system("CLS" );
cout<<"List is empty\n" ;
cout<<"1 Back to MainMenu" ;
cin>>choice;
switch (choice)
{ case 1:
paint_Menu();
break ;
}
}
else
{
system ("CLS" );
for (i=0; i < numInList; i++)
printOneName(i);
cout<<"1 Back to MainMenu" ;
cin>>choice;
switch (choice)
{ case 1:
paint_Menu();
break ;
}
cout << endl;
}
}
void findName()
{
char s[20];
int i;
int found=0;
if (numInList==0)
{
cout << "List empty\n" ;
}
else
{
cout << "Enter name to find: " ;
cin >> s;
for (i=0; i < numInList; i++)
{
if (strcmp(s,list[i].name)==0)
{
printOneName(i);
found=1;
}
}
if (!found)
cout << "No match\n" ;
}
}
void paint_Menu(int i)
{
system ("CLS" );
cout<<"*******************************************************" <<"\n" ;
cout<<"* * * *" <<"\n" ;
cout<<"* * Welcome to * *" <<"\n" ;
cout<<"* * Emmanuel Travel Agency * *" <<"\n" ;
cout<<"* * * *" <<"\n" ;
cout<<"*******************************************************" <<"\n" ;
cout<<"Select number to perform action(1-5)" <<"\n" ;
cout<<"[1] Register Customer" <<"\n" ;
cout<<"[2] Display Customer Details" <<"\n" ;
cout<<"[3] Search Customer Details" <<"\n" ;
cout<<"[4] Modify Customer Details" <<"\n" ;
cout<<"[5] Quit" <<"\n" ;
}
int main()
{
char choice[10];
int done=0;
numInList=0;
while (!done)
{
paint_Menu(int i);
cin >> choice;
switch (choice[0])
{
case '1' :
addName();
break ;
case '2' :
printNames();
break ;
case '3' :
findName();
break ;
case '4' :
done=1;
break ;
case '5' :
done=1;
break ;
default :
cout << "invalid choice.\n" ;
}
}
}
Mar 6, 2018 at 9:09am UTC
It means that when the compiler got to line 41, it had no idea what paint_Menu
was. The compiler needs to know what paint_Menu
is before using it.
Mar 6, 2018 at 9:56am UTC
@repeater
Isn't my paint_menu function there ?
how come ..
Mar 6, 2018 at 12:38pm UTC
The compiler starts reading at the top.
It gets to line 41. Where, in the previous 40 lines, did it learn what paint_Menu
is? Nowhere. The compiler needs to see the function definition or declaration before having to use it.
Mar 6, 2018 at 4:33pm UTC
@Repeater Okay.Thanks for guiding
Topic archived. No new replies allowed.