//This progam  accepts marks of 4 different subjects by 5 students.
//Then calculates the average score of each subject and displays the result. 
#include<iostream>
using namespace std;
    //This functions, get the average of each subject.
 int avrgProg(int PDenis,int PTriza,int PWinnie,int PTeddy,int PJoy);
  avrgProg= avrgp;
 avrgp=(PDenis+PTriza+PWinnie+PTeddy+PJoy)/5;
     return avrgp;
 int avrgSD(int SDDenis,int SDTriza,int SDWinnie,int SDTeddy,int SDJoy);
     avrgSD=(SDDenis+SDTriza+SDWinnie+SDTeddy+SDJoy)/5
     return avrgSD
 int avrgIT(int ITDenis,int ITTriza,int ITWinnie,int ITTeddy,int ITJoy);
     avrgIT=(ITDenis+ITTriza+ITWinnie+ITTeddy+ITJoy)/5;
       return avrgIT;
    int avrgMngt(int MngtDenis,int MngtTriza,int MngtWinnie,int MngtTeddy,int MngtJoy);
     avrgMngt=( MngtDenis+MngtTriza+MngtWinnie+MngtTeddy+MngtJoy)/5;
     return avrgMngt;
           //Output of the program to the user
     int main(){
      cout<<" Enter Students Marks in Programmming:\n";
      //Should be a form for the subject-programming  
      cout<<"\t""PDenis:";
      cin>>PDenis;
      cout<<"\t""PTriza:";
      cin>>PTriza;
      cout<<"\t""PWInnie:";
      cin>>PWinnie;
      cout<<"\t""PTeddy:";
      cin>>PTeddy;
      cout<<"\t""PJoy:";
      cin>>PTeddy;
      cout<<"\t""PJoy:";
      cin>>PJoy;
      cout<<"Enter Students Marks in Software Development\n";
      //output for software development
      cout<<"\t""SDDenis:";
      cin>>SDDenis;
      cout<<"\t""SDTriza:";
      cin>>SDTriza;
      cout<<"\t""SDWinnie:";
      cin>>SDWinnie;
               cout<<"\t""SDTeddy:";
      cin>>SDTeddy;
      cout<<"\t""PJoy:";
      cin>>SDTeddy;
      cout<<"\t""SDJoy:";
      cin>>SDJoy;
      cout<<"Enter Students Marks In  I.T Project\n";
               //output for IT Project
      cout<<"\t""IT.Denis:";
      cin>>ITDenis;
      cout<<"\t""ITTriza:";
      cin>>ITTriza
      cout<<"\t""ITWinnie:";
      cin>>ITWinnie;
               cout<<"\t""ITTeddy:";
      cin>>ITTeddy;
      cout<<"\t""P.Joy:";
      cin>>ITTeddy;
      cout<<"\t""ITJoy:";
      cin>>ITJoy;
      cout<<"Enter Student Marks in Management\n";
               //output for Management
      cout<<"\t""MngtDenis:";
      cin>>MngtDenis;
      cout<<"\t""MngtTriza:";
      cin>>MngtTriza;
      cout<<"\t""MngtWinnie:";
      cin>>MngtWinnie;
               cout<<"\t""MngtTeddy:";
      cin>>MngtTeddy;
      cout<<"\t""MngtJoy:";
      cin>>MngtJoy;
      cout<<THE AVERAGE GRA SCORE OF EACH SUBJECT IS:"
       //final output for the average of all the subjects
       cout<<"PROGRAMING:";
      cin>>avrgProgr;
      cout<<"SOFTWARE DEVELOPMENT:";
      cin>>avrgSD;
      cout<<"I.T PROJECT:";
      cin>>avrgIT;
      cout<<"MANAGEMENT:";
      cin>>avrgMngt;
      return 0;
     }

Recommended Answers

All 3 Replies

Please learn to use Code Tags. Also learn to properly indent your code and use whitespace. It is unreadable in it's present form.

Based on the information you gave about your code, that's all I've got. If you have a ploblem and need help, give us some details, including what the problem is, what the program should do, what it does do, and where the problem is.

Whats the question?

Here's a working solution. Study it hard and youl'l figure it out. Hope it helps byeee

//This progam  accepts marks of 4 different subjects by 5 students.
//Then calculates the average score of each subject and displays the 
//result. 

#include<iostream>

using namespace std;



int main()
{
    int value=0, i=0, total=0;

    cout << "Enter student marks for programming:\n";
    total = 0;
    for (i=1; i<=5; i++)
    {
        switch (i)
        {
            case 1: cout << "Denis: ";    break;
            case 2: cout << "Triza: ";    break;
            case 3: cout << "Winnie: ";    break;
            case 4: cout << "Teddy: ";    break;
            case 5: cout << "Joy: ";    break;
        }
        cin >> value;
        total += value;
    }
    
    cout << endl;
    cout << "Average for Programming: " << (total / 5) << endl;
    cout << endl;

    cout << "Enter student marks for software development:\n";
    total = 0;
    for (i=1; i<=5; i++)
    {
        switch (i)
        {
            case 1: cout << "Denis: ";    break;
            case 2: cout << "Triza: ";    break;
            case 3: cout << "Winnie: ";    break;
            case 4: cout << "Teddy: ";    break;
            case 5: cout << "Joy: ";    break;
        }
        cin >> value;
        total += value;
    }

    cout << endl;
    cout << "Average for Software Development: " << (total / 5) << endl;
    cout << endl;

    cout << "Enter student marks for I.T. project:\n";
    total = 0;
    for (i=1; i<=5; i++)
    {
        switch (i)
        {
            case 1: cout << "Denis: ";    break;
            case 2: cout << "Triza: ";    break;
            case 3: cout << "Winnie: ";    break;
            case 4: cout << "Teddy: ";    break;
            case 5: cout << "Joy: ";    break;
        }
        cin >> value;
        total += value;
    }

    cout << endl;
    cout << "Average for I.T. Project: " << (total / 5) << endl;
    cout << endl;

    cout << "Enter student marks for management:\n";
    total = 0;
    for (i=1; i<=5; i++)
    {
        switch (i)
        {
            case 1: cout << "Denis: ";    break;
            case 2: cout << "Triza: ";    break;
            case 3: cout << "Winnie: ";    break;
            case 4: cout << "Teddy: ";    break;
            case 5: cout << "Joy: ";    break;
        }
        cin >> value;
        total += value;
    }

    cout << endl;
    cout << "Average for Management: " << (total / 5) << endl;
    cout << endl;

    return 0;

    cout << endl;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.