Advertisement
luishh

Untitled

Aug 18th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.13 KB | None | 0 0
  1. #include <iostream>
  2. #include <locale.h>
  3. using namespace std;
  4. int main (){
  5.     char s,c;
  6.     string n;
  7.     int i,m=0,f=0,maiorm=0,menorm=0,maiorf=0,menorf=0;
  8.  
  9.       cout<<"Deseja cadastrar o cliente? sim (s) ou nao (n)"<<endl;
  10.       cin>>c;
  11.      
  12.       do {
  13.       cout<<"Informe o sexo do cliente feminino(f) ou masculino (m)"<<endl;
  14.       cin>>s;
  15.       switch (s){
  16.         case 'm':
  17.             m++;
  18.             cout<<"Informe a idade do cliente"<<endl;
  19.             cin>>i;
  20.             if (i>=18)
  21.             maiorm++;
  22.             else
  23.             menorm++;
  24.             cout<<"Informe o nome"<<endl;
  25.             cin>>n;
  26.             break;
  27.         case 'f':
  28.             f++;
  29.             cout<<"Informe a idade do cliente"<<endl;
  30.             cin>>i;
  31.             if (i>=18)
  32.             maiorf++;
  33.             else
  34.             menorf++;
  35.             cout<<"Informe o nome"<<endl;
  36.             cin>>n;            
  37.             break;
  38.       }
  39.  
  40.     } while (c==s);
  41.     cout<<m<<" homens"<<endl;
  42.     cout<<f<<" mulheres"<<endl;
  43.     cout<<maiorm<<" homens maiores de 18 anos"<<endl;
  44.     cout<<menorm<<" homens menores de 18 anos"<<endl;
  45.     cout<<maiorf<<" mulheres maiores de 18 anos"<<endl;
  46.     cout<<menorm<<" mulheres maiores de 18 anos"<<endl;
  47.                
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement