doing some work for tafe here and got everything working for a dice simulator that needs to simulate 10000 throws of 2 dice and calculating how many times each number (2-12) comes up along with percentages and unfortunately it has to also stop between each loop thus the whole not using a switch and all the messy printf spam
really new to programming tbh but got everything working except the percentages and cant work out why any help would be much appreciated :D
#include<stdlib.h>
#include<stdio.h>
void main()
{
float Percentage1;
float Percentage2;
float Percentage3;
float Percentage4;
float Percentage5;
float Percentage6;
float Percentage7;
float Percentage8;
float Percentage9;
float Percentage10;
float Percentage11;
int Throws = 0;
int Target1 = 2;
int Target2 = 3;
int Target3 = 4;
int Target4 = 5;
int Target5 = 6;
int Target6 = 7;
int Target7 = 8;
int Target8 = 9;
int Target9 = 10;
int Target10 = 11;
int Target11 = 12;
int Hit1 = 0;
int Hit2 = 0;
int Hit3 = 0;
int Hit4 = 0;
int Hit5 = 0;
int Hit6 = 0;
int Hit7 = 0;
int Hit8 = 0;
int Hit9 = 0;
int Hit10 = 0;
int Hit11 = 0;
int Roll1 = 0;
int Roll2 = 0;
int Dice = 0;
Well everything in this assignment is working to a T except the percentages and if there a problem with the float arrays or mayhap one of the int arrays thats exactly why ive posted this to find out what the problem is and learn from it
ah okay unfortunately we havent been taught arrays yet so i might just have to see if i can find some information online about them and mayhap shorten/neaten this up in the process
thank you very much for your help
So ive fixed the array problem took a bit of learning but it was pretty easy but does anyone have a different way of fixing the percentages problem other than type-casting them? as the teacher is not very happy about doing that.... ever! :/