C++ ::  Array Traversal - Output Each Student And Score That Falls Below Average

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


ADVERTISEMENT

C :: How To Get The Average Score For Each Student

Nov 10, 2013

I have to get the average score for each student. And modify my avgmarks function and write the marks to a output txt file.

Code:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>

int bubble(int*,int);
void filewrite();
void avgmarks();
void fileprint();
void filesort();
void rollin();

[Code] .....

View 1 Replies View Related

C/C++ :: Student Input Name And Score / Output Grade

Oct 29, 2014

I need to get Students to input there Name And Score > and for me to output the grade. This works but I want to tidy this up so I can see all the names and grades when the program finishes.

#include "stdafx.h"
#include "stdafx.h"
#include <conio.h>
#include <iostream>
#include <stdlib.h>
#include <string>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])

[Code] ....

View 9 Replies View Related

C++ :: Make Average / Maximum / Minimum Score To Output File?

Nov 3, 2013

i have to make a score average, minimum, maximum as statistics for the out file. here is the code i have done:

Code: #include "stdafx.h"
#include <iostream>
#include <string>
#include <fstream>

[Code].....

View 1 Replies View Related

C/C++ :: Array To Only Print Out Final Average And Final Maximum Score With Final Minimum Score

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

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 View Related

C :: Trying To Match Student ID With Highest Score Along With Grade

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

C# :: Calculating Average Of Array And Output

May 3, 2015

Now this issue is about calculating the average of numbers and displaying it in the out put.

The following numbers is what I have read in from a file. There are 7 lines all the same format, just different values of course.

132475.889.392.3
435686.383.498.3

The output will need to look like:

Student #Test1Test2Test3Average
132475.889.392.385.8
435686.383.498.389.3

