0 like 0 dislike
2k views

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++
ID: 24393 - Available when: Unlimited - Due to: Unlimited
| 2k views
0 0
Called for Help

20 Answers

0 like 0 dislike
Hidden content!
#include<iostream>

#include<string>

using namespace std;



class inform{

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

    
**** *** *** * **** * * * * * *** ***** * * grade1,float grade2){
* * ** ** ** * *** * ** *** ** *** * * * * * ** *** *** * * ave;
* ******* ** * *** * * * * * ***** * * *** * * * * *** * ** * * *  
*** * * * ** * * * **** * * ** * * * **

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

};



int main()

{
* *** * **** ******* * * ** * * stu;
*** * * * * ** ** ** ** ****** ** *** ** ** **
** * **** *** * ** * *** ** * *** * *** * ** *
* * ** * ** ******* **

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

#include<string>

using namespace std;



class inform{

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

    
* * **** * * ** ** *** *** ** * ** ** * ***** * * grade1,float grade2){
* *** * ** * * *** ** **** **** ** ** * * ** *** **** * ******** ave;
* ***** *** ** * ** ** * * ******** **** *** ** **** ** * * *** ** ** **  
* ** *** ***** **** * * ** * * ********** ** ** *

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

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

};



int main()

{

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

}
answered by (-412 points)
0 like 0 dislike
Hidden content!
* ******* * ** **
* ** ** std;


*** *
* ** * * * * **
*** ** ** ** ***** char **
* * * float a;
* ** *** ***** float b;
*** * *** * ** float ***

};


** **** :: **
**** * * * ** * *

}



int *** **
* * ** * q;
* * * * ** cin * * * * ***** ****** * q.a * * q.b;
** * ** ** * cout **** * *** * ** * * ** * **** *** * ** ** endl * ** * * * * * * ** ** * *** * *
* * * *

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

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

#include * ** * * **

#include * **** * ** *



using namespace std;



class student{


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



};



void disp(string n, double a)

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

}



int * *** ** name, int g1, int g2)

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



}

int main()

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


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


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


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

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

#include <cstdlib>

using namespace std;

class student{
* * * *** * **** *
*** * * ** **** * * ** * * * *** **** name;
* ** *** *** ** * ** *** * ****** ** * * ** * grade1;
** ***** ** **** * ** * ** * * ** *** ** ***** * grade2;
** **** *** * * ** * * ** ** * ** * Ave;
* *** ** ** ** ** *** ** **** * * ** ** ** ** calc_avg(float Ave,int grade1, int grade2){
* * * * * ****** * * * * ** * ***** * * ***** * * *** * * ** ** * * ** *
***** *** ******* * * ******** *** * *
* * ** * ****** * **** **** * * ** ** ** * * disp(float Ave,string name,int grade1, int grade2){
* * ** * **** ** *** * ** *** *** *** * * * ***** * ***** ** ** * * * * ***** ***
* * ** * * * * *** *** ** * *** * * ** * **** * ** **** * * ***** * ** * *** * * * * * ** *** * * ***** ** ** *** grade: "<<Ave;
** * *** * ** ** ** * * *** * **** ** *

};

int main(){
* ** * * * ** ** ** ave;
** *** * * * * * * ** * ** * * ** ** * * *** *****
** ** **** * * ** * ** ** * * ** ** **** * **
** *** * * * * * **** *** ** * **** ** **

    return 0;

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

#include<string>

using namespace std;

class student

{

public:
** ***** * ** ** * *** *** name;
** * * ** ***** ** * * grade1, grade2;

};

int main ()

{
***** * **** ****** ** **** student;
* * ** * ** ** * **** * **** **
* *** *** * *** ** * * * **** * * ** ** * * * ****
** * ** * * * *** * * ** * * * ** * * ** * ** ***** *** * *** **** *** *** *
* * ** ****** * ** * * * * * ** * *** grade: *** * *** * * * * * * * * * * ** **** *
** ** * ** ** * ** * * ** * 0;

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

#include<string>

using namespace std;



class student

{



public:
* *** * * ** * ** ** pname(string n)
* *** * * *** * * ** *
****** * * *** * * * * * **** * ** * * ******** *** **** **** * * * ** * * *** * * * *** ** *
*** ** * * * ***** ***
* ** ** *** * ** * * * pavg(double grade1,double grade2)
* ** * *** ** * *** *
*** ** * * *** * ** *** *** * ** *** *** ** **** * * k=(grade1+grade2)/2;
** *** * * * * *** *** * * * * * ** **** * **** ** * grade: **** * *** * * * ****
** ** * ** * ** *** * *

};



int main()

{
*** ******* * ** *** ** name;
* * ***** * * ** ** n1,n2;
* ****** ****** * * sd;
* * **** ** *** ** ***** **
** ** ** ** * * *** ** * *** ** * * * ***
*** ******* * ** *** **
**** * * * ** *** ****** *


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

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

using namespace std;

class student

{
* * * ** * * * * ** ***
*** ** **** **** * ** * ** * name;


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

};

int main(void)

{
**** * * * * *** ***** student;
* **** * ** * * * ** * *** ***
** * * * * ** * * * * * ** * **** ** * * * * **


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

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



using * ** * std;



class student

{
* * *
* ** ** ** * ** ** * ** **
* ** ** ** **** * ** grade1, grade2;

};



int main()

{
* * ** *** *** * *** *** * a;
* * * *** ** * * * * ** a.name * * **** a.grade1 * * ** **** *
* * * * * *** * * * * *** ** * * ** * *
***** * * *** * * * * * *** *** grade: * ** * **** ** *** *


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

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



using namespace std;



class student

{
* *** * ** *
* * * ** * ****** ** * *
*** * * *** * * * ******* grade1, grade2;
* * ** **** * *** * *** ****

};



float ** * ** *

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

}



int main()

{
*** * **** *** * * *** ** a;


* ** * * **** * *** * ** * * * * a.name;
******* ** ***** ** * *** * **** * a.grade1 ** * ** *


* * ** ** * * * * * * ** *** ** ** *** ** * a.name * * * * * endl;
* ***** * *** ** * **** * ** ** ** *** * grade: ** ** * ****** **** ** *


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

}
answered by (5.2k points)
Welcome to Peer-Interaction Programming Learning System (PIPLS) LTLab, National DongHwa University
English 中文 Tiếng Việt
IP:172.69.6.16
©2016-2025

Related questions

0 like 0 dislike
27 answers
[Exercise] Coding (C) - asked Apr 27, 2017 in C++
ID: 24389 - Available when: Unlimited - Due to: Unlimited
| 2.5k views
0 like 0 dislike
42 answers
[Exercise] Coding (C) - asked Apr 27, 2017 in C++
ID: 24392 - Available when: Unlimited - Due to: Unlimited
| 3.5k views
0 like 0 dislike
17 answers
[Exercise] Coding (C) - asked Jun 1, 2017 in C++
ID: 24855 - Available when: Unlimited - Due to: Unlimited
| 1.7k views
12,783 questions
183,442 answers
172,219 comments
4,824 users