8. (B) Show the implementation for exception handling for strings
| ||
void main() | ||
{ | ||
char s[20]; | ||
cout<<"Enter the name of your course: "; | ||
cin>>s; | ||
try | ||
{ | ||
if(s=="B.Sc - IT" || s=="BMS" || s=="B.Com") | ||
cout<<endl<<"Your have chosen Course: "<<s; | ||
else | ||
throw(s); | ||
}catch(string ss) | ||
{ | ||
cout<<endl<<"Oh!!!!!!!!! you have chosen the course that we don't provide: "<<ss; | ||
} | ||
} |
8. (B) Show the implementation for exception handling for strings
Reviewed by admin
on
December 23, 2019
Rating:
No comments: