For a lab my professor for C++ gave us an application file to test our Array class but it has another main inside of main and I've never seen that before. I was wondering if that is legal since it is giving me an error that it expected a ; after the braces under the 2nd main(). so here's the code.
int main()
{
int main()
{
// Creation of an array
Array array1(10);
array1.insert(5);
array1.insert(3);
array1.insert(2);
cout << "Array 1: " << endl;
array1.print();
cout << endl;
// Creation of another array
Array array2(20);
for (int i = 0; i < 20; i++)
{
array2.insert(i 10);
}
cout << "Array 2: " << endl;
array2.print();
cout << endl;
return 0;
}
}
This is a picture of the code as well that was given
Aucun commentaire:
Enregistrer un commentaire