+ 2

How can I do this? 😭

Write a program that allows you to input students' scores and weights. The program should then calculate a weighted average and score based on the data inputted by the user. 

20th Jan 2019, 10:12 AM
Iva
8 Answers
+ 7
In python just use input function and then do a math.
20th Jan 2019, 10:25 AM
Hubert Dudek
Hubert Dudek - avatar
+ 3
Hi Iva Which programming language do you want to do this? (mention in tags please) Do you have a question related to the coding part or understanding the mathematical formula of weighted average? If you have a half-ready code to share, maybe we can help out how to complete it.
20th Jan 2019, 10:33 AM
Tibor Santa
Tibor Santa - avatar
+ 2
Sorry I am not very good with CPP, hopefully someone more competent can jump in :)
20th Jan 2019, 2:26 PM
Tibor Santa
Tibor Santa - avatar
+ 2
Hi Iva Actually I gave this a try and I think this is now working as intended :) A few points I want to add, in addition to the comments in the code: * in the sample below the arrays of scores and weights are defined in the code and not from user input. I am not sure how this could be done correctly in Sololearn. * you need to know in the beginning how many values will be in the array because the variables must be declared accordingly... * I assumed that the sum of weights is 1 -- however if this is not true then the result must be divided by the sum of weights. https://code.sololearn.com/cpt0d3WKvRHl/#cpp
20th Jan 2019, 10:19 PM
Tibor Santa
Tibor Santa - avatar
+ 1
Thank you Tibor 😊🤗
21st Jan 2019, 9:21 AM
Iva
0
Hi Tibor, c++ I need.. yes for the coding part, #include <iostream> using namespace std; int main() {int n; int M; int S; int A[n]; int i; cin>>A[i]; i++; for(i=0; i<n; i++) { S=S+A[i]; M=S/n; Cout<<"average ="<<M<<endl; } return 0; }
20th Jan 2019, 11:09 AM
Iva
0
I don't know how to do it 🤦🏻‍♀️🤦🏻‍♀️🤦🏻‍♀️ I'm a new student of programing and I need some help 😑
20th Jan 2019, 11:10 AM
Iva
0
? 😑
20th Jan 2019, 2:15 PM
Iva