Is it possible to loop a switch?

I'm writing a program and I'm wondering if it's possible to loop a switch because my program is suppose to emulate a process going into the critical section of a computer. Something like this:

=========================================
You are in the critical section Reader 2
=========================================

=========================================
You are in the critical section Reader 2
You are in the critical section Reader 5
=========================================

=========================================

You are in the critical section Reader 2
You are in the critical section Reader 5
You are in the critical section Writer 2
=========================================


Until it is eventually full which would be with 3 readers and 3 writer


Thanks
If anyone can help it would be greatly appreciated
Yes:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>

int main()
{
    int i = 0, num = 0;
    
    for(i; i<10; i++)
     {
        std::cout << "enter a num: ";
        std::cin >> num;
        
        switch(num)
         {
           case 1:
                break;
           case 2:
                break;
           case 3:
                break;
           default:
                break;
         }
     }
    
    std::cin.get();
    return 0;
}


As a basic example. To be fair, you could have tested this yourself.

Sorrt I can't apply this to your situation - I don't completely understand what you're doing.
Topic archived. No new replies allowed.