Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.17 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6.    
  7.     int variable;
  8.     cin>> variable;
  9.    
  10.     switch(variable){
  11.         case 1:{
  12.             const int arraySize = 6;
  13.             double array[arraySize];
  14.             double input;
  15.             int condition = 0;
  16.            
  17.             for(int i = 0; i < arraySize; i++){
  18.                
  19.                 do{
  20.                     cin >> input;
  21.                     if((input >= 0) and (input <= 10)){
  22.                         array[i] = input;
  23.                         condition++;
  24.                     }
  25.                     else break;
  26.                 }while (condition < arraySize);
  27.             }
  28.            
  29.             for(int i = 0; i < arraySize-1; i++){
  30.                 cout << array[i] << " ";
  31.             }
  32.             cout << array[arraySize];
  33.            
  34.             break;
  35.         }
  36.        
  37.         case 2:{
  38.            
  39.             break;
  40.         }
  41.        
  42.         case 3:{
  43.            
  44.             break;
  45.         }
  46.        
  47.         default:{
  48.             cout << "Wrong task number.";
  49.            
  50.             break;
  51.         }
  52.        
  53.     }
  54.    
  55.     return 0;    
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement