Fix lỗi 'invalid_argument' was not declared in this scope như thế nào?

void HS::set(string ma_hs, string khu_vuc, float diem_toan, float diem_van) {
    this->ma_hs = ma_hs;
    this->khu_vuc = khu_vuc;
    this->diem_toan = diem_toan;
    this->diem_van = diem_van;
    if (this->khu_vuc=="KV1") {
        this->diem_uu_tien = 0.75;
    }
    else if (this->khu_vuc=="KV2") {
        this->diem_uu_tien = 0.5;
    }
    else if (this->khu_vuc=="KV2-NT") {
        this->diem_uu_tien = 0.25;
    }
    else if (this->khu_vuc=="KV3") {
        this->diem_uu_tien = 0;
    }
    else {
        throw invalid_argument( "Khu vuc nhap chua dung" );
    }
    this->tong_diem = this->diem_toan + this->diem_van + this->diem_uu_tien;
}

Lớp invalid_argument nằm trong stdexcept.
https://en.cppreference.com/w/cpp/error/invalid_argument

2 Likes
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?