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
ADVERTISEMENT
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
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
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
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
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
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
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
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
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
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
Feb 17, 2015
#include <iostream>
#include <string>
using namespace std;
struct studentType {
string name;
double gpa;
[Code] .....
View 11 Replies
View Related
Mar 26, 2013
//******************************************************************************
// GradeCalculator.cpp
// Input: Student Grades in Each Category
// Output: Final Grade, Numerical Grade, Witty Comment
// Final Grade Calculator
// This program calculates a final grade using a formula, assigns a
// corresponding letter grade, and outputs a "witty" comment to the user.
//******************************************************************************
#include <iostream>
#include <fstream> // For file I/O
#include <string>
#include <iomanip>
#include <cmath>
using namespace std;
// Declare function prototypes
void OpenFiles(ifstream&, ofstream&);
[Code] .....
View 1 Replies
View Related
Feb 24, 2014
My assignment for class was to create a Student ADT. I have three files. First one is Student.h which defines a Student record and has the prototypes of the functions that can be used with Student. I have Student.cc which is where the functions are actually declared. And my final file is testStudent.cc where the "main" function is that is creating a Student and callign all of the functions to make sure they work properly.
I have all of the functions working properly, except for my destroyStudentRecord function. It is supposed to deallocate the record, but I am unsure of how to actually do this. The current implementation appears to only deallocate the firstName field, as when you display the record after deallocationg it, everything still shows up except the first name. I have tried deallocating each field of the record before deallocating the record itself and that gave me the biggest list of errors I have ever seen.
I realize the implementation of some things in here might be a bit odd, but this is exactly how we are required to do things for this assignment and nothing about the implementation can really be changed unless something is actually just plain wrong(which is of course a possibility as I am quite new to this!). As I said though, everything else is working exactly as it should be, so my only issue at all is with actually deleting the record once I have created one.
Student.h:
#include <iostream>
#include <cstdlib>
using namespace std;
#ifndef _STUDENT_H_
#define _STUDENT_H_
struct Student {
[Code] ....
View 9 Replies
View Related
Mar 12, 2013
I'm trying to add more student information to the specific txt file. I did struct my student information and separated it with an array with max size of 200.
The inside of my current file looks like
Toshi
Aka
Nonal
Donald
The first one represent student[0] and next one is student[1] and so on till student[199]. Right now, only 4 space is occupied, which means the array has information till student[3] but not from student[4] (I guess it has null condition).
What I want to do is, I want to add a new student information to student[4] and till student[199] once at each time.
So, my prompt will look like
Would like to add a new student? Y/N
(if yes goes to below statement and exit if NO)
Hi. Please enter the information of new student. ___________
Student added. Please press any key to continue.
If the key is pressed, it goes back to my initial prompt and continues till I press N.
I sure I'm not using for loop to do this thing, because I'm adding student name one by one.
However, the array is already occupied by other student name till student[3] so, I want to add a new student information to student[4] (I don't want to overwrite the current information). And if student[4] is occupied, then [5] and so on.
View 7 Replies
View Related
Aug 14, 2012
i wnt to display student who get highest marks among them...i have code for finding maximum marks from them but don't kne how to print only top 5 student...
Code:
static void Main(string[] args)
{
Console.WriteLine("Please Enter Number of Students :");
int n = Convert.ToInt32(Console.ReadLine());
StudentDetails[] student = new StudentDetails[n];
for (int row = 0; row < n; row++)
{
Console.WriteLine("Please Enter Student name :");
[Code]...
(dis code in Visual Studio)
View 6 Replies
View Related
Mar 6, 2013
I've remade a program to store student database using linked list. When I try to display the list of student with their information (It displays nothing)
Code:
#include <iostream>
#include <string>
using namespace std;
struct StudentRecord {
[Code] ....
View 4 Replies
View Related
Jan 6, 2015
For Example i have made a text file included some students data. Now i want to change just a single student data. That file should remain same just that student's data replace.
View 3 Replies
View Related
Oct 3, 2014
what is the process of student profiling system using c++?
View 2 Replies
View Related
Apr 2, 2014
So I have to store a student Id and gpa and name in a linked list. I keep getting error messages.
Like: lab 20.cpp(43): error C2628: 'Student' followed by 'int' is illegal (did you forget a ';'?)
(43): error C3874: return type of 'main' should be 'int' instead of 'Student'
(71): error C2664: 'Student::Student(const Student &)' : cannot convert parameter 1 from 'int' to 'const Student &'
Reason: cannot convert from 'int' to 'const Student'
No constructor could take the source type, or constructor overload resolution was ambiguous
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <string>
using namespace std;
struct Student {
string name;
double gpa;
[Code] ....
View 1 Replies
View Related
Jul 3, 2013
I am trying to use a class Student and declare it as a list type. I can pushback but without changing the List.h or Node.h how can I print the data in list2?
Node.h
#ifndef NODE_H
#defineNODE_H
#include <string>
[Code].....
View 6 Replies
View Related
Sep 27, 2014
I'm trying to write a table (2D array) with a string of random chars in one row for the student names, six other rows for the project numbers and random numbers for the grades.Then calculate the averages of grades per student and per project, add them as the last row and the last column. And write a menu of 4 options:
1- sort per student names (alphabetical order)
2- sort per student grades (in increasing order)
3- sort per project grades ( in increasing order)
4- exit
The program must continue execution after displaying any report, need to use an infinite loop, it exits only if the chosen 'exit'.
Here's what I have:
#include <ctime>
#include <string>
#include <iomanip>
#include <iostream>
using namespace std;
ints=12,p=6;
stringnames[20];
[Code] ....
And then, I need to show interactively the same report with all types of sorting:
sort table by any row, (user enters the row number)
sort table by any column. (user enters the col number)
sort table sorted by student names as well.
View 12 Replies
View Related
Feb 25, 2013
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <conio.h>
#include <windows.h>
}
[code]....
I dont know how to modify the previous record that i have done in the Add Student function. i searched from different sites and got this code for modifying a record in a text file. But, i cant figure it out why its not working.
View 2 Replies
View Related
Dec 17, 2014
The programme has to be a linked list to gather student info, (ie name, lastname, student no, and three grade); the first and last name must use malloc correctly, there must be an insert and delete function and a printfunction. and they must print out in alphabetical order.
Code:
#include #include #include struct student{
char *lastName;
char *firstName;
char dob[20];
char sID[20];
float grade;
[code] .....
View 7 Replies
View Related
Apr 23, 2013
I've been working on a student data base that reads in the students name, birth date, social security, and department name (or major). I have all these items in the header files respectively; nameType, dateType, personType, and studentType.
I am now to create another header file called HWONEHEADER that contains the functions showMenu, loadStudent, insertStudent, searchByName, and SaveStudents. This is how far ive gotten
#ifndef HW
#define HW
#include <iostream>
#include <fstream>
#include <iomanip>
#include "studentType.h"
[Code] .....
Here is the cpp file i have.
int main() {
studentType department;
cin>>department;
cout<<department;
[Code] .....
I need with the HWONEHEADER using the ifstream and ofstream operators to load all the students information into a file called student.dat I'am extremely confused because i can't find anything in my textbook about using ifstream and ofstream operators.
View 3 Replies
View Related
Jun 21, 2014
I have to read a particular student data from file using his Roll no and modify it and then save it to file again
This is the File
24 salman 98 97 96 95 94 A ;
21 faizan 88 87 86 83 85 B ;
35 Gohar 99 98 97 96 90 B ;
45 sibghat 91 92 78 85 88 C ;
009 john 89 87 91 78 95 C ;
how can i read data of roll no 35 and modify it and save it again to the file
this is my program
int r = 0 ;
while ( ar[j]!="0" ) {
//cout << "Salman majid is
" ;
if ( ar[j]==k ) {
r = j ;
getdata() ;
[Code] .....
View 2 Replies
View Related