All pastes #550418 Raw Edit

Untitled

public text v1 · immutable
·published 2007-06-08 12:37 UTC
rendered paste body
#include <iostream> 
using namespace std; 
 
int main( ) 
{  
  int ctr, nWomNoTV, nWomMov, nYoungSport, nOldMSport; 
  for(ctr=1;ctr<=3; ctr++)
  {
   
     int age;
     char gend, inter;
      
     cout << "How old are you?" << endl;
     cin >> age;

     do
     {
       cout<< "What is your gender (M for male, F for female)?\n";
       cin >> gend;
     }
     while((gend !='M')&&(gend !='F')&&(gend !='m')&&(gend !='f'));

     cout << "Which of the following types of TV programs do you watch most often (choose one of N, S, M, E, O or X): \n N:  news \n S:  sport \n M:  movies, soaps, dramas, series  \n E:  educational, documentaries \n O:  other  \n X:  I do not watch TV. \n ";
     cin >> inter;
  
  if ((gend == 'F') && (inter == 'X'))
  nWomNoTV++;
  else if ((gend == 'F') && (inter == 'M'))
  nWomMov++;
  else if ((age < 20) && (inter == 'S'))
  nYoungSport++;
  else if ((gend == 'M') && (age > 35) && (inter == 'S'))
  nOldMSport++;
  }
  
  cout << "women older than 30 years do not watch TV at all : " << nWomNoTV << endl;
  cout << "women indicate M for their favourite : " << nWomMov << endl;
  cout << "people younger than 20 years indicate S for their favourite : " << nYoungSport << endl;
  cout << "men older than 35 years indicate S for their favourite : " << nOldMSport << endl;
  
}