My program thus far is: (omitted code to shorten post and remove irrelevant information.

I don't know if it is because I have been working on other things and forgot how to proceed with the calculations and display, but I am just stuck. I'm not sure how to have the program read the numbers from columns 2 through 5 and then divide by 3. As you can see in my DisplayAverages() method I should have the ConsoleWrite and WriteLines done properly.

static void Main()
{
double[,] scoresArray = new double[7,4];
LoadFile();
ReadData(scoresArray);

[Code]....

Should read columns 2-4 and then display the average in column 5.

View 5 Replies View Related

C++ :: Find Average / Highest And Lowest Score?

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

C/C++ :: Implement Breadth First Search Graph And Output Order Of Traversal

Mar 26, 2014

I'm new to program breadth first search and for my assignment we have to implement a breadth first search graph and output the order of the traversal. The problem is when I run my program I do not get any output from my traversal. All I get is "Breadth First Search Traversal starts at Vertex 2 and the order is: "

Here is my Queue class

//Declaration of node
struct node{
int info;
node *next;
};
//Defining Queue class
class Queue{

[Code] ....

View 4 Replies View Related

C++ :: Using A For Loop To Input And Output Array Values Also Calculate The Average

Jan 24, 2014

I have this code that im stuck on what i need to do is Extend the code such that when it starts the user is asked to input values to specify each of the three ranges before moving on to accept and tally the main values how do i do that Using a for loop to input and output array values Also calculate the average

*/
#include <stdio.h>
int main(void)
{
/* Declare an array of integers */
int Grades[5];
int nCount;
int nTotal = 0; /* Declare and initialise the value */
float fAverage;

[Code]...

View 1 Replies View Related

C :: Enter Test Marks Of Several Students And Calculates Average Marks Of Each Student

Mar 10, 2013

Write a program that a prof can use to enter the test marks of several students and which calculates the average mark of each student. Ask the user how many students he has, then ask him to enter each student's marks. When 999 is entered, calculate the average mark for that student (not counting the 999) and print the average. Then go on to the next students until the marks for all students have been entered, calculated and the average printed.

Code:
#include<stdio.h>
main() {
float student,mark,total=0;
float a,b,c;
int num = 999;
printf("

[Code] .....

View 2 Replies View Related

C++ :: Video Game - Compare 3 Players Score And Output Highest

Oct 21, 2013

I was tasked with creating a program that asks for the scores of three gamers then takes these scores and outputs the highest. I THINK I have the other parts down but I don't know how to get the program to compare the scores and output the highest without having to write a long list of commands comparing playerone to playertwo, then player one to playerthree, then player two to playerone, etc.

#include <iostream>
using namespace std;
int main () {
int playerOne, playerTwo, playerThree;
cout << "Please enter score for Player One: ";
cin >> playerOne;

[Code] .....

View 10 Replies View Related

C++ :: Manipulate Array Of Student Record Objects

May 15, 2014

Create an application to manipulate an array of student record objects. A student record will consist of a name (first, middle, and last), an ID number (9 numeric digits, cannot be more or less), an address (street, city, state, and 5 digit Zip code), and a phone number (3 digit area code and 7 digit number). The application will support an array of students. The user will be allowed to enter records from the keyboard, sort records by either name (last, first, middle) or by ID, save the records to a disk file (name supplied by user), and read the records from a disk file (name again supplied by user).

Create a fixed length string that must check that the length of the string is the required length. The fixed length class should be done as a template with the number of characters as the template argument. From this fixed length string, derive a class to hold digits of a fixed length.

Create component classes as necessary to use together to implement the student record class.

Use either the array template created in an earlier lab to handle the array or you may use the vector class from the STL to handle the array of student record objects.

The maximum number of students will be 25 (it may be less).

View 1 Replies View Related

C++ :: Take Integer Score Inputs From Keyboard Into Array

Apr 2, 2014

This program is supposed to take integer score inputs from the keyboard into an array and use a sentinel of -999 to end the process.It should call a show() function which passes the array and displays the name and number of the integer for the output.

# include <iostream>
using namespace std;
int main() {
int score(double array1[], int numbers);

[code].....

I am getting an error in the for loop r<number which states "Error identifier "numbers" is undefined" and on my array1 "Error identifier "array1" us undefined" also in my for loop.

View 3 Replies View Related

C++ :: Using Array To Accept 10 Test Score - Print Highest / Lowest And In Reverse Order

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

C :: Print Correct Normalized Value / Average And Values Above Average

Nov 14, 2013

I must write a function that has a one dimensional double array and the number of values in the array as its arguments. Normalize the values. I must also print the maximum, minimum, average and numbers of values above the average in the array.

The equation that computes the normalized value from a value x is:

Normalized x= (x-min(array))/(max(array)-min(array))

My code does not print the correct normalized value, average and values above average.

Code:
#include <stdio.h>
int findMax( double array1[], int num_elements) // This function computes the maximum value of the array
{
int i, max=-32000;
for (i=0; i<num_elements; i++)

[Code] .....

View 5 Replies View Related

C++ :: Average Negative / Positive Numbers And Total Average?

Nov 18, 2013

I am trying to average the negative numbers and positive number and of course the total average.

This will read in a list of n values, where n is not known ahead of time. The number of values read into the array will be saved in n.

vector<int> readList() {
std::vector<int> result;
ifstream inFile;
inFile.open("setA.txt");
for (int x; inFile >> x; ) {
result.push_back(x);

[code]....

array is a one-dimensional array of integers and n is the number of elements in that array that contain valid data values. Both of these are input parameters to the function. The function must calculate 1) the average of the n integers in array, storing the result in ave; 2) the average of the positive numbers (> 0), storing the result in avePos, and 3) the average of the negative numbers (< 0), storing the result in aveNeg.

void avgs (std::vector &array, int &ave, int &avePos, int &aveNeg) {
int sum = 0, pos_sum = 0, neg_sum = 0, pos_count = 0, neg_count = 0;
for (auto i : array) {
sum += i;
if (i > 0) { pos_sum += i; ++pos_count; }

[code]....

View 1 Replies View Related

C++ :: Getting Average Value Of Array In Function

Nov 29, 2014

How to power value in function too.

View 2 Replies View Related

C++ :: Finding The Average Of Array

Apr 16, 2013

I am attempting to write a program that takes a number(picked by the user) of test scores in an array then calculates the average and outputs the number of passed and failed tests.

On a side note I am attempting to use array notation in the main function and pointer notation in the other functions

#include<iostream>
#include<iomanip>
using namespace std;
int numScores;
int counter = 0;
double *scores;
//Function Prototypes

[Code]...

View 3 Replies View Related

C/C++ :: Get Average Of Numbers In Array

Jul 5, 2014

I was trying to make a program that asks the number of grades, get the grades and then get the average. I know I have to save the grades in an array but i don't know exactly how.

View 12 Replies View Related

C++ :: Graph And Binary Tree Traversal

Mar 30, 2014

I used a BFS to simulate graph-join structure in a C++ code, and had a binary tree that asks the user e.g. to insert a node in the tree among other options, anyhow, I reached a point where I should pass a set of vertices from the graph to the tree, but how to do so. So I wanted to ask is such a thing possible? i.e. passing vertices from a graph to a tree automatically (no user involvement is needed)?

View 4 Replies View Related

C++ ::  Traversal In Binary Search Tree

Apr 29, 2013

Traversal of binary search tree. In my header file there is a function setTraversal (public) and private print file. As I understood from teacher's explanation, my setTraversal function should call the recursive print function and print the list depending on selected order (pre,in or post-order). I still cannot get my head around what should be in setTraversal function definition. All resources I read last two days explain each order separately (preorder, inorder, postorder). How can I combine them? Here is my code:

#include "NodeTypeBST.h"
#include <iostream>
enum TravType {PRE, IN, POST};
template<class T>
class BST

[Code] ....

View 1 Replies View Related

C/C++ :: Binary Tree Preorder Traversal

Jan 14, 2015

I have written a code for binary tree and i want pre-order traversal of tree but my code is producing wrong output.

#include<stdio.h>
struct node {
int data;
struct node *right;
struct node *left; };
struct node *root = NULL;

[Code] ....

View 6 Replies View Related

C++ :: Array In Ascending Order And Average

Mar 19, 2014

I am getting the hang of it pretty well. I created a program that asks the user to input arrays. Now, I need to calculate the average of the inputted arrays, and I need to place them in order from low to high. I have been struggling with doing these two parts for a while now and now decided that the book is not useful, I need some from some actual programmers. I attached my program.

My program printed here!

Code:
#include
<iostream>
using
namespace std;
int
main()

[Code].....

View 4 Replies View Related

C++ :: Calculate Average From Array Values

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







Copyrights 2005-15 www.BigResource.com, All rights reserved