Does anyone know any website where I can review for test, or find chapter reviews or anything that could help me with my review for my exam on CS. The CS book that I'm currently using is (Program...
Type: Posts; User: newbi
Does anyone know any website where I can review for test, or find chapter reviews or anything that could help me with my review for my exam on CS. The CS book that I'm currently using is (Program...
Alright....I guess i was a bit sleepy b4 i read ur reply. Well i got things working now. Thanks. Now I just have to loop it 5 times for 5 election come out.
Well apart from the "else" change, its all the same. Still "0" value for the Candidates at the end.
4
4
1
well its either 1-4
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int main (void)
{
int C_A = 0, C_B = 0, C_C = 0, C_D = 0;
int loop = 0, i = 0, pre = 0;
int...
Well then would you please tell me why my 1st code wasn't working
i tried this code but it keeps giving me the same value every time
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int main (void)
{ ...
1. Create an array of 500 voters, name it Votes [500]
2. Now using an index execute the array 500 times to produce a random number between 1 to 4
like;
for (i = 0; i <501; i++)
...
1. Describe the program
2. Randomly generate 5 election outcome from 5 precinct.
a. Each precinct has 500 voters
b. 500 votes are distributed among 4 candidates
3. Add up the total votes for...
M guessing my loop is not executing
You can just ignore the for statement altogether.
well for now i just want 2 display 500 votes distributed among 4 candidates. And there is 5 precinct. But i'm not worrying about that right now. I just want 2 display the votes for 5 candidates
the "pre" things is actually precinct. I wanted 2 do it 5 times.
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int main (void)
{
int C_A = 0, C_B = 0, C_C = 0, C_D = 0;
int loop = 0, i = 0,...
So u have a separate variable from each candidate and you randomly generate vote for each candidate 500 times and at the end just add which candidate got what number of total votes. I feel so lost....
Naaa just show how much each candidate got among 500 votes. U know its like he final result of an election. U show side by side what each candidate got among a certain # of voters.
e,g. Candidate A...
Randomly. After I'm done with the code the user will execute the program and will find the 3 candidates side by side with their randomly generated votes (500 votes distributed among 3) But i cant...
Alright, so what I'm trying to do is write a code that distributes 500 votes among 3 candidates. How am I supposed 2 do that.
I tried distributing random numbers among 3 but that didn't worked...
Well I don't need the rules. I just I have to test the probability. The algorithm that I came up with was:
1. Intro msg
2. Ask the user if he wants to know the odds of rolling a Yatzee on a single...
Nothing helpful I'm affraid
The odds of rolling a Yatzee on a single roll of 5 dice is 1/1296. Write a C program that tests this. Test it 1000 times.
Ok so I tried to code it and found out I had no idea what to do. Tried few...