עבור לתוכן

הכנסת מערך לפונקציה

Featured Replies

פורסם

קיבלתי את תרגיל הבית שמצורף, כבר עשיתי אותו וזה הקוד שיצא לי:

#include <iostream>
using namespace std;
void main()
{
int course_weight[5] , grade[5] ;
int temp_average=0 , sum_weight=0 ,test=0 ;
double total_average=0 ;
cout<<"Hello please enter 5 course's weight point's"<<endl; //The weight of each course
for (int i=0 ; i<5 ; i++)
{
cin>>course_weight[i];
sum_weight=sum_weight+course_weight[i];
}


for (int j = 0 ; j<10 ; j++)// ten student's
{
cout<<"Enter student "<<j+1<<" grade"<<endl;
temp_average = 0;
for (int i=0 ; i<5 ; i++)
{
cin>>grade[i];
temp_average = course_weight[i]*grade[i]+temp_average; //average of each student individual
}
total_average=total_average+(temp_average/sum_weight);
}
total_average = total_average/10;
cout<<"The class average is: "<<total_average<<endl;
cin>>test;
}

עכשיו, בא לי להגדיל ראש ולהתחיל לדחוף דברים בתוך פונקציות, הבעיה היא שאני לא יודע אם ואיך אפשר לעשות זאת.

אפשר מעט הכוונה?

נ.ב

אפשר להתעלם מהמשתנה test

ארכיון

דיון זה הועבר לארכיון ולא ניתן להוסיף בו תגובות חדשות.

דיונים חדשים