Jump to content

c++ program help


graphiteg4

Recommended Posts

this is the objective of the program

Create a program to compute final grades for a class. Professor Logan assigns 10 homework assignment, 2 projects and a final exam. He computes an average for the 10 homework assignments, and an average for the two projects. He then averages those two grades together with the final exam grade to get a final grade for the course.

Mr. Jones does NOT know how many students he will have in a class, however, he does know that he will never have more than 50 students, so you should dimension your arrays to hold the data for 50 students. Your output, however, should show the info for 5 students.

this what i got i got some kind of error going on im pretty sure my logic is right

#include <iostream>

#include <iomanip>

using namespace std;

int main ()

{

int id[50];

int i;

int j;

int k;

float hw [10];

float final[50];

float hwAve[50];

float finalAve[50];

float hwtotal=0;

float projTotal=0;

float projAve[50];

for (i=0; i<50; i++){

projAve=0;

hwAve=0;

finalAve=0;

//id=0;

}

cout << "please enter the students id : " <<endl;

cin>> id;

while (id!=0){

for (j=0; j<2; j++){

cout << "please enter the hw grade"<<endl;

cin >> hw[j];

hwtotal=hwtotal+hw[j];

}

hwAve=hwtotal/10.0;

for (k=0; k<2; k++){

cout<<"Please enter project grade"<<endl;

cin>>proj[k];

projTotal=projTotal+proj[k];

}

projAve=projTotal/2;

cout<<"please enter a grade for a final grade"<<endl;

cin>>final;

finalAve=((hwAve+projAve+final)/3);

i++;

cout << "please enter the students id : " <<endl;

cin>> id;

}

for (i=0;i<50;i++)

{

cout<<id<<endl;

cout<<hwAve;

cout<<finalAve<<endl;

}

return 0;

}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...