C++ :: Using Array Of 5 Scores And Calculate Average / Highest And Lowest Score
Apr 11, 2013
it compiles and runs, it gives me the average and the highest score but says lowest is 0 even though 0 is never entered.
Write a program which uses an array of 5 scores and calculates the average score, the highest score and the lowest score.
#include <iostream>
using namespace std;
int getHighest(int [], int);
int getSmallest(int [], int);
double getAverage(int [], int);
int count;
int numbers;
[Code] ......
View 2 Replies
ADVERTISEMENT
Oct 9, 2014
Create a 1-D Array to hold a set of exam scores:
55 74 93 84 64 72 69 78 87 84 72 33 83 68 62 51 88 90
Write a program to do the following tasks:
1. Display scores in rows of four(4) scores.
2. Calculate average score and display.
3. Find Lowest score and display.
4. Find Highest score and display.
5. Find the deviation of each score, and display the score and its deviation.
6. Find the Standard Deviation and Display
7. How many scores are within One Standard Deviation
So I have the average down, but I am getting stuck at the part of displaying the highest and lowest score. Every time I run the program I get two giant negative numbers for both of them. I put all the scores into a .txt file and I just opened in through the program.
#include "TCHAR.h"
#include <iostream>
#include <fstream>
#include <iomanip>
[Code]....
View 1 Replies
View Related
Jan 28, 2014
Using the array to accept 10 testscore. Calculate and print the highest, lowest, fifth test score entered and all the test score entered in reverse order.
How i would get it to print the highest,and lowest and in reverse order. I'm confused as to what to do...
View 4 Replies
View Related
Oct 22, 2014
I was asked to create a C++ program that allows a user to take a test with series of different questions, and also retake the test if they choose to. I have been able to do that. But the other condition is to display the highest and lowest scores (highest and lowest correct answers) the user got, and in which test they got that score. For example, if the user takes the test 3 times, in which test did they get the highest score, and in which did they get the lowest score.
This is how far I went with the program. The code below only let the user take the test as much as they want, and tell them how many times they took it, and the last score they had. My idea is this, if I can make a variable store each test score, then I can compare them. But since there is no definite number of tests to be taken.
#include <iostream>
#include <string>
using namespace std;
void main() {
int correct = 0;
int wrong = 0;
[Code] .....
View 3 Replies
View Related
Jul 24, 2014
I can display the highest and lowest score but I can't display the number of students who got the highest and lowest score.
int h=array[1];
int l=array[0];
int m=0,n=0;
for(int z=1; z<=20; z++) {
if(array[z]>h) {
h=array[z];
[code]....
this should be the output
12 students got the highest score of 45
8 students got the lowest score of 1
View 2 Replies
View Related
Apr 7, 2013
I have created a program that allows for a user-defined number of test scores as input. After the user enters these scores, the program calculates the average test score. Here is my code:
#include <iostream>
#include <iomanip>
using namespace std;
// Function prototypes
double getAverage(double*, int);
[Code] .....
I am having trouble with the final part of my program. How do I pass the array of test scores to a function that calculates how many people got an A (90+) on the test? The final output should look like this:
The average of those scores is:
The number of A grades is:
View 2 Replies
View Related
Oct 1, 2013
I have everything down except for the highest # and lowest number being displayed.
The arrays are 23, 4, 76, 89, 12, 43, 37, 67, 21, 14.
I have the average which is 38.6 but i stuck getting highest number and lowest.
View 7 Replies
View Related
Mar 25, 2013
I have this multi-dimensional array. There are 12 rows, each represents the months, and 2 columns, the 1st column represents the lowest temperature and the 2nd column represents the highest temperature.
I need to find the lowest temperature in only the first column and the highest in only the 2nd column.
This takes in the temperatures. LOHI = 2, MONTHS = 12, LOW = 0, HIGH = 1
void PopulateTemp(int temp[][LOHI])
{
for(int month = 0; month < MONTHS; month++)
{
cout << "Month " << month+1 << endl;
[Code]......
My professor said we only needed 1 for loop as you only need to read the data from one column in each?
View 10 Replies
View Related
Jun 8, 2014
I am doing a modification to a school project call rainfall statistics. I have that written, but need to sort the array and list rainfall totals from highest to lowest. I thought I knew what I was doing but I am having some difficulty locating all my errors, the error I keep getting now is:
1>------ Build started: Project: Rainfall Statistics Program, Configuration: Debug Win32 ------
1> Rainfall-main.cpp
1>Rainfall-main.cpp(88): error C2601: 'sortHighest2Lowest' : local function definitions are illegal
1> Rainfall-main.cpp(25): this line contains a '{' which has not yet been matched
1>Rainfall-main.cpp(96): error C2065: 'TOTAL_NUM_OF_MONTHS' : undeclared identifier
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Below is my code, I know i'm missing something, just can't see it.
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
//Here are the function prototypes
double getTotalRainfall(double[], int);
double getAverageRainfall(double[], int);
[Code] .....
View 2 Replies
View Related
Mar 8, 2014
// I believe my loop for the functions work but the values are not returning !
// Acoustic data
#include <iostream>
#include <fstream>
using namespace std;
double low( double []);
double high( double []);
void readArrayr( double [], double , double);
[Code] .....
View 6 Replies
View Related
Aug 27, 2014
#include <stdio.h>
float total, avg, max, min;
float judge[4];
int index;
int array[4];
int main() {
total = 0.0;
max = array[0];
min = array[0];
[Code] ....
I dont understand how to make the array when it prints out only print out the final average and the final maximum score with the final minimum score but what its doing at the moment is just giving an average for each individual score taken...
Minimum and maximum scores are displaying 0.0
And it displays these things 4 times in a row i just want it to be displayed once.
View 1 Replies
View Related
Jul 6, 2013
I am writing a function called swap that sorts the elements of an array in order from highest to lowest values where they descend and ascend. A particular thing about this function is that swap does NOT re-arrange elements in the array so it just uses a second array of indexes for the elements in the original array and then swap sorts the second array based on the values in the original array. A sorted version of the original array can then be produced with these sorted indexes. You can declare and initialize the original array without any user input.
For example, int arr[10] = {1, 5, 22, 14, 6, -5, 7, 9, 12, 15 };
Header of the function swap must be as shown below: void swap(int array[],int swapedIndexes [], int size, char mode) When mode is 'a', the function sorts the array in the ascending order, and when mode is 'd', the function sorts it in the descending order. int swappedIndexes[5];swap(array,swappedInde… 5, 'a');
So far I have this code that randomly generates arrays of 10 elements and I found the max and min, but I am confused on what to do about the swapping part? Also, how to make the numbers ascend or descend in numerical order?? Here is what i have done so far:
#include<ctime>
#include <iostream>
using namespace std;
int min(int [],int);
void max(int [],int , int &);
void main()
{ srand(time(0));
//1-declare
[Code] .....
View 1 Replies
View Related
Aug 26, 2013
I am having a problem printing out the results for my code, It is supposed to print out the largest and smallest value in the array, but keeps giving me a value not entered and I don't know why.
//This program lets the user enter 10 numbers and then display the highest and lowest number.
#include <iostream>
#include<stdio.h>
using namespace std;
int main() {
const int NUM_ENTERED = 9;
int number[NUM_ENTERED], highestValue = number[0], lowestValue = number[0], count=0;
[Code] .....
View 2 Replies
View Related
Oct 24, 2013
How to traverse through this array and output each student and score that falls below the average. I think I may have the method down for traversing through the list to find the "total score" however, before proceeding under a possible wrong presumption, I would like confirmation as to whether or not I'm understanding this or botching this concept.
void dispLowScore(struct payload *arrayStart , //first element of array
struct payload *arrayEnd ) //last element of array {
int studentCount; //total number of students in list/array
int totalScore ; //accumulated value of all scores added together
float averageScore; //totalScore / studentCount
[Code] ...
View 3 Replies
View Related
Jan 31, 2014
I have to create a program that calculates the final scores per diver, who each get five dives. I have to include the difficulty level when figuring out this score, and I need to drop the highest and lowest scores.
Now, I'm reading from a file where the values are something like:
234 :Diver number
2.3 :Difficulty
2.1 3.2 4.0 2.3 3.8 :Scores
Would I create a parallel array for the difficulty, or include it in a 2D array with the scores. Something like
score[Difficulty][individualScores]; ?
Also, would I include a findMin and findMax in a function that calculates the total, seeing as how the highest and lowest must be dropped to determine the final score?
View 11 Replies
View Related
Nov 23, 2013
I program a software to get scores from admin and sort them ascending then show the middle score(if admin enter middle).but when i compile it nothing happen.what should i do?here's code ,i use dev compiler
Code:
#include <cstdlib>
#include <iostream>
#include <math.h>
#include <string.h>
using namespace std;
int main(int argc, char *argv[]) {
int counter,j,count,counter2,m;
[Code] ....
View 14 Replies
View Related
Sep 29, 2013
How can I properly find the lowest and the highest temperatures?
#include <iostream>
#include <string>
using namespace std;
[Code]....
View 1 Replies
View Related
Feb 26, 2013
I'm having trouble, I want the inner loop to display the lowest and highest score. If I assign initial values for the high and low score, it won't always work (because if no/ all scores are above/ below my initial values...)
But without assigning initial values for highscore and lowscore, One of them will always be undefined during the first runthrough.
#include <iostream>
using namespace std;
const int AGRADE = 90;
const int BGRADE = 80;
const int CGRADE = 70;
const int DGRADE = 60;
int main() {
[code]....
how do i set this up so it stores a low and high score, and then compares those to each next number in the series?
View 6 Replies
View Related
Mar 12, 2014
I am trying to calculate the largest and smallest values using functions. I keep getting this (pointer-to) error
#include <iostream>
#include <conio.h>
using namespace std;
void getValues(int [], int);
void displayValues(const int[], int);
int largest(const int[],int);
int smallest(const int[],int);
void displayLargestSmallest(int,int);
[code]....
View 3 Replies
View Related
Apr 7, 2013
I cannot get this program from having a continuous loop. I need to have a user-defined loop.
Here is what I have so far:
Code:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int a,b,c,high,med,low;
[Code] ....
View 7 Replies
View Related
Sep 28, 2014
How do i sort numbers from highest to lowest using qsort? I dont have a code. I dont know how to use this one.
View 1 Replies
View Related
Nov 25, 2013
I am trying to correlate the student's highest score with that student's ID. The old code is in blue and the new code is in green which includes a sort. The particular information in question is in red.
Ide1
Code:
#include <stdio.h>
int main(void) {
/*Set up two arrays to include up to 50 elements each.*/
int st_numval_id[50] = {0}, st_val_tstscr[50]= {0}, i = 0, j = 0, temp;
[Code] .....
Enter the student's id and test score:
/*After the following input, then enter 0 to end the input*/
Student ID Test Score Letter Grade
------------ ----------- --------------
1653 77 C
1945 72 C
1020 50 F
1955 92 A
1900 81 B
ABOVE AVERAGE STUDENTS
Ave Test Score Students Above Ave Number of: A's B's C's D's F's
----------- ---------- --------- --- --- --- --- ---
62.00 4 1 1 2 0 1
THE STUDENT WITH THE HIGHEST TEST SCORE
Student ID Test Score Letter Grade
--------- ---------- ------------
1900 0 F
Press any key to continue...
View 1 Replies
View Related
Oct 29, 2014
For my program i need to sort my int numbers [5] from highest to lowest but it seems that i made it go from lowest to highest ...
Code:
#include <iostream>
using namespace std;
int main() {
int numbers[5] = {3, -6, 10, 1, 130};
int counter1, counter2, tempNum;
//Highest to Lowest
[Code] ....
View 1 Replies
View Related
Oct 28, 2014
How do I sort names and grades in C from highest to lowest?
John 91
Joseph 92
Mary 93
Jake 94
Sorted Scores from highest to lowest
Jake 94
Mary 93
Joseph 92
John 91
View 2 Replies
View Related
Jan 8, 2014
i wrote following code to calculate average of the values entered to the array.After displaying the output following error was displayed.
"Run-Time Check Failure #2 - Stack around the variable 'marks' was corrupted.
A buffer overrun has occurred in q 3 410005111.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program. "
//Average mark of student 1
cout<<"Avarage mark of the student 1 :"<<(marks[0][0]+marks[1][0]+marks[2][0]+marks[3][0]);
cout<<endl;
View 5 Replies
View Related
Apr 16, 2014
We're writing a program in class using data structures and arrays and I'm stuck on writing a loop to find the students' highest test score. I only return the first student's ID, test score, and grade. For some reason unknown to me I'm not actually looping through all 12 or so records.
Code:
#include <stdio.h>
#define MAX_ENTRIES 50
struct records
{ //declare my student records structure
int ID; //the student's ID number
int test_score; //the student's test score
char grade; //the student's letter grade of aforementioned test score
};
[code]....
View 5 Replies
View Related