Please read the problems I am having. They are listed below the code. ----------
ID: 3643230 • Letter: P
Question
Please read the problems I am having. They are listed below the code.------------------------------------------------------------------------------------
#include<iostream>
using namespace std;
void eliminate(int a[], int &siz)
{
int i,k=0;
bool b[101]={false};
for(i=0;i<siz;i++)
if(b[a[i]]==false){
a[k++] = a[i];
b[a[i]]=true;
}
siz = k-1;
}
int main()
{
int nums[11];
int i,n=11;
cout<<"Please enter 10 integers, hitting return after each one: ";
for(i=0;i<n;i++)
cin>>nums[i];
eliminate(nums,n);
//cout<<endl;
for(i=0;i<n;i++)
cout<<nums[i]<<" ";
return 0;
}
-------------------------------------------------------------------------------------
Problems:
For the second output I do not receive anything. I should receive 100.
For the last output I only receive 12.
Explanation / Answer
there is a programming error in the first part in the second part the iteration is not carrying on pls rate if helpful
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.