Okay I worked really hard and this is what I got so far!!
PLEASE WOULD YOU BE SO KIND TO HELP ME WITH THE CODE ON HOW TO DECIDE THE WINNERS?!!?!
4- The winner is decided as follows:
a. If neither of the outcomes are a double such as ‘1-1’ or ’2-2’ or ’3-3’ or ‘4-4’ or ‘5-5’ or ‘6-6’ one of player 1 with the larger total wins, and if the totals are equal, it is a draw
b. If one outcome is a double, and the other is not, the player with a double wins and the totals will be irrelevant
c. If both outcomes are a double, then the player with the higher double wins, and if the doubles are equal, it is a draw
Please help me with deciding the winners code that's the most vital!!
ALSO,, my game is playing with the computer how do I change it to two players???
THE CODE SO FAR!!!
#include <iostream>
#include <time.h>
#include <cstdlib>
#include <windows.h>
using namespace std;
void one();
void two();
void three();
void four();
void five();
void six();
//Declare Functions used
int main()
{
int score = 0;
int compScore = 0;
int num = 0;
int num2 = 0;
int compNum = 0;
int compNum2 = 0;
int sum = 0;
int compSum = 0;
char letter;
//Declare Variables
srand(time(NULL));
//Initialize random number generator
system("title Joe's Dice Game");
while (letter != 'q')
{
cout << "Your Score: " << score << endl;
cout << "computer's Score: " << compScore << endl << endl;
cout << "Press r to roll or q to quit: ";
cin >> letter;
num = 1 + rand() % (6 - 1 + 1);
num2 = 1 + rand() % (6 - 1 + 1);
compNum = 1 + rand() % (6 - 1 + 1);
compNum2 = 1 + rand() % (6 - 1 + 1);
//Random numbers
sum = num + num2;
compSum = compNum + compNum2;
//Calculate Sums
if (letter == 'q')
break;
if (letter != 'r')
{
system("cls");
continue;
}
switch (num)
{
case 1:
one();
break;
case 2:
two();
break;
case 3:
three();
break;
case 4:
four();
break;
case 5:
five();
break;
case 6:
six();
break;
default:
cout << "Error...";
break;
} //end switch
switch (num2)
{
case 1:
one();
break;
case 2:
two();
break;
case 3:
three();
break;
case 4:
four();
break;
case 5:
five();
break;
case 6:
six();
break;
default:
cout << "Error...";
break;
} //end switch
Off of the intended topic, as a mechanical engineer programming is VERY important! If you want to confirm an equation you've written, MATLAB is an engineer's best friend where you'll need to learn to code. You'll often need to tune in code to get a finite element analysis to work, or you will undoubtedly need to design/run simulations on the parts you design. Programming is very important to an engineering career. The specific language may not be so important, but the mentality that you need a function here, make a loop there, and organize my programs like so is a fundamental skill that you will require.
On topic, the logic is actually laid out right there. You just need to put it into code: