#include <iostream> int main() { int n, a, b; std::cin>>n; a=n%10; b=(n+8)%12; switch(a) { case 0,1:cout<<"White\n";break; case 2,3:cout<<"Black\n";break; case 4,5:cout<<"Green\n";break; case 6,7:cout<<"Red\n";break; case 8,9:cout<<"Yellow\n";break; } switch(b) { case 0:cout<<"Крыса\n";break; case 1:cout<<"Корова\n";break; case 2:cout<<"Тигр\n";break; case 3:cout<<"Заец\n";break; case 4:cout<<"Дракон\n";break; case 5:cout<<"Змеи\n";break; case 6:cout<<"Лошади\n";break; case 7:cout<<"Овца\n";break; case 8:cout<<"Обезьяна\n";break; case 9:cout<<"Курица\n";break; case 10:cout<<"Собака\n";break; case 11:cout<<"Свинья\n";break; } system("pause"); return 0; } 

Closed due to the fact that it was off topic by Nicolas Chabanovsky 11 Oct '16 at 8:38 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - Nicolas Chabanovsky
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • and what a mistake? - Naumov
  • one
    @Naumov would venture to suggest that cout is not in this scope :) - D-side
  • Knocks a mistake in every cout in the first switch + first cout in the second - Vova

2 answers 2

Or add

 using namespace std; 

or

 using std::cout; 

or replace each cout with std::cout ...

  • I tried, nothing has changed: 10:11: error: expected ':' before ',' token 10:11: error: expected primary-expression before ',' token - Vova
  • And this is no longer connected with cout , but with case :) - see the answer @yrHeTaTeJlb - Harry
  • now: 3: 1: error: expected initializer before 'using' 4: 1: error: expected unqualified-id before '{' token - Vova
  • @ Vova ideone.com/uA1nnC - Harry

1) std::cout
2) Instead of

 case 1, 2: cout << "smth"; break; 

need to write

 case 1: case 2: cout << "smth"; break; 
  • And by the way, it’s funny that these cases VC ++ compiles with a bang, perceiving, it seems, as a composite operator ... - Harry
  • #include <iostream> int main () is now an error in : using std :: cout; * { 3: 1: error: expected initializer before 'using' 4: 1: error: expected unqualified-id before '{' token - Vova
  • @Harry: This is, by the way, a whole topic. Starting from C ++ 11, C ++ permits the use of an operator , in constant expressions. That is, the operator can be used to form values ​​in case labels. Another thing is that the grammar of a constant expression requires parentheses: i.e. case (1, 2): allowed in C ++ 11 (but not in C ++ 03). From this point of view, VC ++ in this case simply "forgot" to require brackets. - AnT
  • @AnT fiddled with him a bit - he agrees to a comma, but only if there is a constexpr in front of her, so there’s something like a debugging output not to plug in. - Harry
  • @Harry: Yes, the general requirements imposed on the operands of a constant expression apply to both operands,. - AnT