How can i call grade variable in function sum | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 12

How can i call grade variable in function sum

class result{ int grade; public: math(){grade= 90;} bio(){grade=95;} sum(){grade of math plus grade of bio } what is the way to sum grades, please??

30th Dec 2017, 2:30 PM
^_^
^_^ - avatar
3 Answers
+ 7
int sum(int a, int b) {grade=a; grade=b; return(sum of grade );}
24th Jan 2018, 3:25 PM
^_^
^_^ - avatar
+ 7
int bio() {grade=90; return grade;} int math() {grade=95; return grade;} int sum() {int s=bio()+math(); return s;}
25th Jan 2018, 12:06 PM
^_^
^_^ - avatar
+ 2
The sum should have operations of math and bio its parameters.
24th Jan 2018, 3:16 PM
Tristan Draper
Tristan Draper - avatar