//1. wap to demonstrate try, throw and catch using your own example. #include using namespace std; int main() { int numerator, denominator, result; cout << "Enter numerator and denominator: "; cin >> numerator >> denominator; try { if (denominator == 0) { throw logic_error("Can't divide by zero!"); } result = numerator / denominator; cout << "Result is: " << result << endl; } catch (logic_error e) { cout << "Exception: " << e.what() << endl; } } //2. wap to accept email address from user and throw an exception if it does not contain '@' symbol #include #include using namespace std; int main(){ string email; cout << "Enter email address"; cin >> email; int len = email.length(); bool found = false; try{ for(int i=0; i< len; i++){ if(email[i]=='@'){ found = true; break; } } if(!found){ throw runtime_error("Email is incorrect"); } cout << "Correct email."; }catch(runtime_error e){ cout <<"Exception: "< using namespace std; int main() { int divisor, divident, result; cout << "Enter divisor and divident: "; cin >> divisor >> divident; try { if (divisor == 0) { throw logic_error("Can't divide by zero!"); } result = divident / divisor; cout << "Result is: " << result << endl; } catch (logic_error e) { cout << "Exception: " << e.what() << endl; } } //4. wap to accept username and password from user and throw an exception if password has less than 6 characters or doesn't contain a digit #include using namespace std; int main(){ string username, pass; cout << "Enter username: "<> username; cout << "Enter password: " << endl; cin >> pass; int passLength = pass.length(); bool isCorrect = false; try{ if(passLength < 6){ throw logic_error("Password's length is less than 6."); } for(int i=0 ; i #include using namespace std; int main() { ifstream file; try { file.open("input.txt"); if (!file.is_open()) { throw runtime_error("File not found"); } string line; while (getline(file, line)) { cout << line << endl; } file.close(); } catch (const exception &e) { cout << "Exception: " << e.what() << endl; } return 0; } // NOTE: 6 ko Question matra ho idk how to do! // 6. wap that repeatedly prompts a user for numeric input. use exception handling to ensure input is valid integer and handle exception if input is not an integer. // Get output pdf file at: https://docs.sujan1919.com.np/uploads/oop-lab-6-output.pdf