when I compile it, it gives me a two error errors
C2061: syntax error : identifier 'cout' and error C2541: delete : cannot delete objects that are not pointers, i don't know what I did wrong, I appreciate any hint, thanks in advance
LA[j] is not a pointer. LA is a pointer to an array of int. When you use the [] notation, you are accessing a byte of data that is not a pointer. It is just an int.
As far as the cout problem... The do on line 17 may have something to do with that. do is part of this command: do{commands}while(expression);
#include<iostream>
usingnamespace std;
//function prototypes go before int main
void Inputdata();
void DisplayValues();
void InsertValues();
void DeleteValues();
void SearchValue();
void SortData();
void Sumofvalues();
void MaximumValue();
void MinimumValue();
int main()//never ever use void main it is evil!!!!!!
//http://cboard.cprogramming.com/cplusplus-programming/90562-void-main-evil-use-int-main.html
//reading that forum and following some of the links there should explain how evil it is
{
int choice;
int num[19];
int Item,k,x;
int sum,max,min,LOC;
int j,n;
int LA[19],temp;
//read how to use the do{}while(); command about halfway down this page:
//http://cplusplus.com/doc/tutorial/control/
system ("cls");
cout<<"\n\n\t\t\t Array menu"; // error C2061: syntax error : identifier 'cout'//
cout<<"\n\t 1-Input Array Data";
cout<<"\n\t 2-Display Array Values";
cout<<"\n\t 3-Insert a value";
cout<<"\n\t 4-Delete a value";
cout<<"\n\t 5-Search for a value";
cout<<"\n\t 6-Sort data Items";
cout<<"\n\t 7-Sum of values";
cout<<"\n\t 8-Find maximum value";
cout<<"\n\t 9-Find minimum value";
cout<<"\n\t\n\t\t Enter choice:";
cin>>choice;
//function prototypes do not go here
//inputdata//
for (x=0;x<=1;x++)
{ cout<<"\nEnter an integer:";cin>>num[x];}
system ("cls");
//displayvalues//
{system("cls");
cout<<"The numbers in the array are:\n";
for (x=0;x<=19;x++)
{cout<<"num[x]<<\n";}
}
//insert values//
{system ("cls");
cout<<"\nEnter a value to insert:";cin>>Item;
cout<<"\nAt What position:";cin>>k;
j=n;
while (j>=k)
{ LA[j]=LA[j-1];
j=j-1;}
LA [j]=Item;
n=n+1;
}
//deleteing values//
{system ("cls");
Item=LA[k-1];
for(j=k;j<n;j++)
{LA[j-1]=LA[j];}
n=n-1;
cout<<"\nItem deleted was:";Item;
delete LA[j]; // error C2541: delete : cannot delete objects that are not pointers //
cout<<LA[n];
}
//searching values//
{system ("cls");
LOC=0;
for(x=0;;) if (LA[x]=Item)
LOC=x;
if (LOC)
{cout<<"\nItem was found";
}
else
{
cout<<"\nsearch was unsuccessful";}
}
//sorting data//
{system ("cls");
for(x=0;x<=n;x++)
{for(j=x+1;j<n;j++);
{if(LA[x]>LA[j])
{temp=LA[x];
LA[x]=LA[j];
LA[j]=temp;
}
}
}
}
//sumof values//
{system ("cls"); sum=0;
for(x=0;x<20;x++)
sum=sum+num[x];
cout<<"\n sum is:"<<sum;
}
//maximum value//
{system ("cls");
max=num[0];
for(x=1;x<19;x++)
if(max<num[x])
max=num[x];
}
//minimum value//
{system ("cls"); min=num[0];
for(x=1;x<19;x++)
if(min>num[x])
min=num[x];
}
if(choice==1)
Inputdata();
elseif(choice==2)
DisplayValues();
if(choice==3)
InsertValues();
elseif(choice==4)
DeleteValues();
if(choice==5)
SearchValue();
elseif(choice==6)
SortData();
if(choice==7)
Sumofvalues();
elseif(choice==8)
MaximumValue();
if (choice==9)
MinimumValue();
}