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
Stuart wants to delete some text from a slide. What should Stuart do?A. From the Review tab, choose Highlight text and then pres
Anna [14]
C. Highlight the text to be deleted, right-click and choose Cut
5 0
3 years ago
Read 2 more answers
A USB zipper drive is a small data storage device that plugs into a computer's USB port.
choli [55]
<span>A. True. hope this is what u are looking for</span>
5 0
3 years ago
A smart refrigerator can use what to detect when you are running low on milk, and then send a reminder to you on a wireless.
Olegator [25]

Answer:

RFID scanning or Barcode reader

Explanation

Smart refrigerators have inbuilt RFID scanning technology that help monitor the stock that is inside your fridge. Once you pass your items through the inbuilt RFID scanner in the fridge, the barcode of your items is cross-referenced with a database and given a unique tag for identification. This technology helps detect and track the stock that is inside your fridge and when you start running low, the RFID can be triggered to send a reminder as a notification on your email or a text message.

3 0
3 years ago
Why shouldn't a server use a glass to scoop ice?
natali 33 [55]
A server shouldn't use a glass to scoop ice as the glass may break. This is due to the potential temperature difference between the glass (which may be room temperature or hotter if it is taken from a dishwasher), and the cold ice. Any existent hairline fractures in the glass may then expand and crack, whereby the smashed pieces of glass could then land in the client's food, table or lap, potentially causing injury to the person. 
7 0
3 years ago
Read 2 more answers
Which ribbon tab is not a default in Outlook 2016's main interface?
IRISSAK [1]

Answer:

view

Explanation:

i just know it

8 0
3 years ago
Read 2 more answers
Other questions:
  • Abram was asked to explain to one of his coworkers the XOR cipher. He showed his coworker an example of adding two bits, 1 and 1
    7·1 answer
  • _____ documentation is designed to help programmers and systems analysts understand the application software and maintain it aft
    12·1 answer
  • . char values are surrounded by _____ quotes
    15·1 answer
  • Technology is often discovered by accident
    5·1 answer
  • The page orientation in which the page width is greater than the page height is called
    8·1 answer
  • Discuss trends in cellular data transmission speeds
    15·2 answers
  • Sharon must give an informative presentation to a group of teenagers about cultivating earthworms for use in home gardening. Whi
    11·2 answers
  • a blank search examines the first item to see if it is a match, then the second, and so on. answers: linear, binary, and orderly
    7·2 answers
  • Claire wants to use a conditional statement in JavaScript that provides a block of statement to be executed if the condition is
    7·2 answers
  • How will you maintain electrical tools and equipment?
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!