C-language Golden dot Game

Source: Internet
Author: User

After a constant effort, this code has a little flaw, and the basic functionality has been implemented.
#include <stdio.h> #include <stdlib.h> #include <string.h>int point () {int i,j,k,m,n; int max = 0, min = 0; int m[100], n[100]; Double average, g,sum = 0.0;int score[100];p rintf ("Welcome to the Golden Dot game! \ n "); printf ("Please enter the number of game rounds: \ n"); scanf_s ("%d", &m); printf ("Please enter the number of games: \ n"); scanf_s ("%d", &n); memset (score,0,sizeof (int) *n); for (i = 0; i < M; i++) {printf ("\ n%d-wheel game: \ n", i+1); for (j = 0; J < N; J + +) {printf ("Please enter a 0-100 number: \ n"); scanf_s ("%d", &m[j]); sum = sum + m[j]; Average = sum/n; G = average*0.618; N[J] = m[j]-G; n[j]= (n[j]>0)? N[J]: n[j]* (-1); Max= (N[j]<n[max])? Max:j;min= (N[j]<n[min])? J:min; }//printf ("\n%d\n", Max),//printf ("%d\n", Min), score[max]-=2;score[min]+=2;for (k=0;k<n;k++) {printf ("% D people the total score after this round is%d:\t ", K+1,score[k]);} sum = 0; printf ("Golden dot is%f", G); max=0;min=0;} return 0; }int Main () {point (); System ("pause"); }
Note: This blog is original, reproduced please declare

  

C-language golden dot game

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.