theList();
cout << endl;
cout << "Elija una opcion: " << endl;
cout << "0. Salida programa." << endl;
cout << "1. Iserta un nodo al inicio de la lista." << endl;
// cout << "2. Inicia Busqueda en el programa." << endl;
// cout << "3. Move the current pointer back one node." << endl;
cout << endl << " >> ";
cin >> option;
switch (option)
{
case 1 : theList.includeName() ; break;
// case 2 : theList.FindItemDesp(); break;
//case 5 :Posicion_anterior_actual ;
}
}
while (option != 0);
};
10_Pruexamprogram1.cpp: In function âvoid includeName()â:
10_Pruexamprogram1.cpp:20: error: incompatible types in assignment of âcharâ to âchar [20]â
10_Pruexamprogram1.cpp:21: error: incompatible types in assignment of âcharâ to âchar [20]â
10_Pruexamprogram1.cpp:22: error: expected unqualified-id before â.â token
10_Pruexamprogram1.cpp:23: error: expected unqualified-id before â.â token
10_Pruexamprogram1.cpp: In function âchar GetString(char*)â:
10_Pruexamprogram1.cpp:28: error: expected initializer before âiâ
10_Pruexamprogram1.cpp:30: error: âsâ was not declared in this scope
10_Pruexamprogram1.cpp:31: error: expected `)' before â;â token
10_Pruexamprogram1.cpp:32: error: âdestinoItemâ was not declared in this scope
10_Pruexamprogram1.cpp:32: error: âstringlenâ was not declared in this scope
10_Pruexamprogram1.cpp:33: error: âiâ was not declared in this scope
10_Pruexamprogram1.cpp:34: error: âreturâ was not declared in this scope
10_Pruexamprogram1.cpp:34: error: expected `;' before âdestinoItemâ
10_Pruexamprogram1.cpp: In function âint main()â:
10_Pruexamprogram1.cpp:46: error: redeclaration of âDesplegalinklist<int> theListâ
10_Pruexamprogram1.cpp:45: error: âDesplegalinklist<int> theListâ previously declared here
10_Pruexamprogram1.cpp:46: error: no matching function for call to âDesplegalinklist<int>::FindItemDesp()â
10_exampr1.cpp:23: note: candidates are: DesplegaType Desplegalinklist<DesplegaType>::FindItemDesp(const DesplegaType&) const [with DesplegaType = int]
10_Pruexamprogram1.cpp:50: error: no match for call to â(Desplegalinklist<int>) ()â
10_Pruexamprogram1.cpp:62: error: âclass Desplegalinklist<int>â has no member named âincludeNameâ
#include "10_exampr1.cpp"
usingnamespace std;
void includeName();
char GetString(char *msg);
struct PersonNode{
char name[20];
int age;
};
void includeName()
{
PersonNode newName;
PersonNode newAge;
newName.name = GetString ("Entre Nombre:");
newAge.name = GetString ("Entre Edad:");
PersonNode.name.insert(newName);
PersonNode.age.insert(newAge);
}
char GetString (char *msg)
{
char s[20], i,*destinoItem;
cout<< msg;
cin.get(s,20);
while (cin.get(s[20] && s[81] !='\n');// no permite overflow
destinoItem = newchar[stringlen (s)+1];
for (i = 0; destinoItem[i] = toupper(s[i]); i++);
retur destinoItem;
}
main()
{
int option;
// int start = NULL;
do
{
Desplegalinklist <int> theList;
Desplegalinklist <int> theList = theList.FindItemDesp ( );
theList();
cout << endl;
cout << "Elija una opcion: " << endl;
cout << "0. Salida programa." << endl;
cout << "1. Iserta un nodo al inicio de la lista." << endl;
// cout << "2. Inicia Busqueda en el programa." << endl;
// cout << "3. Move the current pointer back one node." << endl;
cout << endl << " >> ";
cin >> option;
switch (option)
{
case 1 : theList.includeName() ; break;
// case 2 : theList.FindItemDesp(); break;
//case 5 :Posicion_anterior_actual ;
}
}
while (option != 0);
};
10_Pruexamprogram1.cpp: In function âvoid includeName()â:
10_Pruexamprogram1.cpp:20: error: incompatible types in assignment of âcharâ to âchar [20]â
10_Pruexamprogram1.cpp:21: error: incompatible types in assignment of âcharâ to âchar [20]â
10_Pruexamprogram1.cpp:22: error: expected unqualified-id before â.â token
10_Pruexamprogram1.cpp:23: error: expected unqualified-id before â.â token
10_Pruexamprogram1.cpp: In function âchar GetString(char*)â:
10_Pruexamprogram1.cpp:28: error: expected initializer before âiâ
10_Pruexamprogram1.cpp:30: error: âsâ was not declared in this scope
10_Pruexamprogram1.cpp:31: error: expected `)' before â;â token
10_Pruexamprogram1.cpp:32: error: âdestinoItemâ was not declared in this scope
10_Pruexamprogram1.cpp:32: error: âstringlenâ was not declared in this scope
10_Pruexamprogram1.cpp:33: error: âiâ was not declared in this scope
10_Pruexamprogram1.cpp:34: error: âreturâ was not declared in this scope
10_Pruexamprogram1.cpp:34: error: expected `;' before âdestinoItemâ
10_Pruexamprogram1.cpp: In function âint main()â:
10_Pruexamprogram1.cpp:46: error: redeclaration of âDesplegalinklist<int> theListâ
10_Pruexamprogram1.cpp:45: error: âDesplegalinklist<int> theListâ previously declared here
10_Pruexamprogram1.cpp:46: error: no matching function for call to âDesplegalinklist<int>::FindItemDesp()â
10_exampr1.cpp:23: note: candidates are: DesplegaType Desplegalinklist<DesplegaType>::FindItemDesp(const DesplegaType&) const [with DesplegaType = int]
10_Pruexamprogram1.cpp:50: error: no match for call to â(Desplegalinklist<int>) ()â
10_Pruexamprogram1.cpp:62: error: âclass Desplegalinklist<int>â has no member named âincludeNameâ
10_Pruexamprogram1.cpp:20: error: incompatible types in assignment of âcharâ to âchar [20]â
10_Pruexamprogram1.cpp:21: error: incompatible types in assignment of âcharâ to âchar [20]â
10_Pruexamprogram1.cpp:22: error: expected unqualified-id before â.â token
10_Pruexamprogram1.cpp:23: error: expected unqualified-id before â.â token
10_Pruexamprogram1.cpp: In function âchar GetString(char*)â:
char GetString (char *msg)
{
char s[20], i,*destinoItem;
cout<< msg;
cin.get(s,20);
while (cin.get(s[20] && s[81] !='\n');// no permite overflow
destinoItem = newchar[stringlen (s)+1];
for (i = 0; destinoItem[i] = toupper(s[i]); i++);
retur destinoItem;
}
this seems to be trying to return a char pointer while the actual return type is char. Or would if it were "return"
while (cin.get(s[20] && s[81] !='\n'); doesn't make sense to me. I'm not sure what you were trying to do, but if you want to check two characters for not being equal to '\n', you have to say s[20] != '\n' && s[81] != '\n', though this isn't proper use of cin.get