473,403 Members | 2,270 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

finding mode score

they give us 10 days to do a program of finding the modes using array. and i dont really know how to do it :(

1.get the number of score of the user
2.allocate array
3.get the scores
4 short scores(array)
5. find the mode ang how may use it.

i hope you can help me.thank you in advance :)
Attached Images
File Type: jpg IMG_20180222_193219.jpg (50.6 KB, 96 views)
Feb 24 '18 #1

✓ answered by donbock

Your screen shot says step 5 is to find the middle value in the sorted array. The middle value is the median. The steps for finding the mode are quite different. Which are you being asked to find?

Are you allowed to use the sort function in the standard library or are you expected to write your own?
Which sort algorithms have been discussed in your class?

8 2155
donbock
2,426 Expert 2GB
Your screen shot says step 5 is to find the middle value in the sorted array. The middle value is the median. The steps for finding the mode are quite different. Which are you being asked to find?

Are you allowed to use the sort function in the standard library or are you expected to write your own?
Which sort algorithms have been discussed in your class?
Feb 27 '18 #3
1.get the number of score of the user
2.allocate array
3.get the scores
4 short scores(array)
5. find the mode ang how may use it.

the one on picture is the example they give us but in example they find midian but our asignment is finding the mode
Feb 27 '18 #4
donbock
2,426 Expert 2GB
You need to count how many students have each score. The score(s) with the most students is(are) the mode.

What is the nature of the scores — are they integers or floating-point?
Mar 2 '18 #5
it is int ... ................................................
Mar 9 '18 #6
donbock
2,426 Expert 2GB
The relevance of integers versus floating-point is that
  1. There are a finite number of integer scores
  2. Integer scores can be reliably compared for equality
Mar 10 '18 #7
donbock
2,426 Expert 2GB
Suppose the test consists of 200 questions; all questions have the same weight; and there is no partial credit. There are then 201 possible scores — corresponding to how many questions were answered correctly.

A brute force approach to finding the mode is to define a 201-element score-tally array; initialize each entry to 0; scan through the list of per-student scores, incrementing the corresponding entry in the tally array; and finally, find the largest entries in the tally array. (I say entries because several scores may be tied for largest tally.) The mode value is the array index of the maximum tally value(s), not the maximum value itself.

This is known as a sparse array technique - sparse because many entries in the tally array remain 0. There are other techniques that use less storage but require more complicated code.
Mar 10 '18 #8
#include"stdio.h"
#include"conio.h"
#include"alloc.h"

//reads a binarry file then display odds

int main (int argc, char *argv[])

{
FILE *fp;
int *arx , n , i,j, counter;

if( argc!=2)
{
printf("syntax: error:compo < filename.dat>");
return 1;
}

fp = fopen(argv[1],"rb");

if(!fp)
{
printf("file not found!");
return 1;
}

fread(&n,sizeof(int),1,fp);

arx= (int*) malloc(n* sizeof(int));

if(!arx)
{
printf("allocation error!");
return 1;
}

fread(arx,sizeof(int),n,fp);


for(i=0;i<n;i++)
{
counter=0;
for(j=2;j<arx[i];j++)
{
if(arx[i]%j==0)
{
counter=1;
break;
}
}
if(counter==0)
{
printf("\nprime numbers are %d",arx[i]);
}
}



fclose(fp);
free(arx);
return 0;

}


i want to find and print composite and prime number...waht should i do?? help me please
Mar 15 '18 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Han | last post by:
Determining the pattern below has got my stumped. I have a page of HTML and need to find all occurrences of the following pattern: score=9999999999&amp; The number shown can be 5-10 characters...
2
by: Paweł | last post by:
Hello! I'm looking for efficient code or site where I can find code for finding one string in another string. String which I search should have "wild" characters like '?' for any one char and...
1
by: Ray Gurganus | last post by:
I'm using mysql 4.1.7 on one machine and 4.1.9 on another, and on both I'm having trouble returning a score on a full-text index. The following returns 26 records and all scores of 0: SELECT...
0
by: phillip.s.powell | last post by:
SELECT id, student_first_name, student_last_name, major, minor , MATCH(major, minor) AGAINST ('"mechanical engineering"') AS score FROM students WHERE MATCH(major, minor) AGAINST ('"mechanical...
54
namcintosh
by: namcintosh | last post by:
First of all, here is my program: #include <iostream> #include <conio> using namespace std; //Function prototype void getscore(int&, int&, int&, int&, int&); void findLowest (int, int,...
8
by: guile | last post by:
Hi, Say, I am building a small gaming portal where people can play small games and score points. a player can play different games and the scores are logged in. now, given a user ID, how do I...
1
by: Flanders | last post by:
I have developed a small arcade game with the help of a few VB books. A scoring system was implemented in the design of the game but I as hoping that some one would be able to instruct me on how...
2
by: marybrown | last post by:
i will write the complete problem i am facing. Here is the input file i am using. sxoght: #query hit score probability qstart qend qorientation tstart tend matches mismatches...
1
by: shalu11 | last post by:
this my pgm can anyone help me finding my errors #include<iostream.h> #include<stdlib.h> #include<conio.h> #include<stdio.h> struct ques { char a; char ans; } q;
0
by: sc5502 | last post by:
There is a MS SQL Server table that has a Supplier Rating score in it. I have simplified it a bit. Here is how it is defined in SQL: Column Name Data Type ----------- --------------- id ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.