csansoon

P6.04 P87910 Control C302F

Nov 7th, 2018
619
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5.  
  6. int main() {
  7.     int length,n=0;
  8.     char c;
  9.     cin>>length;
  10.     while (cin>>c){
  11.         switch (c) {
  12.             case 'a':
  13.                 cout<<".-";
  14.                 n+=2;
  15.                 break;
  16.             case 'e':
  17.                 cout<<".";
  18.                 n+=1;
  19.                 break;
  20.             case 'i':
  21.                 cout<<"..";
  22.                 n+=2;
  23.                 break;
  24.             case 'o':
  25.                 cout<<"---";
  26.                 n+=3;
  27.                 break;
  28.             case 'u':
  29.                 cout<<"..-";
  30.                 n+=3;
  31.                 break;
  32.         }
  33.         if (n>=length) {
  34.             cout<<endl;
  35.             n=0;
  36.         }
  37.     }
  38.     if (n!=0) cout<<endl;
  39.     cout<<"STOP"<<endl;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment