array

closed account (4y79216C)
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


#include<iostream>
using namespace std;
int main()
{

string name[50]={};
int s[]={};
int i;
int hn;
int l;
int k;
int n;
int largest;
int smallest;

float average;
cout<<"ENTER MANY many students?:"<<endl;
cin>>hn;
for(i=1;i<hn;i++)
{
cout<<"ENTER name of students :"<<i<<":" ;
cin>>n;{
cout<<"ENTER SCORE:";
cin>>l;}

for(i=0;i<hn;i++){
if(s[i]>largest)
largest=s[i];

for(i=0;i<hn-1;i++){
if(s[i]<smallest)
smallest=s[i];}

}}

cout<<"THE HIGHEST IS"<<s[i];



system("PAUSE");
}

i don't know how to calculate

Please, look at the exercise, and your expected output you mentioned.

First, title of the exercise? Determine the program requirements.
E.g : Create an one-dimensional array.
(I don't see any variable which really is an one-dimensional array)
Looked quickly the output, first of all, you'll need to create a for-loop (4 items). What does the for-loop contain? You'll need to print an user request string, and input a value then store the result into array[nIndex] element. (Your output has exactly 4 elements)

Next? I think your code... Please, look at the expected output? Why does your code have Smallest-Highest????? You want to count a specific number, right?...

Sorry, but I think it's better if you give us your full expected output and all necessary information and re-format your thread, instead of reposting this post many times...
In my opinion, I think your code may be wrong. (Your code & output are totally different)
Last edited on
closed account (4y79216C)
sorry i just mistaken the expected output hehehe . I was mistaken to the problem. this is the true and correct problem
3. write a program that allows the user to enter students name followed by their test score. it will first ask how many students to enter, then asks the students name followed by their score. it will then output the average of all scores, & the student w/ the highest & lowest test score. use one dimensional array for students name & another array for the score

save as prelim3-class score

expected output

how many student?2

enter student #1 name:tony

enter sruden tscore 50

enter student #1 name:t

enter sruden tscore 100

the highest score is t

the lowest score is tony

average is
Topic archived. No new replies allowed.