Write a C++ program that asks a teacher to input the number of students who took an exam and the scores for each student who took the exam. For each letter grade, determine the number of scores. Print to the screen the exam scores and the number of scores in for each letter grade. The program must use an array and functions that return multiple variables. The program must have the following

Main
• Asks the user to input the number of students who took the exam
• Asks the user to input scores for each student who took the exam
• Calls a programmer-defined function that determines the number of scores per grade category
• Calls a program-defined that prints the scores and the number of scores per grade category

Programmer-defined function 1
• Accepts the scores
• Determines the number of scores per grade category

Programmer-defined function 2
• Prints the scores to the screen
• Print the number of scores per grade category to the screen

For example:

Would you like to begin? (Y/y): y
Please input the number of students who took the exam: 4
Please enter their scores: 90 80 65 90

The student scores are:
90
80
65
90
A(s) = 2
B(s) = 1
C(s) = 0
D(s) = 1
E(s) = 0
Would you like to continue? (Y/y)

Edited 7 Years Ago by spear64: n/a

No code, no help. This is obviously homework, so you need to read Daniweb's rules one more time before posting again.

No code, no help. This is obviously homework, so you need to read Daniweb's rules one more time before posting again.

I have the code that I've done do far

Write a C++ program that asks a teacher to input the number of students who took an exam and the scores for each student who took the exam. For each letter grade, determine the number of scores. Print to the screen the exam scores and the number of scores in for each letter grade. The program must use an array and functions that return multiple variables. The program must have the following

Main
• Asks the user to input the number of students who took the exam
• Asks the user to input scores for each student who took the exam
• Calls a programmer-defined function that determines the number of scores per grade category
• Calls a program-defined that prints the scores and the number of scores per grade category

Programmer-defined function 1
• Accepts the scores
• Determines the number of scores per grade category

Programmer-defined function 2
• Prints the scores to the screen
• Print the number of scores per grade category to the screen

For example:

Would you like to begin? (Y/y): y
Please input the number of students who took the exam: 4
Please enter their scores: 90 80 65 90

The student scores are:
90
80
65
90
A(s) = 2
B(s) = 1
C(s) = 0
D(s) = 1
E(s) = 0
Would you like to continue? (Y/y)

#include <iostream>

using namespace std;

int acceptedScores(int numOfstudents);
int printedScores(int printedScores);

int main()
{

int numOfstudents[100];
int studentScores[100];
char cont;
cont = 'y';

cout<<"Would you like to begin (Y or y)"<<endl;
cin>> cont;

while(cont=='Y' || cont== 'y')

cout<<"Please enter the number of students who took the exam"<<endl;
cin>> numOfstudents[100];

cout<< " Please enter the scores for each student who took the exam"<<endl;
cin>> studentScores[100];


acceptedScores(numOfstudents);

printedScores( scores);


return 0;
}



void acceptScores(int numOfstudents)
{

if( numOfstudents>=90)

cout<<"A"<<endl;

if else(numOfstudents >=80)
cout<<"B"<<endl;

if else (numOfstudents >=70)
cout"C"<<endl;

if else (numOfstudents >=60)
cout<< "D"<<endl;

else
cout<<"E"<<endl;



}


void printedScores(int scores)
{





}

Edited 7 Years Ago by Nick Evan: Added code-tags

this can give you an idea of what you need

#include <cstdlib>
#include <iostream>
void CalculateLetter(int *,int);
void PrintScores(int *, int *, int);
using namespace std;


int main(int argc, char *argv[])
{
    int CantStudent = 0;
    
    printf("Please input the number of students who took the exam:\t");
    scanf("%d",&CantStudent);
    int Scores[CantStudent];
    for(int i = 1; i <= CantStudent; i++)
    {
        printf("Please enter the score for the %d student\t", i);
        scanf("%d",&Scores[i]);
    }
    CalculateLetter(Scores,CantStudent);
    
    system("PAUSE");
    return EXIT_SUCCESS;
}

void CalculateLetter(int c[], int cant)
{
     int letter[5] = {0,0,0,0,0};
     for(int a = 1; a <= cant; a++)
     {
         if(c[a] >= 90)
         {
             letter[0] += 1;    
         } else if(c[a] >= 80)
         {
                letter[1] += 1;                
         }else if(c[a] >= 70)
         {
               letter[2] += 1;                
         }else if(c[a] >= 60)
         {
               letter[3] += 1;                
         }else
         {
              letter[4] += 1;   
         }
     } 
     PrintScores(c,letter,cant);
}
void PrintScores(int score[], int letter[], int cant)
{
     for(int i = 1; i <= cant; i++)
     {
          printf("The Student No: %d is %d\n",i,score[i]);        
     }
     printf("A=%d\n",letter[0]);   
     printf("B=%d\n",letter[1]);
     printf("C=%d\n",letter[2]);
     printf("D=%d\n",letter[3]);
     printf("E=%d\n",letter[4]);       
         
}
This article has been dead for over six months. Start a new discussion instead.