hello everyone can someone help me about array plsss i really need help right now
using one-dimensional array. create a program that will count the number of the same intries in a series number based on the user specific no. to count
EXPECTED output
Enter no.1:2
Enter no.2:1
Enter no.3:1
Enter no4:2
what number to v=count?1
total number 1 is 2
should use a counter
i appretiate those who will answer
int _tmain(int argc, _TCHAR* argv[])
{
int hn,nc;
int i;
int count;
float totaln;
count=0;
cout<<"ENTER MANY NUMBERS TO INPUT?:"<<endl;
cin>>hn;
int* n = newint[hn];
for(i=1;i<=hn;i++)
{
cout<<"ENTER NUMBER :"<<i<<":";
cin>>n[i];
}
cout<<"WHAT NUMBER TO COUNT:"<<endl;
cin>>nc ;
cout<<"THE TOTAL NUMBER IS:"<<nc;
system("PAUSE");
return 0;
}
the counter was not include but thanks for the codes
but when i enter it like this for example
ENTER MANY NUMBERS TO INPUT:2
ENTER NUMBER1:5
ENTER NUMBER2:6
WHAT NUMBER TO COUNT:1
instead of 0,
it became the total number is 1
hmmmm i wonder why??
Now can you explain your program step-by-step? (especially WHAT NUMBER TO COUNT)
Up to now you haven't given us all necessary information yet...
And, we have no idea what your program should be.
Enter how many numbers?: 4
Enter no.1: 2
Enter no.2: 1
Enter no.3: 1
Enter no4: 2
what number to v=count?:1 // u will enter
total number 1 is: 2 // the number 1 is been add
#include<iostream>
usingnamespace std;
int main()
{
int n,hn,nc;
int i;
int count;
float totaln;
count=0;
cout<<"ENTER MANY NUMBERS TO INPUT?:"<<endl;
cin>>hn;
for(i=1;i<=hn;i++)
{
cout<<"ENTER NUMBER :"<<i<<":";
cin>>n;}
cout<<"WHAT NUMBER TO COUNT:"<<endl;
cin>>nc ;
count=0;
totaln+=n;
cout<<"THE TOTAL NUMBER IS:"<<totaln;
system("PAUSE");
}