1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Assoli18 [71]
3 years ago
9

Rita is writing a C++ programe in whic, she wants to display the grades (stored in variable grade) as per the table of marks (st

ored in variable marks) given below: A – 90-100 B – 80-89 C – 70-79 D < 70
Computers and Technology
1 answer:
qwelly [4]3 years ago
7 0
#include <iostream>
#include <vector>
using namespace std;

class Student
{
public:    
    Student(int mark)    
    {        
        this->mark = mark;

        if (mark >= 90 && mark <= 100)
            grade = 'A';
        else if (mark >= 80 && mark <= 89)            
            grade = 'B';
        else if (mark >= 70 && mark <= 79)
            grade = 'C';
        else if (mark < 70 && mark >= 0)
            grade = 'D';
        else
            cout << "Invalid mark, grade not assigned";
    }

    int getMark()
    {
        return mark;
    }

    char getGrade()
    {
        return grade;
    }

private:
    int mark;
    char grade;
};

int main()
{
    vector<Student> students;
    int num, mark;

    cout << "Enter number of students: ";
    cin >> num;

    if (num <= 0)
        cout << "Invalid number of students, exiting";
    else
    {
        for (int i = 1; i <= num; i++)
        {
            cout << "Enter marks for student " << i << ": ";
            cin >> mark;

            Student s(mark);
            students.push_back(s);
        }
    }

    // do whatever you like with the vector from here onwards, such as:
    /*
    for (int i = 0; i < students.size(); i++)
    {
        cout << "Student " << i + 1 << " grade: " << students[i].getGrade() << endl;
    }
    */

    return 0;
}
You might be interested in
Can anyone help me with these assignments??? Hands On Assignments- Insertion of Symbols, Special Characters, and Images.... and
Alekssandra [29.7K]

Answer:

yes send me the worksheet

Explanation:

5 0
3 years ago
Tax that you pay when making a profit from selling a house is an example of:
spayn [35]
B lol its the only one that makes since all though im not sure if im exactly right 
4 0
3 years ago
Select all examples of proper keyboarding technique.
krok68 [10]

Answer:

all except keeping your hands higher than your elbows

4 0
3 years ago
A teacher wants to check the typing proficiency of five students. She gives all of them the same passage to type. Which student
Hitman42 [59]

The student who uses macros for long words. They are most likely to pass words very easily because they have a macro. While not only saving time, also making a stunning performance as macros usually auto correct as well.

5 0
3 years ago
Explain the uses of computer in police department​
shusha [124]

Answer:

Not only can police officers store records and reports in online databases, but they can also use computers and hard drives to store thousands of images, reports and videos. Computers make mass storage possible, and enable giant online databases that can accurately ID suspects anywhere in the country.

5 0
3 years ago
Read 2 more answers
Other questions:
  • HELP PLEASE
    7·2 answers
  • If the pc­doctor software is installed on a computer's hard drive, what two different ways can the program be started?
    7·1 answer
  • The component that allows you to make a paper-based copy of a body of text is the _____.
    12·1 answer
  • A computer has been stored, uncovered, in a dusty closet for several months. Why might this situation cause the operating system
    13·1 answer
  • If we collect data on the number of wins each team in the NFL had during the 2011-12 season, we have _____________ data.
    10·1 answer
  • Outline three difference each of a raster filled and vector file​
    7·1 answer
  • Which service uses a broadband connection?
    11·1 answer
  • Pro and Cons of Artificial Intelligence in Art <br><br> You must have 3 statements in each
    14·1 answer
  • How can you prevent someone with access to a mobile phone from circumventing access controls for the entire device
    5·1 answer
  • What is the purpose of memory address?​
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!