q.Use a one-dimensional array to solve the following problem. Read in 20 numbers, each of which is between 10 and 100, inclusive. As each number is read, validate it and store it in the array only if it is not a duplicate of a number already read. After reading all the values, display only the unique values that the user entered.
code is
#include <iostream>
using namespace std;
void main()
{
int i,q,counter=0,j,w=0;
int a[10];
for( i=0;i<10;i++)
{
cout<<"enter 10 numbers";
cin>>q;
if(q>=10&&q<=100){
for( j=0;j<10;j++)
if(q==a[j])
{
counter++;
break;
}

if(counter==0){
a[w]=q;
w++;
}}
else
{
cout<<"you enter low or high number"<<endl;
cout<<"enter again"<<endl;
cin>>q;
}

}
for(int e=0;e<w;e++)
cout<<a[e]<<endl;
}
Initialize your variables before use them.
in array or other variables
like this a[]={0};
Do you understand what you are writing yourself?!

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263`` ``````#include #include using namespace std; int main() { int a[10]; int value; int zero=0; int zero2=0; int czero=0; int ok=1; int total=0; for(int i=0;i<10;i++) { value=0; cin>>value; if(value>=10&&value<=100) { while(czero>0) { if(value==a[zero2]) { ok=0; } zero2++; czero--; } zero2=0; if(ok==1) { a[zero]=value; zero++; } zero2=0; ok=1; total++; czero=total; } else { // bored to type return 0; } } zero2=0; while(zero>0) { cout<