Question #39225

36. A Company insures its drives in the following cases
If the driver is married
If driver is unmarried, male and he is above 39 years of age
If driver is unmarried, female and he is above 25 years of age
In all the other cases the driver is not insured. If the marital status, sex and age of the driver are
the inputs, write a program to determine whether the driver is to be insured or not.

Expert's answer

#include <iostream> #include <string> #include <math.h> #include <stdio.h>using namespace std;int main () {     int m,s,p;     {      cout <<"-If the driver is married:-\n";      cout<< "1. yes\n";      cout<< "2. no\n";      cin >> m;              while (m==1)        {      cout <<"-You are insured-\n";          return 0;           }      }  {  cout <<"-Enter sex-:\n";      cout<< "1. male\n";      cout<< "2. female\n";      cin >> s;         cout <<"-Enter your age-:\n";      cin >> p;       }      if ((s==1, p>39) and (s==2, p>25))      cout <<"-You are insured-\n";      else     cout <<"-You are not insured-\n";     return 0; }
LATEST TUTORIALS
APPROVED BY CLIENTS