0 like 0 dislike

Write a c++ class called 'student' with

Data members:

name(char type),

grade1,grade2 (integer type)

The program asks the user to enter name and grades. Then calc_avg() calculates the average of two grades and disp() display name and average grades on screen in different lines.

Example input:

Alex
8 9

Example output:

Student: Alex
Avg. grade: 8.5

 

[Exercise] Coding (C) - asked in C++
Available when: Unlimited - Due to: Unlimited
| 62 views
0 0
Called for Help

20 Answers

0 like 0 dislike
Hidden content!
#include * **** *** *

#include ** * **** **



using namespace std;



class student{


* * *** * * * ** ** * *
* *** *** * * ** ** *** ** ** name;
* ** * * *** ** ** ** *



};



void disp(string n, double a)

{
* * *** * *** *** ** * *** ** ** ** * * * *** ** ** * * * * * *
* ****** * * **** ** **** ** *** * * ** grade: ******* ****

}



int ** * name, int b1, int b2)

{
* ****** * * ** * * * * avg;
** ** * **** *** *** ** = ** ****** ** * **
** * * * * **** ** * ***



}

int main()

{
*** * * ****** **** * *** *** s;


** * ***** ** ** ** ** * * * * ** * *** **
* * * * ** * * ***
* ** *** ** ***


* ** ******* * ** * * * **** ** * * ** * * *


** * *** * * * ******** 0;

}
answered by (-215 points)
0 like 0 dislike
Hidden content!
#include * * * ** *

#include * *** * * * **



using namespace std;



class student{


* * ** ****** ****** **
** ** * * ** * * * name;
* ** * * ***** **** *



};



void disp(string n, double a)

{
*** * ** ** * ** ****** ** ** ** * * * * * ** *** * **** * *
** * * * ***** * ** **** * * * grade: ** * *** *

}



int **** * name, int b1, int b2)

{
* ******* * ** ****** *** avg;
* * * ****** ** * * = * ***** ** * **
* * ** ** ** ** ** ** ***** *



}

int main()

{
* * ******* * * * ** * * s;


* * * ** **** ** * * **** ***
* * * **
* * ** * **** ** **


** * * * * ** * * ***** *** ****** * ** * ** *


** * * * *** ** ** ** ** 0;

}
answered by (237 points)
0 like 0 dislike
Hidden content!
#include ****** * * * * *

#include ** * ** * * *



using namespace std;



class student{


* ** * ** * ******** * ****
* ****** ** ** *** * ** name;
** * * ** * * **** **



};



void disp(string n, double a)

{
* * ** ** * ** ** * * * * ** * ** * ** *** ** * * ** **** * ** * **
* * * *** * * * ** * * * **** **** * grade: ** ** **** *****

}



int ** ** ** name, int b1, int b2)

{
* * ******** * ** ******* avg;
**** *** *** * *** * ** = ** ** *** * ***
***** ** * ******** **** ** * ****



}

int main()

{
* * ****** * * * * * ** * s;


* ***** ** *** ** ** ** *** **** * * *
** *** ****
****** ***


* * ** * * **** * * * * ** **** * * ** *


** * ** * * * * ***** 0;

}
answered by (-298 points)
0 like 0 dislike
Hidden content!
* * **** **** *

using ** std;



class Student{
* ** * * **** ***** * * **
* ********* * ** ** * * ** * * **
* ** * ** **** * ** * * a;
*** *** * * *** **** b;
*** * **** * * **** cal();

};



float Student :: cal(){
* * ** *** ** ** * ** (a+b)/2;

}



int main(){
** * * * * **** * ** q;
* * * *** **** * *** ** * * * ** * q.name * ** *** q.a *** q.b;
**** *** ** * * ******** * ** * * * *** ** * *** ** * * q.name *** * * * endl * * *** * ** * * grade: ** * * * *** ** * q.cal();
* * * *** * ** * *** * *** * *
** ** * **** ** * ** *** ** 0;

}
answered by (-136 points)
0 like 0 dislike
Hidden content!
#include *** * * * ****

#include *** *

#include **** ** * **

using namespace std;



class Student{

public:
* * *** * * * * * *** * input(string N, int a, int b){
*** * * ** * * * * * ** * ** * **** ** * = N;
* * * *** * ** * * ** ** * ** **** ** * * = a;
* * * ** ** *** * *** * *** ** ** = b;
* **** ** * *** * ** **** * * * ** ** = ****** **
** *** * *** ** ** *
* ** * * * * ** * output(){
* ** **** * *** * * ***** * * * * ** * ** << ** *** * * *** std::fixed;
* **** * ** ** * * ** * ** **** ** ****** ** **** * *** * ***** ** *** * ** * ** *** * * *** * *** ** * ** * *** ** * grade: *** * *** * average;
** * * ** ****** ** *



private:
* * * * **** * * * ** grade1, grade2;
** * ** * ****** *** ** * average;
* * * ** * ****** ** ** * * ** name;



};





int main()

{
* *** * * * ************ ** M;
* ** ** * ** *** ** * N;
* **** ** ** ***** a, b;
* **** ** **** *** * ** * * * ** * N >> a >> b;
* * ** ** *** * * ** ** a, b);
* * * * * ** ** * * ** ** *




** * ** * * *** *** ** 0;

}
answered by (-368 points)
0 like 0 dislike
Hidden content!
#include * * ***** ***

#include * * * * *



using namespace std;



class student{


* ** * ** ** * * ** ** **
**** * *********** * * **** * name;
* ** ***** **** *** * ** * *



};



void disp(string n, double a)

{
* * **** * * * ** ** ** *** *** **** **** ** * * * ** ***** * ****
* * * ** * * ******* *** ** * **** * * * grade: * *** * *** * ** *

}



int ** * name, int b1, int b2)

{
* *** **** ** ** **** ** * avg;
**** **** *** *** ** = ** ** * **** * *
* * * *** * * * **** ** * * **



}

int main()

{
*** * * * *** ****** **** s;


* * * ****** **** ** *** * ** * * *
* * ** *
* * ** * *


* ** * * * ** ** **** * ** *


** ***** * ******* ** * ***** 0;

}
answered by (126 points)
0 like 0 dislike
Hidden content!
* ** * *****
** ***** **** *


**** * std;


* **

{
*
*** * * * **** * * **
**** ** * ** * *** * ** * ** ** *

};



int * *

{
* * n, g1, g2;
* avr;



cin ** *** **

cin *** * ****

cin ** * * ** *



avr = + ** * *




*** * * *** ******** ***** * ** * * ** * * * *
* * * * * ** * * * ** ** * * *** ********* avr ***** **









}
answered by (-368 points)
0 like 0 dislike
Hidden content!
#include * ** ** *****
** * ** * ** * ** **

using namespace std;



class student {

public:
** * * * *** * * ** * *** ** name;
***** * *** ** ** ** **** a;
* * ** * *** * **** *** * b;
** * **** *********** ** ****** studen_do();

};

float * * *** * ** * * {
** *** *** ** *** * ** ** (a + b)/2;

}



int main(void) {
* * ****** * *** *** * t;
** ** ** * * * ** ** * ** * ** * * ;
******* * * * * ***** ** >>t.a ;
* ** * ** *** *** ** * * *** ;
* *** ***** **** * * * * ** * ** **** * ***** * *** * * *** *****
* *** *** *** ***** * * * * ****** grade: *** **** * *** * * * ** *


** * * * * ***** * ** * 0;

}
answered by (-249 points)
0 like 0 dislike
Hidden content!
#include ** ** * * ** **
***** ******** *

using namespace std;



class student {

public:
** ** * ** * * ** * *** name;
* * * * *** * ** * * a;
* ** * ** ** ****** * b;
*** ** ***** * * * ** ** * studen_do();

};

float ** * **** *** {
* * * ** * * ** ** ** (a + b)/2;

}



int main(void) {
** * * **** * ** *** t;
*** ** * ** * ***** **** *** * * * ;
* ** * * *** ** >>t.a ;
* ** ** * ** * ***** *** ** >>t.b ;
**** ** * *** ** * * * * **** * * * * * *** ** *** ***
* * * ***** ***** *** * * * * *** *
* ** ** ** * * ** * ** ** ***** *** * ** * * *
** ****** * ** ** * * * * ** * * * ** *** grade: * ** *** **** * *** **** *


*** * ** * ** * ** * **** 0;

}
answered by (-249 points)
0 like 0 dislike
Hidden content!
#include<iostream>

#include<string>

using namespace std;



class inform{

    
** * * * *** * * ** *
* ** * **** * ** * ***** * * * ** * * ** * * name;
***** * *** *** *** * *** *** * * * ** ** * grade1,grade2;

    
** ** **** *** * * * **** ****** * ******* calc_avg(float grade1,float grade2){
* **** * **** * * ** * * * * *** * ******* * * * * * ** ****** * ave=0,sum;
** * * ** * **** ******* *** * * **** ** * ** * * * ** ** * * * ********
** * * *** *** ** ** *** ***** ******* ** * **** * * ** * * ** * * ***
** ** * * **** ** *** ******* ** ** * ** * * * *** * * *** * * * * ** * ave;

** * * * * *** * ***** ***** ******* * ** * * ****

*** ** * ** ** * * ** ***** **** * ** * **** * * *
** *** * * **** **** **** **** * * ** * * *** * * **** ** ** * * *** * * ***** * ****** *** *** *** *** * * *
* * ** * ** *** * * ******* * ** ** * * ** ** *** * * * ***** * * * grade: ** ** * **** * ***** **** **** * *** ***    
* * * * **** * * * * ** * ******* ** ** *

};



int main()

{

    inform stu;
* *** * ****** *** * * *** * ** *
*** * * ** * * *** **** * * * **** * * ** * * ** * ***
** *** ** * * * **** * *

}
answered by (-412 points)
Get it on Google Play Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.63.143
©2016-2019

Related questions

0 like 0 dislike
27 answers
[Exercise] Coding (C) - asked Apr 27, 2017 in C++
Available when: Unlimited - Due to: Unlimited
| 100 views
0 like 0 dislike
42 answers
[Exercise] Coding (C) - asked Apr 27, 2017 in C++
Available when: Unlimited - Due to: Unlimited
| 123 views
0 like 0 dislike
17 answers
[Exercise] Coding (C) - asked Jun 1, 2017 in C++
Available when: Unlimited - Due to: Unlimited
| 68 views
9,252 questions
85,585 answers
63,644 comments
2,714 users