0

I'm working on a rolling dice program. The rules are below. I'm not sure how to reassign a value. For example, a value of 1 and 2, would equal 1; a value of 3 and 4, would equal 2; and a value of 5 and 6, would equal 3.

The Rules Are:
- 3 die
- Roll 1 = value 1 and 2
- Roll 2 = value 3 and 4
- Roll 3 = value 5 and 6

This is the code I have so far:

    int R1 = 0;  
    int R2 = 0;  
    int R3 = 0;  


    while (( R1 <= 0 ) || ( R1 >= 7 ))  {   
        printf( "Enter a value [1-6] to roll the dice: " );   
        scanf( "%d", &R1 ); 
    }   

    while (( R2 <= 0 ) || ( R2 >= 7 ))  {   
        printf( "Enter a value [1 - 6] to roll the dice: " );  
        scanf( "%d", &R2 ); 
    }   

    while (( R3 <= 0 ) || ( R3 >= 7 ))  {   
        printf( "Enter a value [1 - 6] to roll the dice: " );   
        scanf( "%d", &R3 ); 
    } 

Edited by finders

2
Contributors
1
Reply
6
Views
2 Years
Discussion Span
Last Post by Hiroshe
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.