Write a program that asks the user to enter the number of Research projects done by 10 different students (Student 1, Student 2, ..., Student 10). Once the data has been entered the program must analyze the data and output the student who did the most Research projects

You'll be needing an array of integers to store for each student his corresponding number of Research projects.
Knowing that each student takes a place in the array, you can parse it first adding the corresponsind number of research projects, and on the way, you can keep in memory the student which did the most research projects.

This is a poorly attempt of displaying the array.

Array
+-----+-----+-----+-----+-----+-----+-----+-----+-----+-------+
|     |     |     |     |     |     |     |     |     |       |
+--0--+--1--+--2--+--3--+--4--+--5--+--6--+--7--+--8--+---9---+
 Stud1 Stud2 Stud3 Stud4 Stud5 Stud6 Stud7 Stud8 Stud9  Stud10 

So, you'll need to parse the array and enter the research project numbers, and you can, at the same time, keep in memory the position of the highest reserach project number, which will tell you the student who did them.

Edited 3 Years Ago by Lucaci Andrew

If I have understood clearly, your problem solution is :

#include <iostream>

using namespace std;

int main()
{
    int researchPro[10];

    //input no of research projects
    //done by 10 students
    for(int i=0; i<sizeof(researchPro)/sizeof(researchPro[0]); i++)
    {
        cout<<"Enter the number of research  projects done by students : "<<flush;
        cin >> researchPro[i];
    }

    int max = researchPro[0];

    for(int j=0; j<sizeof(researchPro)/sizeof(researchPro[0]); j++)
    {
        if(j > 0)
            if(max < researchPro[j])    //if max is less than any number
            {
                max = researchPro[j];   //update it
            }
    }

    cout<<"\nStudent with most research projects : " << max <<endl;

    return 0;
}

New Developer, if this is homework, and it looks like it to me, you probably just give the person the answer.

Re. What Stuugie said. We don't do peoples' homework for them. We will help once they make an honest attempt at it. Let's not help people cheat. Can you imagine what might happen if someone got through their degree courses that way, and then got a job in a safety-critical position? Can you spell "nuclear core meltdown", or "oh my god, that plane just fell out of the sky!"... ?

Comments
LMAO, "That plane just fell out of the sky!"

And FWIW, I HAVE written safety-critical real-time system software, so this is something I am very conscious of. My signature says it all! :-)

This article has been dead for over six months. Start a new discussion instead.