A simple test-weighted grade point average calculation

Explain that
Xiaoya has just finished the three midterm exams of Chinese, Mathematics, and English. She wants you to write a program to help her calculate her weighted average score, of which Chinese scores account for 50%, mathematics scores account for 30%, and English scores account for 50%. Accounted for 20%.

Input format
One line, including three positive integers, separated by a space, respectively representing the original scores of Chinese, Mathematics and English.
Output format
A number representing the weighted average score. [Note: Please retain 2 decimal places for the result]

#include<bits/stdc++.h>
using namespace std;
int q,w,e,r,t,y,u,i,o,p,s,d,f,g,h,j,k,l,z,x,c,v,n,m,a,b;
int main()
{
    
    
	cin>>a>>b>>c;
	printf("%0.2f",a*0.5+b*0.3+c*0.2);
	return 0;
}

Guess you like

Origin blog.csdn.net/yaosichengalpha/article/details/130977398